1 /* SPDX-License-Identifier: GPL-2.0 */
4 * If TRACE_SYSTEM is defined, that will be the directory created
5 * in the ftrace directory under /sys/kernel/tracing/events/<system>
7 * The define_trace.h below will also look for a file name of
8 * TRACE_SYSTEM.h where TRACE_SYSTEM is what is defined here.
9 * In this case, it would look for sample-trace.h
11 * If the header name will be different than the system name
12 * (as in this case), then you can override the header name that
13 * define_trace.h will look up by defining TRACE_INCLUDE_FILE
15 * This file is called sample-trace-array.h but we want the system
16 * to be called "sample-subsystem". Therefore we must define the name of this
19 * #define TRACE_INCLUDE_FILE sample-trace-array
21 * As we do in the bottom of this file.
23 * Notice that TRACE_SYSTEM should be defined outside of #if
24 * protection, just like TRACE_INCLUDE_FILE.
27 #define TRACE_SYSTEM sample-subsystem
30 * TRACE_SYSTEM is expected to be a C valid variable (alpha-numeric
31 * and underscore), although it may start with numbers. If for some
32 * reason it is not, you need to add the following lines:
34 #undef TRACE_SYSTEM_VAR
35 #define TRACE_SYSTEM_VAR sample_subsystem
38 * But the above is only needed if TRACE_SYSTEM is not alpha-numeric
39 * and underscored. By default, TRACE_SYSTEM_VAR will be equal to
40 * TRACE_SYSTEM. As TRACE_SYSTEM_VAR must be alpha-numeric, if
41 * TRACE_SYSTEM is not, then TRACE_SYSTEM_VAR must be defined with
42 * only alpha-numeric and underscores.
44 * The TRACE_SYSTEM_VAR is only used internally and not visible to
49 * Notice that this file is not protected like a normal header.
50 * We also must allow for rereading of this file. The
52 * || defined(TRACE_HEADER_MULTI_READ)
54 * serves this purpose.
56 #if !defined(_SAMPLE_TRACE_ARRAY_H) || defined(TRACE_HEADER_MULTI_READ)
57 #define _SAMPLE_TRACE_ARRAY_H
59 #include <linux/tracepoint.h>
60 TRACE_EVENT(sample_event,
62 TP_PROTO(int count, unsigned long time),
68 __field(unsigned long, time)
72 __entry->count = count;
76 TP_printk("count value=%d at jiffies=%lu", __entry->count,
81 #undef TRACE_INCLUDE_PATH
82 #define TRACE_INCLUDE_PATH .
83 #define TRACE_INCLUDE_FILE sample-trace-array
84 #include <trace/define_trace.h>