Commit 31696198 authored by Tom Zanussi's avatar Tom Zanussi Committed by Steven Rostedt

tracing: Add hist trigger 'syscall' modifier

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

Link: http://lkml.kernel.org/r/2bab1e59933d76a14b545bd2e02f80b8b08ac4d3.1457029949.git.tom.zanussi@linux.intel.comSigned-off-by: default avatarTom Zanussi <tom.zanussi@linux.intel.com>
Tested-by: default avatarMasami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Reviewed-by: default avatarNamhyung Kim <namhyung@kernel.org>
Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
parent 6b4827ad
...@@ -3858,7 +3858,8 @@ static const char readme_msg[] = ...@@ -3858,7 +3858,8 @@ static const char readme_msg[] =
"\t .hex display a number as a hex value\n" "\t .hex display a number as a hex value\n"
"\t .sym display an address as a symbol\n" "\t .sym display an address as a symbol\n"
"\t .sym-offset display an address as a symbol and offset\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 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 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" "\t until told to do so. 'continue' can be used to start or\n"
......
...@@ -84,6 +84,7 @@ enum hist_field_flags { ...@@ -84,6 +84,7 @@ enum hist_field_flags {
HIST_FIELD_FL_SYM = 16, HIST_FIELD_FL_SYM = 16,
HIST_FIELD_FL_SYM_OFFSET = 32, HIST_FIELD_FL_SYM_OFFSET = 32,
HIST_FIELD_FL_EXECNAME = 64, HIST_FIELD_FL_EXECNAME = 64,
HIST_FIELD_FL_SYSCALL = 128,
}; };
struct hist_trigger_attrs { struct hist_trigger_attrs {
...@@ -474,6 +475,8 @@ static int create_key_field(struct hist_trigger_data *hist_data, ...@@ -474,6 +475,8 @@ static int create_key_field(struct hist_trigger_data *hist_data,
else if ((strcmp(field_str, "execname") == 0) && else if ((strcmp(field_str, "execname") == 0) &&
(strcmp(field_name, "common_pid") == 0)) (strcmp(field_name, "common_pid") == 0))
flags |= HIST_FIELD_FL_EXECNAME; flags |= HIST_FIELD_FL_EXECNAME;
else if (strcmp(field_str, "syscall") == 0)
flags |= HIST_FIELD_FL_SYSCALL;
else { else {
ret = -EINVAL; ret = -EINVAL;
goto out; goto out;
...@@ -854,6 +857,16 @@ hist_trigger_entry_print(struct seq_file *m, ...@@ -854,6 +857,16 @@ hist_trigger_entry_print(struct seq_file *m,
uval = *(u64 *)(key + key_field->offset); uval = *(u64 *)(key + key_field->offset);
seq_printf(m, "%s: %-16s[%10llu]", seq_printf(m, "%s: %-16s[%10llu]",
key_field->field->name, comm, uval); 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) { } else if (key_field->flags & HIST_FIELD_FL_STRING) {
seq_printf(m, "%s: %-50s", key_field->field->name, seq_printf(m, "%s: %-50s", key_field->field->name,
(char *)(key + key_field->offset)); (char *)(key + key_field->offset));
...@@ -975,6 +988,8 @@ static const char *get_hist_field_flags(struct hist_field *hist_field) ...@@ -975,6 +988,8 @@ static const char *get_hist_field_flags(struct hist_field *hist_field)
flags_str = "sym-offset"; flags_str = "sym-offset";
else if (hist_field->flags & HIST_FIELD_FL_EXECNAME) else if (hist_field->flags & HIST_FIELD_FL_EXECNAME)
flags_str = "execname"; flags_str = "execname";
else if (hist_field->flags & HIST_FIELD_FL_SYSCALL)
flags_str = "syscall";
return flags_str; return flags_str;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment