Cleanup: move scripts to subdirectory
[lttng-modules.git] / instrumentation / events / lttng-module / module.h
... / ...
CommitLineData
1/*
2 * Because linux/module.h has tracepoints in the header, and ftrace.h
3 * eventually includes this file, define_trace.h includes linux/module.h
4 * But we do not want the module.h to override the TRACE_SYSTEM macro
5 * variable that define_trace.h is processing, so we only set it
6 * when module events are being processed, which would happen when
7 * CREATE_TRACE_POINTS is defined.
8 */
9#ifdef CREATE_TRACE_POINTS
10#undef TRACE_SYSTEM
11#define TRACE_SYSTEM module
12#endif
13
14#if !defined(LTTNG_TRACE_MODULE_H) || defined(TRACE_HEADER_MULTI_READ)
15#define LTTNG_TRACE_MODULE_H
16
17#include <probes/lttng-tracepoint-event.h>
18#include <linux/version.h>
19
20#ifdef CONFIG_MODULES
21
22#ifndef _TRACE_MODULE_DEF
23#define _TRACE_MODULE_DEF
24struct module;
25
26#endif
27
28LTTNG_TRACEPOINT_EVENT(module_load,
29
30 TP_PROTO(struct module *mod),
31
32 TP_ARGS(mod),
33
34 TP_FIELDS(
35 ctf_integer(unsigned int, taints, mod->taints)
36 ctf_string(name, mod->name)
37 )
38)
39
40LTTNG_TRACEPOINT_EVENT(module_free,
41
42 TP_PROTO(struct module *mod),
43
44 TP_ARGS(mod),
45
46 TP_FIELDS(
47 ctf_string(name, mod->name)
48 )
49)
50
51#ifdef CONFIG_MODULE_UNLOAD
52/* trace_module_get/put are only used if CONFIG_MODULE_UNLOAD is defined */
53
54LTTNG_TRACEPOINT_EVENT_CLASS(module_refcnt,
55
56#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
57 TP_PROTO(struct module *mod, unsigned long ip),
58
59 TP_ARGS(mod, ip),
60#else
61 TP_PROTO(struct module *mod, unsigned long ip, int refcnt),
62
63 TP_ARGS(mod, ip, refcnt),
64#endif
65
66 TP_FIELDS(
67 ctf_integer(unsigned long, ip, ip)
68#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,19,0))
69 ctf_integer(int, refcnt, atomic_read(&mod->refcnt))
70#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
71 ctf_integer(int, refcnt, __this_cpu_read(mod->refptr->incs) + __this_cpu_read(mod->refptr->decs))
72#else
73 ctf_integer(int, refcnt, refcnt)
74#endif
75 ctf_string(name, mod->name)
76 )
77)
78
79LTTNG_TRACEPOINT_EVENT_INSTANCE(module_refcnt, module_get,
80
81#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
82 TP_PROTO(struct module *mod, unsigned long ip),
83
84 TP_ARGS(mod, ip)
85#else
86 TP_PROTO(struct module *mod, unsigned long ip, int refcnt),
87
88 TP_ARGS(mod, ip, refcnt)
89#endif
90)
91
92LTTNG_TRACEPOINT_EVENT_INSTANCE(module_refcnt, module_put,
93
94#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
95 TP_PROTO(struct module *mod, unsigned long ip),
96
97 TP_ARGS(mod, ip)
98#else
99 TP_PROTO(struct module *mod, unsigned long ip, int refcnt),
100
101 TP_ARGS(mod, ip, refcnt)
102#endif
103)
104#endif /* CONFIG_MODULE_UNLOAD */
105
106LTTNG_TRACEPOINT_EVENT(module_request,
107
108 TP_PROTO(char *name, bool wait, unsigned long ip),
109
110 TP_ARGS(name, wait, ip),
111
112 TP_FIELDS(
113 ctf_integer(unsigned long, ip, ip)
114 ctf_integer(bool, wait, wait)
115 ctf_string(name, name)
116 )
117)
118
119#endif /* CONFIG_MODULES */
120
121#endif /* LTTNG_TRACE_MODULE_H */
122
123/* This part must be outside protection */
124#include <probes/define_trace.h>
This page took 0.022881 seconds and 4 git commands to generate.