Migrate tracepoint instrumentation to TP_FIELDS
[lttng-modules.git] / instrumentation / events / lttng-module / compaction.h
1 #undef TRACE_SYSTEM
2 #define TRACE_SYSTEM compaction
3
4 #if !defined(LTTNG_TRACE_COMPACTION_H) || defined(TRACE_HEADER_MULTI_READ)
5 #define LTTNG_TRACE_COMPACTION_H
6
7 #include "../../../probes/lttng-tracepoint-event.h"
8 #include <linux/types.h>
9 #include <linux/version.h>
10 #include <trace/events/gfpflags.h>
11
12 #if LINUX_VERSION_CODE >= KERNEL_VERSION(4,0,0)
13
14 LTTNG_TRACEPOINT_EVENT_CLASS(compaction_isolate_template,
15
16 TP_PROTO(unsigned long start_pfn,
17 unsigned long end_pfn,
18 unsigned long nr_scanned,
19 unsigned long nr_taken),
20
21 TP_ARGS(start_pfn, end_pfn, nr_scanned, nr_taken),
22
23 TP_FIELDS(
24 ctf_integer(unsigned long, start_pfn, start_pfn)
25 ctf_integer(unsigned long, end_pfn, end_pfn)
26 ctf_integer(unsigned long, nr_scanned, nr_scanned)
27 ctf_integer(unsigned long, nr_taken, nr_taken)
28 )
29 )
30
31 LTTNG_TRACEPOINT_EVENT_INSTANCE(compaction_isolate_template, mm_compaction_isolate_migratepages,
32
33 TP_PROTO(unsigned long start_pfn,
34 unsigned long end_pfn,
35 unsigned long nr_scanned,
36 unsigned long nr_taken),
37
38 TP_ARGS(start_pfn, end_pfn, nr_scanned, nr_taken)
39 )
40
41 LTTNG_TRACEPOINT_EVENT_INSTANCE(compaction_isolate_template, mm_compaction_isolate_freepages,
42
43 TP_PROTO(unsigned long start_pfn,
44 unsigned long end_pfn,
45 unsigned long nr_scanned,
46 unsigned long nr_taken),
47
48 TP_ARGS(start_pfn, end_pfn, nr_scanned, nr_taken)
49 )
50
51 #else /* #if LINUX_VERSION_CODE >= KERNEL_VERSION(4,0,0) */
52
53 LTTNG_TRACEPOINT_EVENT_CLASS(compaction_isolate_template,
54
55 TP_PROTO(unsigned long nr_scanned,
56 unsigned long nr_taken),
57
58 TP_ARGS(nr_scanned, nr_taken),
59
60 TP_FIELDS(
61 ctf_integer(unsigned long, nr_scanned, nr_scanned)
62 ctf_integer(unsigned long, nr_taken, nr_taken)
63 )
64 )
65
66 LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(compaction_isolate_template,
67
68 mm_compaction_isolate_migratepages,
69
70 compaction_isolate_migratepages,
71
72 TP_PROTO(unsigned long nr_scanned,
73 unsigned long nr_taken),
74
75 TP_ARGS(nr_scanned, nr_taken)
76 )
77
78 LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(compaction_isolate_template,
79
80 mm_compaction_isolate_freepages,
81
82 compaction_isolate_freepages,
83
84 TP_PROTO(unsigned long nr_scanned,
85 unsigned long nr_taken),
86
87 TP_ARGS(nr_scanned, nr_taken)
88 )
89
90 #endif /* #else #if LINUX_VERSION_CODE >= KERNEL_VERSION(4,0,0) */
91
92 #if LTTNG_KERNEL_RANGE(3,12,30, 3,13,0) || \
93 LTTNG_KERNEL_RANGE(3,14,25, 3,15,0) || \
94 (LINUX_VERSION_CODE >= KERNEL_VERSION(3,16,0))
95 LTTNG_TRACEPOINT_EVENT_CODE_MAP(mm_compaction_migratepages,
96
97 compaction_migratepages,
98
99 TP_PROTO(unsigned long nr_all,
100 int migrate_rc,
101 struct list_head *migratepages),
102
103 TP_ARGS(nr_all, migrate_rc, migratepages),
104
105 TP_locvar(
106 unsigned long nr_failed;
107 ),
108
109 TP_code(
110 tp_locvar->nr_failed = 0;
111
112 {
113 struct list_head *page_lru;
114
115 if (migrate_rc >= 0)
116 tp_locvar->nr_failed = migrate_rc;
117 else
118 list_for_each(page_lru, migratepages)
119 tp_locvar->nr_failed++;
120 }
121 ),
122
123 TP_FIELDS(
124 ctf_integer(unsigned long, nr_migrated, nr_all - tp_locvar->nr_failed)
125 ctf_integer(unsigned long, nr_failed, tp_locvar->nr_failed)
126 )
127 )
128 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,16,0)) */
129 LTTNG_TRACEPOINT_EVENT_MAP(mm_compaction_migratepages,
130
131 compaction_migratepages,
132
133 TP_PROTO(unsigned long nr_migrated,
134 unsigned long nr_failed),
135
136 TP_ARGS(nr_migrated, nr_failed),
137
138 TP_FIELDS(
139 ctf_integer(unsigned long, nr_migrated, nr_migrated)
140 ctf_integer(unsigned long, nr_failed, nr_failed)
141 )
142 )
143 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,16,0)) */
144
145 #endif /* LTTNG_TRACE_COMPACTION_H */
146
147 /* This part must be outside protection */
148 #include "../../../probes/define_trace.h"
This page took 0.032037 seconds and 4 git commands to generate.