brintos

brintos / linux-shallow public Read only

0
0
Text · 2.4 KiB · 6f89624 Raw
85 lines · c
1/* SPDX-License-Identifier: GPL-2.0 */2 3/*4 * If TRACE_SYSTEM is defined, that will be the directory created5 * in the ftrace directory under /sys/kernel/tracing/events/<system>6 *7 * The define_trace.h below will also look for a file name of8 * TRACE_SYSTEM.h where TRACE_SYSTEM is what is defined here.9 * In this case, it would look for sample-trace.h10 *11 * If the header name will be different than the system name12 * (as in this case), then you can override the header name that13 * define_trace.h will look up by defining TRACE_INCLUDE_FILE14 *15 * This file is called sample-trace-array.h but we want the system16 * to be called "sample-subsystem". Therefore we must define the name of this17 * file:18 *19 * #define TRACE_INCLUDE_FILE sample-trace-array20 *21 * As we do in the bottom of this file.22 *23 * Notice that TRACE_SYSTEM should be defined outside of #if24 * protection, just like TRACE_INCLUDE_FILE.25 */26#undef TRACE_SYSTEM27#define TRACE_SYSTEM sample-subsystem28 29/*30 * TRACE_SYSTEM is expected to be a C valid variable (alpha-numeric31 * and underscore), although it may start with numbers. If for some32 * reason it is not, you need to add the following lines:33 */34#undef TRACE_SYSTEM_VAR35#define TRACE_SYSTEM_VAR sample_subsystem36 37/*38 * But the above is only needed if TRACE_SYSTEM is not alpha-numeric39 * and underscored. By default, TRACE_SYSTEM_VAR will be equal to40 * TRACE_SYSTEM. As TRACE_SYSTEM_VAR must be alpha-numeric, if41 * TRACE_SYSTEM is not, then TRACE_SYSTEM_VAR must be defined with42 * only alpha-numeric and underscores.43 *44 * The TRACE_SYSTEM_VAR is only used internally and not visible to45 * user space.46 */47 48/*49 * Notice that this file is not protected like a normal header.50 * We also must allow for rereading of this file. The51 *52 *  || defined(TRACE_HEADER_MULTI_READ)53 *54 * serves this purpose.55 */56#if !defined(_SAMPLE_TRACE_ARRAY_H) || defined(TRACE_HEADER_MULTI_READ)57#define _SAMPLE_TRACE_ARRAY_H58 59#include <linux/tracepoint.h>60TRACE_EVENT(sample_event,61 62	TP_PROTO(int count, unsigned long time),63 64	TP_ARGS(count, time),65 66	TP_STRUCT__entry(67		__field(int, count)68		__field(unsigned long, time)69	),70 71	TP_fast_assign(72		__entry->count = count;73		__entry->time = time;74	),75 76	TP_printk("count value=%d at jiffies=%lu", __entry->count,77		__entry->time)78	);79#endif80 81#undef TRACE_INCLUDE_PATH82#define TRACE_INCLUDE_PATH .83#define TRACE_INCLUDE_FILE sample-trace-array84#include <trace/define_trace.h>85