Project

General

Profile

Bug #142 » sample_tracepoint_python.c

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

 
1
#include <Python.h>
2

    
3

    
4

    
5

    
6
#define TRACEPOINT_CREATE_PROBES
7
/*
8
 * The header containing our TRACEPOINT_EVENTs.
9
 */
10
#define TRACEPOINT_DEFINE
11
#include "sample_tracepoint.h"
12

    
13

    
14
static PyObject *
15
sample_tracepoint_message(PyObject *self, PyObject *args)
16
{
17
    const char *text;
18
    int sts;
19

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

    
24
    Py_INCREF(Py_None);
25
    return Py_None;
26
}
27

    
28

    
29

    
30

    
31
static PyMethodDef UstMethods[] = {
32

    
33
    {"message",  sample_tracepoint_message, METH_VARARGS,
34
     "Execute a tracepoint."},
35

    
36
    {NULL, NULL, 0, NULL}        /* Sentinel */
37
};
38

    
39

    
40
PyMODINIT_FUNC
41
initsample_tracepoint(void)
42
{
43
    (void) Py_InitModule("sample_tracepoint", UstMethods);
44
}
(1-1/4)