From: Tom Zanussi <tom.zanussi@linux.intel.com>
To: rostedt@goodmis.org
Cc: masami.hiramatsu.pt@hitachi.com, namhyung@kernel.org,
josh@joshtriplett.org, andi@firstfloor.org,
mathieu.desnoyers@efficios.com, peterz@infradead.org,
linux-kernel@vger.kernel.org,
Tom Zanussi <tom.zanussi@linux.intel.com>
Subject: [PATCH v16 11/23] tracing: Add hist trigger 'syscall' modifier
Date: Thu, 3 Mar 2016 12:54:51 -0600 [thread overview]
Message-ID: <2bab1e59933d76a14b545bd2e02f80b8b08ac4d3.1457029949.git.tom.zanussi@linux.intel.com> (raw)
In-Reply-To: <cover.1457029949.git.tom.zanussi@linux.intel.com>
In-Reply-To: <cover.1457029949.git.tom.zanussi@linux.intel.com>
Allow users to have syscall id fields displayed as syscall names in
the output by appending '.syscall' to field names:
# echo hist:keys=aaa.syscall ... \
[ if filter] > event/trigger
Signed-off-by: Tom Zanussi <tom.zanussi@linux.intel.com>
Tested-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Reviewed-by: Namhyung Kim <namhyung@kernel.org>
---
kernel/trace/trace.c | 3 ++-
kernel/trace/trace_events_hist.c | 15 +++++++++++++++
2 files changed, 17 insertions(+), 1 deletion(-)
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index bfcbfee..d1890cc 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -3849,7 +3849,8 @@ static const char readme_msg[] =
"\t .hex display a number as a hex value\n"
"\t .sym display an address as a symbol\n"
"\t .sym-offset display an address as a symbol and offset\n"
- "\t .execname display a common_pid as a program name\n\n"
+ "\t .execname display a common_pid as a program name\n"
+ "\t .syscall display a syscall id as a syscall name\n\n"
"\t The 'pause' parameter can be used to pause an existing hist\n"
"\t trigger or to start a hist trigger but not log any events\n"
"\t until told to do so. 'continue' can be used to start or\n"
diff --git a/kernel/trace/trace_events_hist.c b/kernel/trace/trace_events_hist.c
index 227e6c2..f9e7ecb 100644
--- a/kernel/trace/trace_events_hist.c
+++ b/kernel/trace/trace_events_hist.c
@@ -84,6 +84,7 @@ enum hist_field_flags {
HIST_FIELD_FL_SYM = 16,
HIST_FIELD_FL_SYM_OFFSET = 32,
HIST_FIELD_FL_EXECNAME = 64,
+ HIST_FIELD_FL_SYSCALL = 128,
};
struct hist_trigger_attrs {
@@ -474,6 +475,8 @@ static int create_key_field(struct hist_trigger_data *hist_data,
else if ((strcmp(field_str, "execname") == 0) &&
(strcmp(field_name, "common_pid") == 0))
flags |= HIST_FIELD_FL_EXECNAME;
+ else if (strcmp(field_str, "syscall") == 0)
+ flags |= HIST_FIELD_FL_SYSCALL;
else {
ret = -EINVAL;
goto out;
@@ -854,6 +857,16 @@ hist_trigger_entry_print(struct seq_file *m,
uval = *(u64 *)(key + key_field->offset);
seq_printf(m, "%s: %-16s[%10llu]",
key_field->field->name, comm, uval);
+ } else if (key_field->flags & HIST_FIELD_FL_SYSCALL) {
+ const char *syscall_name;
+
+ uval = *(u64 *)(key + key_field->offset);
+ syscall_name = get_syscall_name(uval);
+ if (!syscall_name)
+ syscall_name = "unknown_syscall";
+
+ seq_printf(m, "%s: %-30s[%3llu]",
+ key_field->field->name, syscall_name, uval);
} else if (key_field->flags & HIST_FIELD_FL_STRING) {
seq_printf(m, "%s: %-50s", key_field->field->name,
(char *)(key + key_field->offset));
@@ -975,6 +988,8 @@ static const char *get_hist_field_flags(struct hist_field *hist_field)
flags_str = "sym-offset";
else if (hist_field->flags & HIST_FIELD_FL_EXECNAME)
flags_str = "execname";
+ else if (hist_field->flags & HIST_FIELD_FL_SYSCALL)
+ flags_str = "syscall";
return flags_str;
}
--
1.9.3
next prev parent reply other threads:[~2016-03-03 18:59 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-03 18:54 [PATCH 00/23] tracing: 'hist' triggers Tom Zanussi
2016-03-03 18:54 ` [PATCH v16 01/23] tracing: Update some tracing_map constants and comments Tom Zanussi
2016-03-03 18:54 ` [PATCH v16 02/23] tracing: Add 'hist' event trigger command Tom Zanussi
2016-03-08 22:26 ` Steven Rostedt
2016-03-09 0:03 ` Tom Zanussi
2016-03-03 18:54 ` [PATCH v16 03/23] tracing: Add hist trigger support for multiple values ('vals=' param) Tom Zanussi
2016-03-03 18:54 ` [PATCH v16 04/23] tracing: Add hist trigger support for compound keys Tom Zanussi
2016-03-03 18:54 ` [PATCH v16 05/23] tracing: Add hist trigger support for user-defined sorting ('sort=' param) Tom Zanussi
2016-03-03 18:54 ` [PATCH v16 06/23] tracing: Add hist trigger support for pausing and continuing a trace Tom Zanussi
2016-03-03 18:54 ` [PATCH v16 07/23] tracing: Add hist trigger support for clearing " Tom Zanussi
2016-03-03 18:54 ` [PATCH v16 08/23] tracing: Add hist trigger 'hex' modifier for displaying numeric fields Tom Zanussi
2016-03-03 18:54 ` [PATCH v16 09/23] tracing: Add hist trigger 'sym' and 'sym-offset' modifiers Tom Zanussi
2016-03-03 18:54 ` [PATCH v16 10/23] tracing: Add hist trigger 'execname' modifier Tom Zanussi
2016-03-03 18:54 ` Tom Zanussi [this message]
2016-03-03 18:54 ` [PATCH v16 12/23] tracing: Add hist trigger support for stacktraces as keys Tom Zanussi
2016-03-03 18:54 ` [PATCH v16 13/23] tracing: Support string type key properly Tom Zanussi
2016-03-03 18:54 ` [PATCH v16 14/23] tracing: Remove restriction on string position in hist trigger keys Tom Zanussi
2016-03-03 18:54 ` [PATCH v16 15/23] tracing: Add enable_hist/disable_hist triggers Tom Zanussi
2016-03-03 18:54 ` [PATCH v16 16/23] tracing: Add 'hist' trigger Documentation Tom Zanussi
2016-03-03 18:54 ` [PATCH v16 17/23] tracing: Add support for multiple hist triggers per event Tom Zanussi
2016-03-03 18:54 ` [PATCH v16 18/23] tracing: Add support for named triggers Tom Zanussi
2016-03-03 18:54 ` [PATCH v16 19/23] tracing: Add support for named hist triggers Tom Zanussi
2016-03-03 18:55 ` [PATCH v16 20/23] kselftests/ftrace : Add event trigger testcases Tom Zanussi
2016-03-03 18:55 ` [PATCH v16 21/23] kselftests/ftrace: Add hist " Tom Zanussi
2016-03-03 18:55 ` [PATCH v16 22/23] tracing: Add hist trigger 'log2' modifier Tom Zanussi
2016-03-29 10:01 ` Daniel Wagner
2016-03-29 15:17 ` Namhyung Kim
2016-03-31 5:09 ` Daniel Wagner
2016-04-05 23:35 ` Tom Zanussi
2016-03-03 18:55 ` [PATCH v16 23/23] kselftests/ftrace: Add a test for log2 modifier of hist trigger Tom Zanussi
2016-03-09 14:44 ` [PATCH 00/23] tracing: 'hist' triggers Steven Rostedt
2016-03-09 15:04 ` Tom Zanussi
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=2bab1e59933d76a14b545bd2e02f80b8b08ac4d3.1457029949.git.tom.zanussi@linux.intel.com \
--to=tom.zanussi@linux.intel.com \
--cc=andi@firstfloor.org \
--cc=josh@joshtriplett.org \
--cc=linux-kernel@vger.kernel.org \
--cc=masami.hiramatsu.pt@hitachi.com \
--cc=mathieu.desnoyers@efficios.com \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.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
all inboxes | Powered by JetHome®