diff options
author | Steven Rostedt (Red Hat) <rostedt@goodmis.org> | 2015-03-27 16:48:57 -0400 |
---|---|---|
committer | Steven Rostedt <rostedt@goodmis.org> | 2015-04-08 09:40:01 -0400 |
commit | 190f0b76ca498789b4dc6acb8c8e9a31b6548f9d (patch) | |
tree | c3c7be3f8715e8dc6a9b003e3bbd47b7c9272f0b /include/trace | |
parent | f0a91b3caa053c9964f1d1e6941f0963d002a670 (diff) |
mm: tracing: Export enums in tracepoints to user space
The enums used in tracepoints with __print_symbolic() have their
names shown in the tracepoint format files and not their values.
This makes it difficult for user space tools to convert the binary
data to the strings as user space does not know what those enums
are about.
By having them use TRACE_DEFINE_ENUM(), the names of the enums will
be mapped to the values and shown to user space.
Link: http://lkml.kernel.org/r/20150403013802.220157513@goodmis.org
Reviewed-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Tested-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Diffstat (limited to 'include/trace')
-rw-r--r-- | include/trace/events/migrate.h | 42 |
1 files changed, 32 insertions, 10 deletions
diff --git a/include/trace/events/migrate.h b/include/trace/events/migrate.h index dd2b5467d905..539b25a76111 100644 --- a/include/trace/events/migrate.h +++ b/include/trace/events/migrate.h | |||
@@ -7,18 +7,40 @@ | |||
7 | #include <linux/tracepoint.h> | 7 | #include <linux/tracepoint.h> |
8 | 8 | ||
9 | #define MIGRATE_MODE \ | 9 | #define MIGRATE_MODE \ |
10 | {MIGRATE_ASYNC, "MIGRATE_ASYNC"}, \ | 10 | EM( MIGRATE_ASYNC, "MIGRATE_ASYNC") \ |
11 | {MIGRATE_SYNC_LIGHT, "MIGRATE_SYNC_LIGHT"}, \ | 11 | EM( MIGRATE_SYNC_LIGHT, "MIGRATE_SYNC_LIGHT") \ |
12 | {MIGRATE_SYNC, "MIGRATE_SYNC"} | 12 | EMe(MIGRATE_SYNC, "MIGRATE_SYNC") |
13 | |||
13 | 14 | ||
14 | #define MIGRATE_REASON \ | 15 | #define MIGRATE_REASON \ |
15 | {MR_COMPACTION, "compaction"}, \ | 16 | EM( MR_COMPACTION, "compaction") \ |
16 | {MR_MEMORY_FAILURE, "memory_failure"}, \ | 17 | EM( MR_MEMORY_FAILURE, "memory_failure") \ |
17 | {MR_MEMORY_HOTPLUG, "memory_hotplug"}, \ | 18 | EM( MR_MEMORY_HOTPLUG, "memory_hotplug") \ |
18 | {MR_SYSCALL, "syscall_or_cpuset"}, \ | 19 | EM( MR_SYSCALL, "syscall_or_cpuset") \ |
19 | {MR_MEMPOLICY_MBIND, "mempolicy_mbind"}, \ | 20 | EM( MR_MEMPOLICY_MBIND, "mempolicy_mbind") \ |
20 | {MR_NUMA_MISPLACED, "numa_misplaced"}, \ | 21 | EM( MR_NUMA_MISPLACED, "numa_misplaced") \ |
21 | {MR_CMA, "cma"} | 22 | EMe(MR_CMA, "cma") |
23 | |||
24 | /* | ||
25 | * First define the enums in the above macros to be exported to userspace | ||
26 | * via TRACE_DEFINE_ENUM(). | ||
27 | */ | ||
28 | #undef EM | ||
29 | #undef EMe | ||
30 | #define EM(a, b) TRACE_DEFINE_ENUM(a); | ||
31 | #define EMe(a, b) TRACE_DEFINE_ENUM(a); | ||
32 | |||
33 | MIGRATE_MODE | ||
34 | MIGRATE_REASON | ||
35 | |||
36 | /* | ||
37 | * Now redefine the EM() and EMe() macros to map the enums to the strings | ||
38 | * that will be printed in the output. | ||
39 | */ | ||
40 | #undef EM | ||
41 | #undef EMe | ||
42 | #define EM(a, b) {a, b}, | ||
43 | #define EMe(a, b) {a, b} | ||
22 | 44 | ||
23 | TRACE_EVENT(mm_migrate_pages, | 45 | TRACE_EVENT(mm_migrate_pages, |
24 | 46 | ||