@@ -88,6 +88,12 @@ OPTIONS
*--graph_notrace*::
Show the functions that will not be graphed.
+*--hist* '[system:]event'::
+ Show the content of a histogram "hist" file for a given event
+
+*--trigger* '[system:]event'::
+ Show the content of the "trigger" file for a given event
+
*--cpumask*::
Show the mask of CPUs that tracing will trace.
@@ -23,6 +23,8 @@ enum {
OPT_buffer_percent,
OPT_current_tracer,
OPT_tracing_on,
+ OPT_hist,
+ OPT_trigger,
};
void trace_show(int argc, char **argv)
@@ -31,6 +33,8 @@ void trace_show(int argc, char **argv)
const char *file = "trace";
const char *cpu = NULL;
struct buffer_instance *instance = &top_instance;
+ char *hist = NULL;
+ char *trigger = NULL;
char cpu_path[128];
char *path;
int snap = 0;
@@ -40,6 +44,8 @@ void trace_show(int argc, char **argv)
int stop = 0;
int c;
static struct option long_options[] = {
+ {"hist", required_argument, NULL, OPT_hist},
+ {"trigger", required_argument, NULL, OPT_trigger},
{"tracing_on", no_argument, NULL, OPT_tracing_on},
{"current_tracer", no_argument, NULL, OPT_current_tracer},
{"buffer_size", no_argument, NULL, OPT_buffer_size_kb},
@@ -90,6 +96,13 @@ void trace_show(int argc, char **argv)
if (snap)
die("Can not have -s and -p together");
break;
+ case OPT_hist:
+ hist = optarg;
+ break;
+ case OPT_trigger:
+ trigger = optarg;
+ break;
+
case OPT_tracing_on:
show_instance_file(instance, "tracing_on");
stop = 1;
@@ -149,6 +162,44 @@ void trace_show(int argc, char **argv)
else if (snap)
file = "snapshot";
+ if (hist || trigger) {
+ char **systems = NULL;
+ char *system = NULL;
+ char *event = hist ? hist : trigger;
+ char *file = hist ? "hist" : "trigger";
+ char *p;
+
+ if ((p = strstr(event, ":"))) {
+ system = event;
+ event = p + 1;
+ *p = '\0';
+ }
+
+ if (!system) {
+ systems = tracefs_event_systems(NULL);
+
+ for (int i = 0; systems && systems[i]; i++) {
+ system = systems[i];
+ if (tracefs_event_file_exists(instance->tracefs,
+ system, event, file))
+ break;
+ }
+ if (!system)
+ die("Could not find system of event %s",
+ event);
+ }
+
+ path = tracefs_event_file_read(instance->tracefs,
+ system, event, file, NULL);
+ tracefs_list_free(systems);
+ if (!path)
+ die("Could not find hist for %s%s%s",
+ system ? system : "", system ? ":":"", event);
+ printf("%s\n", path);
+ free(path);
+ exit(0);
+ }
+
if (cpu) {
char *endptr;
long val;