~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/include/trace/perf.h

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /* SPDX-License-Identifier: GPL-2.0 */
  2 
  3 #undef TRACE_SYSTEM_VAR
  4 
  5 #ifdef CONFIG_PERF_EVENTS
  6 
  7 #include "stages/stage6_event_callback.h"
  8 
  9 #undef __perf_count
 10 #define __perf_count(c) (__count = (c))
 11 
 12 #undef __perf_task
 13 #define __perf_task(t)  (__task = (t))
 14 
 15 #undef DECLARE_EVENT_CLASS
 16 #define DECLARE_EVENT_CLASS(call, proto, args, tstruct, assign, print)  \
 17 static notrace void                                                     \
 18 perf_trace_##call(void *__data, proto)                                  \
 19 {                                                                       \
 20         struct trace_event_call *event_call = __data;                   \
 21         struct trace_event_data_offsets_##call __maybe_unused __data_offsets;\
 22         struct trace_event_raw_##call *entry;                           \
 23         struct pt_regs *__regs;                                         \
 24         u64 __count = 1;                                                \
 25         struct task_struct *__task = NULL;                              \
 26         struct hlist_head *head;                                        \
 27         int __entry_size;                                               \
 28         int __data_size;                                                \
 29         int rctx;                                                       \
 30                                                                         \
 31         __data_size = trace_event_get_offsets_##call(&__data_offsets, args); \
 32                                                                         \
 33         head = this_cpu_ptr(event_call->perf_events);                   \
 34         if (!bpf_prog_array_valid(event_call) &&                        \
 35             __builtin_constant_p(!__task) && !__task &&                 \
 36             hlist_empty(head))                                          \
 37                 return;                                                 \
 38                                                                         \
 39         __entry_size = ALIGN(__data_size + sizeof(*entry) + sizeof(u32),\
 40                              sizeof(u64));                              \
 41         __entry_size -= sizeof(u32);                                    \
 42                                                                         \
 43         entry = perf_trace_buf_alloc(__entry_size, &__regs, &rctx);     \
 44         if (!entry)                                                     \
 45                 return;                                                 \
 46                                                                         \
 47         perf_fetch_caller_regs(__regs);                                 \
 48                                                                         \
 49         tstruct                                                         \
 50                                                                         \
 51         { assign; }                                                     \
 52                                                                         \
 53         perf_trace_run_bpf_submit(entry, __entry_size, rctx,            \
 54                                   event_call, __count, __regs,          \
 55                                   head, __task);                        \
 56 }
 57 
 58 /*
 59  * This part is compiled out, it is only here as a build time check
 60  * to make sure that if the tracepoint handling changes, the
 61  * perf probe will fail to compile unless it too is updated.
 62  */
 63 #undef DEFINE_EVENT
 64 #define DEFINE_EVENT(template, call, proto, args)                       \
 65 static inline void perf_test_probe_##call(void)                         \
 66 {                                                                       \
 67         check_trace_callback_type_##call(perf_trace_##template);        \
 68 }
 69 
 70 
 71 #undef DEFINE_EVENT_PRINT
 72 #define DEFINE_EVENT_PRINT(template, name, proto, args, print)  \
 73         DEFINE_EVENT(template, name, PARAMS(proto), PARAMS(args))
 74 
 75 #include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
 76 #endif /* CONFIG_PERF_EVENTS */
 77 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php