Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 
0003 /*
0004  * If TRACE_SYSTEM is defined, that will be the directory created
0005  * in the ftrace directory under /sys/kernel/tracing/events/<system>
0006  *
0007  * The define_trace.h below will also look for a file name of
0008  * TRACE_SYSTEM.h where TRACE_SYSTEM is what is defined here.
0009  * In this case, it would look for sample-trace.h
0010  *
0011  * If the header name will be different than the system name
0012  * (as in this case), then you can override the header name that
0013  * define_trace.h will look up by defining TRACE_INCLUDE_FILE
0014  *
0015  * This file is called sample-trace-array.h but we want the system
0016  * to be called "sample-subsystem". Therefore we must define the name of this
0017  * file:
0018  *
0019  * #define TRACE_INCLUDE_FILE sample-trace-array
0020  *
0021  * As we do in the bottom of this file.
0022  *
0023  * Notice that TRACE_SYSTEM should be defined outside of #if
0024  * protection, just like TRACE_INCLUDE_FILE.
0025  */
0026 #undef TRACE_SYSTEM
0027 #define TRACE_SYSTEM sample-subsystem
0028 
0029 /*
0030  * TRACE_SYSTEM is expected to be a C valid variable (alpha-numeric
0031  * and underscore), although it may start with numbers. If for some
0032  * reason it is not, you need to add the following lines:
0033  */
0034 #undef TRACE_SYSTEM_VAR
0035 #define TRACE_SYSTEM_VAR sample_subsystem
0036 
0037 /*
0038  * But the above is only needed if TRACE_SYSTEM is not alpha-numeric
0039  * and underscored. By default, TRACE_SYSTEM_VAR will be equal to
0040  * TRACE_SYSTEM. As TRACE_SYSTEM_VAR must be alpha-numeric, if
0041  * TRACE_SYSTEM is not, then TRACE_SYSTEM_VAR must be defined with
0042  * only alpha-numeric and underscores.
0043  *
0044  * The TRACE_SYSTEM_VAR is only used internally and not visible to
0045  * user space.
0046  */
0047 
0048 /*
0049  * Notice that this file is not protected like a normal header.
0050  * We also must allow for rereading of this file. The
0051  *
0052  *  || defined(TRACE_HEADER_MULTI_READ)
0053  *
0054  * serves this purpose.
0055  */
0056 #if !defined(_SAMPLE_TRACE_ARRAY_H) || defined(TRACE_HEADER_MULTI_READ)
0057 #define _SAMPLE_TRACE_ARRAY_H
0058 
0059 #include <linux/tracepoint.h>
0060 TRACE_EVENT(sample_event,
0061 
0062     TP_PROTO(int count, unsigned long time),
0063 
0064     TP_ARGS(count, time),
0065 
0066     TP_STRUCT__entry(
0067         __field(int, count)
0068         __field(unsigned long, time)
0069     ),
0070 
0071     TP_fast_assign(
0072         __entry->count = count;
0073         __entry->time = time;
0074     ),
0075 
0076     TP_printk("count value=%d at jiffies=%lu", __entry->count,
0077         __entry->time)
0078     );
0079 #endif
0080 
0081 #undef TRACE_INCLUDE_PATH
0082 #define TRACE_INCLUDE_PATH .
0083 #define TRACE_INCLUDE_FILE sample-trace-array
0084 #include <trace/define_trace.h>