samples/ftrace/sample-trace-array.h

Source file repositories/reference/linux-study-clean/samples/ftrace/sample-trace-array.h

File Facts

System
Linux kernel
Corpus path
samples/ftrace/sample-trace-array.h
Extension
.h
Size
2428 bytes
Lines
85
Domain
Support Tooling And Documentation
Bucket
samples
Inferred role
Support Tooling And Documentation: implementation source
Status
source implementation candidate

Why This File Exists

Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.

Dependency Surface

Detected Declarations

Annotated Snippet

#undef TRACE_SYSTEM
#define TRACE_SYSTEM sample-subsystem

/*
 * TRACE_SYSTEM is expected to be a C valid variable (alpha-numeric
 * and underscore), although it may start with numbers. If for some
 * reason it is not, you need to add the following lines:
 */
#undef TRACE_SYSTEM_VAR
#define TRACE_SYSTEM_VAR sample_subsystem

/*
 * But the above is only needed if TRACE_SYSTEM is not alpha-numeric
 * and underscored. By default, TRACE_SYSTEM_VAR will be equal to
 * TRACE_SYSTEM. As TRACE_SYSTEM_VAR must be alpha-numeric, if
 * TRACE_SYSTEM is not, then TRACE_SYSTEM_VAR must be defined with
 * only alpha-numeric and underscores.
 *
 * The TRACE_SYSTEM_VAR is only used internally and not visible to
 * user space.
 */

/*
 * Notice that this file is not protected like a normal header.
 * We also must allow for rereading of this file. The
 *
 *  || defined(TRACE_HEADER_MULTI_READ)
 *
 * serves this purpose.
 */
#if !defined(_SAMPLE_TRACE_ARRAY_H) || defined(TRACE_HEADER_MULTI_READ)
#define _SAMPLE_TRACE_ARRAY_H

#include <linux/tracepoint.h>
TRACE_EVENT(sample_event,

	TP_PROTO(int count, unsigned long time),

	TP_ARGS(count, time),

	TP_STRUCT__entry(
		__field(int, count)
		__field(unsigned long, time)
	),

	TP_fast_assign(
		__entry->count = count;
		__entry->time = time;
	),

	TP_printk("count value=%d at jiffies=%lu", __entry->count,
		__entry->time)
	);
#endif

#undef TRACE_INCLUDE_PATH
#define TRACE_INCLUDE_PATH .
#define TRACE_INCLUDE_FILE sample-trace-array
#include <trace/define_trace.h>

Annotation

Implementation Notes