Tracepoint and TRACEPOINT_EVENT API cleanup
[ust.git] / tests / hello / tp.c
CommitLineData
81614639
MD
1/*
2 * Copyright (C) 2009 Pierre-Marc Fournier
3 * Copyright (C) 2011 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
a09dac63
PMF
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
93d0f2ea 20#include <ust/marker.h>
6e71f8c9
PMF
21#include "usterr.h"
22
81614639
MD
23#define TRACEPOINT_CREATE_PROBES
24#include "tp.h"
25
a5f09c2c
NC
26struct hello_trace_struct {
27 char *message;
28};
29
30struct hello_trace_struct hello_struct = {
31 .message = "ehlo\n",
32};
33
a5f09c2c 34void tptest_probe(void *data, int anint)
6e71f8c9 35{
a5f09c2c 36 struct hello_trace_struct *hello;
81614639 37 hello = (struct hello_trace_struct *)data;
6e71f8c9 38 DBG("in tracepoint probe...");
a5f09c2c 39 printf("this is the message: %s\n", hello->message);
6e71f8c9
PMF
40}
41
ad5c7b82
MD
42void tptest2_probe(void *data)
43{
44}
45
6e71f8c9
PMF
46static void __attribute__((constructor)) init()
47{
a5f09c2c 48 DBG("connecting tracepoint...\n");
81614639
MD
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);
6e71f8c9 55}
This page took 0.037043 seconds and 4 git commands to generate.