Project

General

Profile

Bug #142 » sample_tracepoint_python.c

Yannick Brosseau, 03/01/2012 10:43 AM

 
#include <Python.h>




#define TRACEPOINT_CREATE_PROBES
/*
* The header containing our TRACEPOINT_EVENTs.
*/
#define TRACEPOINT_DEFINE
#include "sample_tracepoint.h"


static PyObject *
sample_tracepoint_message(PyObject *self, PyObject *args)
{
const char *text;
int sts;

if (!PyArg_ParseTuple(args, "s", &text))
return NULL;
tracepoint(sample_tracepoint,message,text);

Py_INCREF(Py_None);
return Py_None;
}




static PyMethodDef UstMethods[] = {

{"message", sample_tracepoint_message, METH_VARARGS,
"Execute a tracepoint."},

{NULL, NULL, 0, NULL} /* Sentinel */
};


PyMODINIT_FUNC
initsample_tracepoint(void)
{
(void) Py_InitModule("sample_tracepoint", UstMethods);
}
(1-1/4)