Path: blob/master/include/trace/define_remote_events.h
170838 views
/* SPDX-License-Identifier: GPL-2.0 */12#include <linux/trace_events.h>3#include <linux/trace_remote_event.h>4#include <linux/trace_seq.h>5#include <linux/stringify.h>67#define REMOTE_EVENT_INCLUDE(__file) __stringify(../../__file)89#ifdef REMOTE_EVENT_SECTION10# define __REMOTE_EVENT_SECTION(__name) __used __section(REMOTE_EVENT_SECTION"."#__name)11#else12# define __REMOTE_EVENT_SECTION(__name)13#endif1415#define REMOTE_PRINTK_COUNT_ARGS(__args...) \16__COUNT_ARGS(, ##__args, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 0)1718#define __remote_printk0() \19trace_seq_putc(seq, '\n')2021#define __remote_printk1(__fmt) \22trace_seq_puts(seq, " " __fmt "\n") \2324#define __remote_printk2(__fmt, __args...) \25do { \26trace_seq_putc(seq, ' '); \27trace_seq_printf(seq, __fmt, __args); \28trace_seq_putc(seq, '\n'); \29} while (0)3031/* Apply the appropriate trace_seq sequence according to the number of arguments */32#define remote_printk(__args...) \33CONCATENATE(__remote_printk, REMOTE_PRINTK_COUNT_ARGS(__args))(__args)3435#define RE_PRINTK(__args...) __args3637#define REMOTE_EVENT(__name, __id, __struct, __printk) \38REMOTE_EVENT_FORMAT(__name, __struct); \39static void remote_event_print_##__name(void *evt, struct trace_seq *seq) \40{ \41struct remote_event_format_##__name __maybe_unused *__entry = evt; \42trace_seq_puts(seq, #__name); \43remote_printk(__printk); \44}45#include REMOTE_EVENT_INCLUDE(REMOTE_EVENT_INCLUDE_FILE)4647#undef REMOTE_EVENT48#undef RE_PRINTK49#undef re_field50#define re_field(__type, __field) \51{ \52.type = #__type, .name = #__field, \53.size = sizeof(__type), .align = __alignof__(__type), \54.is_signed = is_signed_type(__type), \55},56#define __entry REC57#define RE_PRINTK(__fmt, __args...) "\"" __fmt "\", " __stringify(__args)58#define REMOTE_EVENT(__name, __id, __struct, __printk) \59static struct trace_event_fields remote_event_fields_##__name[] = { \60__struct \61{} \62}; \63static char remote_event_print_fmt_##__name[] = __printk; \64static struct remote_event __REMOTE_EVENT_SECTION(__name) \65remote_event_##__name = { \66.name = #__name, \67.id = __id, \68.fields = remote_event_fields_##__name, \69.print_fmt = remote_event_print_fmt_##__name, \70.print = remote_event_print_##__name, \71}72#include REMOTE_EVENT_INCLUDE(REMOTE_EVENT_INCLUDE_FILE)737475