Tracepoint and TRACEPOINT_EVENT API cleanup
[ust.git] / tests / hello / tp.c
... / ...
CommitLineData
1/*
2 * Copyright (C) 2009 Pierre-Marc Fournier
3 * Copyright (C) 2011 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 */
19
20#include <ust/marker.h>
21#include "usterr.h"
22
23#define TRACEPOINT_CREATE_PROBES
24#include "tp.h"
25
26struct hello_trace_struct {
27 char *message;
28};
29
30struct hello_trace_struct hello_struct = {
31 .message = "ehlo\n",
32};
33
34void tptest_probe(void *data, int anint)
35{
36 struct hello_trace_struct *hello;
37 hello = (struct hello_trace_struct *)data;
38 DBG("in tracepoint probe...");
39 printf("this is the message: %s\n", hello->message);
40}
41
42void tptest2_probe(void *data)
43{
44}
45
46static void __attribute__((constructor)) init()
47{
48 DBG("connecting tracepoint...\n");
49 /*
50 * Note: this is an internal API that will be used within
51 * TRACEPOINT_EVENT only eventually.
52 */
53 __register_tracepoint(hello_tptest, tptest_probe, &hello_struct);
54 __register_tracepoint(hello_tptest2, tptest2_probe, &hello_struct);
55}
This page took 0.021883 seconds and 4 git commands to generate.