Migrate tracepoint instrumentation to TP_FIELDS
[lttng-modules.git] / instrumentation / events / lttng-module / compaction.h
CommitLineData
b87700e3
AG
1#undef TRACE_SYSTEM
2#define TRACE_SYSTEM compaction
3
3bc29f0a
MD
4#if !defined(LTTNG_TRACE_COMPACTION_H) || defined(TRACE_HEADER_MULTI_READ)
5#define LTTNG_TRACE_COMPACTION_H
b87700e3 6
3bc29f0a 7#include "../../../probes/lttng-tracepoint-event.h"
b87700e3 8#include <linux/types.h>
00073447 9#include <linux/version.h>
b87700e3
AG
10#include <trace/events/gfpflags.h>
11
a57f014e
MD
12#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,0,0)
13
9bbf98da 14LTTNG_TRACEPOINT_EVENT_CLASS(compaction_isolate_template,
a57f014e
MD
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
f127e61e
MD
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 )
a57f014e
MD
29)
30
9bbf98da 31LTTNG_TRACEPOINT_EVENT_INSTANCE(compaction_isolate_template, mm_compaction_isolate_migratepages,
a57f014e
MD
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
9bbf98da 41LTTNG_TRACEPOINT_EVENT_INSTANCE(compaction_isolate_template, mm_compaction_isolate_freepages,
a57f014e
MD
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
9bbf98da 53LTTNG_TRACEPOINT_EVENT_CLASS(compaction_isolate_template,
b87700e3
AG
54
55 TP_PROTO(unsigned long nr_scanned,
56 unsigned long nr_taken),
57
58 TP_ARGS(nr_scanned, nr_taken),
59
f127e61e
MD
60 TP_FIELDS(
61 ctf_integer(unsigned long, nr_scanned, nr_scanned)
62 ctf_integer(unsigned long, nr_taken, nr_taken)
63 )
b87700e3
AG
64)
65
9bbf98da
MD
66LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(compaction_isolate_template,
67
68 mm_compaction_isolate_migratepages,
69
70 compaction_isolate_migratepages,
b87700e3
AG
71
72 TP_PROTO(unsigned long nr_scanned,
73 unsigned long nr_taken),
74
75 TP_ARGS(nr_scanned, nr_taken)
76)
77
9bbf98da
MD
78LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(compaction_isolate_template,
79
80 mm_compaction_isolate_freepages,
81
82 compaction_isolate_freepages,
83
b87700e3
AG
84 TP_PROTO(unsigned long nr_scanned,
85 unsigned long nr_taken),
86
87 TP_ARGS(nr_scanned, nr_taken)
88)
89
a57f014e
MD
90#endif /* #else #if LINUX_VERSION_CODE >= KERNEL_VERSION(4,0,0) */
91
24ce932c
DE
92#if LTTNG_KERNEL_RANGE(3,12,30, 3,13,0) || \
93 LTTNG_KERNEL_RANGE(3,14,25, 3,15,0) || \
290d1667 94 (LINUX_VERSION_CODE >= KERNEL_VERSION(3,16,0))
f127e61e 95LTTNG_TRACEPOINT_EVENT_CODE_MAP(mm_compaction_migratepages,
9bbf98da
MD
96
97 compaction_migratepages,
00073447
MD
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
f127e61e
MD
105 TP_locvar(
106 unsigned long nr_failed;
00073447
MD
107 ),
108
f127e61e
MD
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 }
00073447
MD
121 ),
122
f127e61e
MD
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 )
00073447
MD
127)
128#else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,16,0)) */
9bbf98da
MD
129LTTNG_TRACEPOINT_EVENT_MAP(mm_compaction_migratepages,
130
131 compaction_migratepages,
b87700e3
AG
132
133 TP_PROTO(unsigned long nr_migrated,
134 unsigned long nr_failed),
135
136 TP_ARGS(nr_migrated, nr_failed),
137
f127e61e
MD
138 TP_FIELDS(
139 ctf_integer(unsigned long, nr_migrated, nr_migrated)
140 ctf_integer(unsigned long, nr_failed, nr_failed)
141 )
b87700e3 142)
00073447 143#endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,16,0)) */
b87700e3 144
3bc29f0a 145#endif /* LTTNG_TRACE_COMPACTION_H */
b87700e3
AG
146
147/* This part must be outside protection */
148#include "../../../probes/define_trace.h"
This page took 0.031193 seconds and 4 git commands to generate.