~thomir-deactivatedaccount/autopilot/trunk-fix-eventually-matcher-docs

« back to all changes in this revision

Viewing changes to lttng_module/emit_tracepoint.c

  • Committer: Christopher Lee
  • Date: 2013-05-07 03:42:59 UTC
  • mto: This revision was merged to the branch mainline in revision 203.
  • Revision ID: chris.lee@canonical.com-20130507034259-beyj7phtng26ivnv
Working example, need to shuffle things around

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#include <Python.h>
 
2
 
 
3
#define TRACEPOINT_CREATE_PROBES
 
4
/*
 
5
 * The header containing our TRACEPOINT_EVENTs.
 
6
 */
 
7
#define TRACEPOINT_DEFINE
 
8
#include "emit_tracepoint.h"
 
9
 
 
10
static PyObject *
 
11
emit_tracepoint(PyObject *self, PyObject *args)
 
12
{
 
13
    const char *mesg_text;
 
14
 
 
15
    if(!PyArg_ParseTuple(args, "s", &mesg_text))
 
16
    {
 
17
        return NULL;
 
18
    }
 
19
    tracepoint(emit_tracepoint, message, mesg_text);
 
20
 
 
21
    Py_RETURN_NONE;
 
22
}
 
23
 
 
24
static PyMethodDef EmitMethods[] = {
 
25
    {"tracepoint", emit_tracepoint, METH_VARARGS, "Generate a tracepoint message."},
 
26
    {NULL, NULL, 0, NULL}        /* Sentinel */
 
27
};
 
28
 
 
29
 
 
30
PyMODINIT_FUNC
 
31
initemit(void)
 
32
{
 
33
    (void) Py_InitModule("emit", EmitMethods);
 
34
}