tracing: Rename stacktrace field to common_stacktrace

The histogram and synthetic events can use a pseudo event called
"stacktrace" that will create a stacktrace at the time of the event and
use it just like it was a normal field. We have other pseudo events such
as "common_cpu" and "common_timestamp". To stay consistent with that,
convert "stacktrace" to "common_stacktrace". As this was used in older
kernels, to keep backward compatibility, this will act just like
"common_cpu" did with "cpu". That is, "cpu" will be the same as
"common_cpu" unless the event has a "cpu" field. In which case, the
event's field is used. The same is true with "stacktrace".

Also update the documentation to reflect this change.

Link: https://lore.kernel.org/linux-trace-kernel/20230523230913.6860e28d@rorschach.local.home

Cc: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Tom Zanussi <zanussi@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: default avatarSteven Rostedt (Google) <rostedt@goodmis.org>
parent e30fbc61
This diff is collapsed.
...@@ -806,6 +806,7 @@ enum { ...@@ -806,6 +806,7 @@ enum {
FILTER_TRACE_FN, FILTER_TRACE_FN,
FILTER_COMM, FILTER_COMM,
FILTER_CPU, FILTER_CPU,
FILTER_STACKTRACE,
}; };
extern int trace_event_raw_init(struct trace_event_call *call); extern int trace_event_raw_init(struct trace_event_call *call);
......
...@@ -5752,7 +5752,7 @@ static const char readme_msg[] = ...@@ -5752,7 +5752,7 @@ static const char readme_msg[] =
"\t table using the key(s) and value(s) named, and the value of a\n" "\t table using the key(s) and value(s) named, and the value of a\n"
"\t sum called 'hitcount' is incremented. Keys and values\n" "\t sum called 'hitcount' is incremented. Keys and values\n"
"\t correspond to fields in the event's format description. Keys\n" "\t correspond to fields in the event's format description. Keys\n"
"\t can be any field, or the special string 'stacktrace'.\n" "\t can be any field, or the special string 'common_stacktrace'.\n"
"\t Compound keys consisting of up to two fields can be specified\n" "\t Compound keys consisting of up to two fields can be specified\n"
"\t by the 'keys' keyword. Values must correspond to numeric\n" "\t by the 'keys' keyword. Values must correspond to numeric\n"
"\t fields. Sort keys consisting of up to two fields can be\n" "\t fields. Sort keys consisting of up to two fields can be\n"
......
...@@ -194,6 +194,8 @@ static int trace_define_generic_fields(void) ...@@ -194,6 +194,8 @@ static int trace_define_generic_fields(void)
__generic_field(int, common_cpu, FILTER_CPU); __generic_field(int, common_cpu, FILTER_CPU);
__generic_field(char *, COMM, FILTER_COMM); __generic_field(char *, COMM, FILTER_COMM);
__generic_field(char *, comm, FILTER_COMM); __generic_field(char *, comm, FILTER_COMM);
__generic_field(char *, stacktrace, FILTER_STACKTRACE);
__generic_field(char *, STACKTRACE, FILTER_STACKTRACE);
return ret; return ret;
} }
......
...@@ -1364,7 +1364,7 @@ static const char *hist_field_name(struct hist_field *field, ...@@ -1364,7 +1364,7 @@ static const char *hist_field_name(struct hist_field *field,
if (field->field) if (field->field)
field_name = field->field->name; field_name = field->field->name;
else else
field_name = "stacktrace"; field_name = "common_stacktrace";
} else if (field->flags & HIST_FIELD_FL_HITCOUNT) } else if (field->flags & HIST_FIELD_FL_HITCOUNT)
field_name = "hitcount"; field_name = "hitcount";
...@@ -2367,7 +2367,7 @@ parse_field(struct hist_trigger_data *hist_data, struct trace_event_file *file, ...@@ -2367,7 +2367,7 @@ parse_field(struct hist_trigger_data *hist_data, struct trace_event_file *file,
hist_data->enable_timestamps = true; hist_data->enable_timestamps = true;
if (*flags & HIST_FIELD_FL_TIMESTAMP_USECS) if (*flags & HIST_FIELD_FL_TIMESTAMP_USECS)
hist_data->attrs->ts_in_usecs = true; hist_data->attrs->ts_in_usecs = true;
} else if (strcmp(field_name, "stacktrace") == 0) { } else if (strcmp(field_name, "common_stacktrace") == 0) {
*flags |= HIST_FIELD_FL_STACKTRACE; *flags |= HIST_FIELD_FL_STACKTRACE;
} else if (strcmp(field_name, "common_cpu") == 0) } else if (strcmp(field_name, "common_cpu") == 0)
*flags |= HIST_FIELD_FL_CPU; *flags |= HIST_FIELD_FL_CPU;
...@@ -2378,11 +2378,15 @@ parse_field(struct hist_trigger_data *hist_data, struct trace_event_file *file, ...@@ -2378,11 +2378,15 @@ parse_field(struct hist_trigger_data *hist_data, struct trace_event_file *file,
if (!field || !field->size) { if (!field || !field->size) {
/* /*
* For backward compatibility, if field_name * For backward compatibility, if field_name
* was "cpu", then we treat this the same as * was "cpu" or "stacktrace", then we treat this
* common_cpu. This also works for "CPU". * the same as common_cpu and common_stacktrace
* respectively. This also works for "CPU", and
* "STACKTRACE".
*/ */
if (field && field->filter_type == FILTER_CPU) { if (field && field->filter_type == FILTER_CPU) {
*flags |= HIST_FIELD_FL_CPU; *flags |= HIST_FIELD_FL_CPU;
} else if (field && field->filter_type == FILTER_STACKTRACE) {
*flags |= HIST_FIELD_FL_STACKTRACE;
} else { } else {
hist_err(tr, HIST_ERR_FIELD_NOT_FOUND, hist_err(tr, HIST_ERR_FIELD_NOT_FOUND,
errpos(field_name)); errpos(field_name));
...@@ -5394,7 +5398,7 @@ static void hist_trigger_print_key(struct seq_file *m, ...@@ -5394,7 +5398,7 @@ static void hist_trigger_print_key(struct seq_file *m,
if (key_field->field) if (key_field->field)
seq_printf(m, "%s.stacktrace", key_field->field->name); seq_printf(m, "%s.stacktrace", key_field->field->name);
else else
seq_puts(m, "stacktrace:\n"); seq_puts(m, "common_stacktrace:\n");
hist_trigger_stacktrace_print(m, hist_trigger_stacktrace_print(m,
key + key_field->offset, key + key_field->offset,
HIST_STACKTRACE_DEPTH); HIST_STACKTRACE_DEPTH);
...@@ -5977,7 +5981,7 @@ static int event_hist_trigger_print(struct seq_file *m, ...@@ -5977,7 +5981,7 @@ static int event_hist_trigger_print(struct seq_file *m,
if (field->field) if (field->field)
seq_printf(m, "%s.stacktrace", field->field->name); seq_printf(m, "%s.stacktrace", field->field->name);
else else
seq_puts(m, "stacktrace"); seq_puts(m, "common_stacktrace");
} else } else
hist_field_print(m, field); hist_field_print(m, field);
} }
......
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