From: Steven Rostedt <rostedt@goodmis.org>
To: linux-kernel@vger.kernel.org
Cc: Ingo Molnar <mingo@kernel.org>,
Andrew Morton <akpm@linux-foundation.org>,
Arnaldo Carvalho de Melo <acme@kernel.org>,
Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Subject: [for-next][PATCH 17/21] mm: tracing: Export enums in tracepoints to user space
Date: Wed, 08 Apr 2015 09:48:21 -0400 [thread overview]
Message-ID: <20150408134927.249476737@goodmis.org> (raw)
In-Reply-To: 20150408134804.225653449@goodmis.org
[-- Attachment #1: 0017-mm-tracing-Export-enums-in-tracepoints-to-user-space.patch --]
[-- Type: text/plain, Size: 2455 bytes --]
From: "Steven Rostedt (Red Hat)" <rostedt@goodmis.org>
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>
---
include/trace/events/migrate.h | 42 ++++++++++++++++++++++++++++++++----------
1 file 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 @@
#include <linux/tracepoint.h>
#define MIGRATE_MODE \
- {MIGRATE_ASYNC, "MIGRATE_ASYNC"}, \
- {MIGRATE_SYNC_LIGHT, "MIGRATE_SYNC_LIGHT"}, \
- {MIGRATE_SYNC, "MIGRATE_SYNC"}
+ EM( MIGRATE_ASYNC, "MIGRATE_ASYNC") \
+ EM( MIGRATE_SYNC_LIGHT, "MIGRATE_SYNC_LIGHT") \
+ EMe(MIGRATE_SYNC, "MIGRATE_SYNC")
+
#define MIGRATE_REASON \
- {MR_COMPACTION, "compaction"}, \
- {MR_MEMORY_FAILURE, "memory_failure"}, \
- {MR_MEMORY_HOTPLUG, "memory_hotplug"}, \
- {MR_SYSCALL, "syscall_or_cpuset"}, \
- {MR_MEMPOLICY_MBIND, "mempolicy_mbind"}, \
- {MR_NUMA_MISPLACED, "numa_misplaced"}, \
- {MR_CMA, "cma"}
+ EM( MR_COMPACTION, "compaction") \
+ EM( MR_MEMORY_FAILURE, "memory_failure") \
+ EM( MR_MEMORY_HOTPLUG, "memory_hotplug") \
+ EM( MR_SYSCALL, "syscall_or_cpuset") \
+ EM( MR_MEMPOLICY_MBIND, "mempolicy_mbind") \
+ EM( MR_NUMA_MISPLACED, "numa_misplaced") \
+ EMe(MR_CMA, "cma")
+
+/*
+ * First define the enums in the above macros to be exported to userspace
+ * via TRACE_DEFINE_ENUM().
+ */
+#undef EM
+#undef EMe
+#define EM(a, b) TRACE_DEFINE_ENUM(a);
+#define EMe(a, b) TRACE_DEFINE_ENUM(a);
+
+MIGRATE_MODE
+MIGRATE_REASON
+
+/*
+ * Now redefine the EM() and EMe() macros to map the enums to the strings
+ * that will be printed in the output.
+ */
+#undef EM
+#undef EMe
+#define EM(a, b) {a, b},
+#define EMe(a, b) {a, b}
TRACE_EVENT(mm_migrate_pages,
--
2.1.4
next prev parent reply other threads:[~2015-04-08 13:51 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-08 13:48 [for-next][PATCH 00/21] tracing: Addition of TRACE_DEFINE_ENUM() to convert enums it TP_printk() Steven Rostedt
2015-04-08 13:48 ` [for-next][PATCH 01/21] tracing/drm: Remove unused TRACE_SYSTEM_STRING define Steven Rostedt
2015-04-08 13:48 ` [for-next][PATCH 02/21] tracing: Add TRACE_SYSTEM_VAR to intel-sst Steven Rostedt
2015-04-08 13:48 ` [for-next][PATCH 03/21] tracing: Add TRACE_SYSTEM_VAR to kvm-s390 Steven Rostedt
2015-04-08 13:48 ` [for-next][PATCH 04/21] tracing: Add TRACE_SYSTEM_VAR to xhci-hcd Steven Rostedt
2015-04-08 13:48 ` [for-next][PATCH 05/21] mac80211: Move message tracepoints to their own header Steven Rostedt
2015-04-08 13:48 ` [for-next][PATCH 06/21] iwlwifi: Move each system " Steven Rostedt
2015-04-08 13:48 ` [for-next][PATCH 07/21] brcmsmac: " Steven Rostedt
2015-04-08 13:48 ` [for-next][PATCH 08/21] tracing: Give system name a pointer Steven Rostedt
2015-04-08 13:48 ` [for-next][PATCH 09/21] tracing: Update trace-event-sample with TRACE_SYSTEM_VAR documentation Steven Rostedt
2015-04-08 13:48 ` [for-next][PATCH 10/21] tracing: Add TRACE_DEFINE_ENUM() macro to map enums to their values Steven Rostedt
2015-04-08 13:48 ` [for-next][PATCH 11/21] tracing: Allow for modules to convert their enums to values Steven Rostedt
2015-04-08 13:48 ` [for-next][PATCH 12/21] tracing/samples: Update the trace-event-sample.h with TRACE_DEFINE_ENUM() Steven Rostedt
2015-04-08 13:48 ` [for-next][PATCH 13/21] x86/tlb/trace: Export enums in used by tlb_flush tracepoint Steven Rostedt
2015-04-08 13:48 ` [for-next][PATCH 14/21] net/9p/tracing: Export enums in tracepoints to userspace Steven Rostedt
2015-04-08 13:48 ` [for-next][PATCH 15/21] f2fs: Export the enums in the " Steven Rostedt
2015-04-08 13:48 ` [for-next][PATCH 16/21] irq/tracing: Export enums in tracepoints to user space Steven Rostedt
2015-04-08 13:48 ` Steven Rostedt [this message]
2015-04-08 13:48 ` [for-next][PATCH 18/21] SUNRPC: " Steven Rostedt
2015-04-08 13:48 ` [for-next][PATCH 19/21] v4l: Export enums used by " Steven Rostedt
2015-04-08 14:43 ` Mauro Carvalho Chehab
2015-04-08 14:56 ` Steven Rostedt
2015-04-08 13:48 ` [for-next][PATCH 20/21] writeback: Export enums used by tracepoint " Steven Rostedt
2015-04-08 13:48 ` [for-next][PATCH 21/21] tracing: Add enum_map file to show enums that have been mapped Steven Rostedt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20150408134927.249476737@goodmis.org \
--to=rostedt@goodmis.org \
--cc=acme@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=masami.hiramatsu.pt@hitachi.com \
--cc=mingo@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox