Tests: Fix abi conflict test when building with clang
[lttng-ust.git] / doc / examples / easy-ust / sample_component_provider.h
... / ...
CommitLineData
1/*
2 * SPDX-License-Identifier: MIT
3 *
4 * Copyright (C) 2011-2012 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
5 * Copyright (C) 2011-2012 Matthew Khouzam <matthew.khouzam@ericsson.com>
6 */
7
8/*
9 * Sample lttng-ust tracepoint provider.
10 */
11
12/*
13 * First part: defines
14 * We undef a macro before defining it as it can be used in several files.
15 */
16
17/*
18 * Must be included before include tracepoint provider
19 * ex.: project_event
20 * ex.: project_component_event
21 *
22 * Optional company name goes here
23 * ex.: com_efficios_project_component_event
24 *
25 * In this example, "sample" is the project, and "component" is the
26 * component.
27 */
28#undef LTTNG_UST_TRACEPOINT_PROVIDER
29#define LTTNG_UST_TRACEPOINT_PROVIDER sample_component
30
31/*
32 * include file (this files's name)
33 */
34#undef LTTNG_UST_TRACEPOINT_INCLUDE
35#define LTTNG_UST_TRACEPOINT_INCLUDE "./sample_component_provider.h"
36
37/*
38 * Add this precompiler conditionals to ensure the tracepoint event generation
39 * can include this file more than once.
40 */
41#if !defined(_SAMPLE_COMPONENT_PROVIDER_H) || defined(LTTNG_UST_TRACEPOINT_HEADER_MULTI_READ)
42#define _SAMPLE_COMPONENT_PROVIDER_H
43/*
44 * Add this to allow programs to call "tracepoint(...):
45 */
46#include <lttng/tracepoint.h>
47
48/*
49 * The following tracepoint event writes a message (c string) into the
50 * field message of the trace event message in the provider
51 * sample_component in other words:
52 *
53 * sample_component:message:message = text.
54 */
55LTTNG_UST_TRACEPOINT_EVENT(
56 /*
57 * provider name, not a variable but a string starting with a letter
58 * and containing either letters, numbers or underscores.
59 * Needs to be the same as LTTNG_UST_TRACEPOINT_PROVIDER
60 */
61 sample_component,
62 /*
63 * tracepoint name, same format as sample provider. Does not need to be
64 * declared before. in this case the name is "message"
65 */
66 message,
67 /*
68 * LTTNG_UST_TP_ARGS macro contains the arguments passed for the tracepoint
69 * it is in the following format
70 * LTTNG_UST_TP_ARGS( type1, name1, type2, name2, ... type10, name10)
71 * where there can be from zero to ten elements.
72 * typeN is the datatype, such as int, struct or double **.
73 * name is the variable name (in "int myInt" the name would be myint)
74 * LTTNG_UST_TP_ARGS() is valid to mean no arguments
75 * LTTNG_UST_TP_ARGS( void ) is valid too
76 */
77 LTTNG_UST_TP_ARGS(const char *, text),
78 /*
79 * LTTNG_UST_TP_FIELDS describes how to write the fields of the trace event.
80 * You can use the args here
81 */
82 LTTNG_UST_TP_FIELDS(
83 /*
84 * The lttng_ust_field_string macro takes a c string and writes it into a field
85 * named "message"
86 */
87 lttng_ust_field_string(message, text)
88 )
89)
90/*
91 * Trace loglevel, shows the level of the trace event. It can be
92 * LTTNG_UST_TRACEPOINT_LOGLEVEL_EMERG, LTTNG_UST_TRACEPOINT_LOGLEVEL_ALERT,
93 * LTTNG_UST_TRACEPOINT_LOGLEVEL_CRIT, LTTNG_UST_TRACEPOINT_LOGLEVEL_ERR,
94 * LTTNG_UST_TRACEPOINT_LOGLEVEL_WARNING, LTTNG_UST_TRACEPOINT_LOGLEVEL_INFO or
95 * others. If this is not set, LTTNG_UST_TRACEPOINT_LOGLEVEL_DEFAULT is
96 * assumed. The first two arguments identify the tracepoint See details in
97 * <lttng/tracepoint.h> line 347
98 */
99LTTNG_UST_TRACEPOINT_LOGLEVEL(
100 /*
101 * The provider name, must be the same as the provider name in the
102 * LTTNG_UST_TRACEPOINT_EVENT and as LTTNG_UST_TRACEPOINT_PROVIDER above.
103 */
104 sample_component,
105 /*
106 * The tracepoint name, must be the same as the tracepoint name in the
107 * LTTNG_UST_TRACEPOINT_EVENT
108 */
109 message,
110 /*
111 * The tracepoint loglevel. Warning, some levels are abbreviated and
112 * others are not, please see <lttng/tracepoint.h>
113 */
114 LTTNG_UST_TRACEPOINT_LOGLEVEL_WARNING)
115
116#endif /* _SAMPLE_COMPONENT_PROVIDER_H */
117
118/*
119 * Add this after defining the tracepoint events to expand the macros.
120 */
121#include <lttng/tracepoint-event.h>
This page took 0.025739 seconds and 5 git commands to generate.