diff options
author | Steven Rostedt <srostedt@redhat.com> | 2011-03-18 15:16:56 -0400 |
---|---|---|
committer | Steven Rostedt <rostedt@goodmis.org> | 2011-03-18 15:22:55 -0400 |
commit | b5d9ba0ed7a62ecc6b44a2375f4d321b68e96610 (patch) | |
tree | 9005ce8942ef2ec199b32b71f59e24432f080844 | |
parent | 3e3c3b167e44d701b338dd83c789752948d9fb87 (diff) |
trace-cmd: Add -O to trace-cmd report to pass options to plugins
The -O field now passes options to the plugins. The format is of:
-O [plugin:]var[=val]
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
-rw-r--r-- | Documentation/trace-cmd-report.1.txt | 11 | ||||
-rw-r--r-- | trace-read.c | 18 | ||||
-rw-r--r-- | trace-usage.c | 3 |
3 files changed, 30 insertions, 2 deletions
diff --git a/Documentation/trace-cmd-report.1.txt b/Documentation/trace-cmd-report.1.txt index 148f9d9..9c9a8e7 100644 --- a/Documentation/trace-cmd-report.1.txt +++ b/Documentation/trace-cmd-report.1.txt | |||
@@ -167,6 +167,17 @@ OPTIONS | |||
167 | *-q*:: | 167 | *-q*:: |
168 | Quiet non critical warnings. | 168 | Quiet non critical warnings. |
169 | 169 | ||
170 | *-O*:: | ||
171 | Pass options to the trace-cmd plugins that are loaded. | ||
172 | |||
173 | -O plugin:var=value | ||
174 | |||
175 | The 'plugin:' and '=value' are optional. Value may be left off for options | ||
176 | that are boolean. If the 'plugin:' is left off, then any variable that matches | ||
177 | in all plugins will be set. | ||
178 | |||
179 | Example: -O fgraph:tailprint | ||
180 | |||
170 | EXAMPLES | 181 | EXAMPLES |
171 | -------- | 182 | -------- |
172 | 183 | ||
diff --git a/trace-read.c b/trace-read.c index 0d8f7f1..6e85041 100644 --- a/trace-read.c +++ b/trace-read.c | |||
@@ -812,6 +812,19 @@ static void add_functions(struct pevent *pevent, const char *file) | |||
812 | free(buf); | 812 | free(buf); |
813 | } | 813 | } |
814 | 814 | ||
815 | static void process_plugin_option(char *option) | ||
816 | { | ||
817 | char *name = option; | ||
818 | char *val = NULL; | ||
819 | char *p; | ||
820 | |||
821 | if ((p = strstr(name, "="))) { | ||
822 | *p = '\0'; | ||
823 | val = p+1; | ||
824 | } | ||
825 | trace_util_add_option(name, val); | ||
826 | } | ||
827 | |||
815 | enum { | 828 | enum { |
816 | OPT_kallsyms = 253, | 829 | OPT_kallsyms = 253, |
817 | OPT_events = 254, | 830 | OPT_events = 254, |
@@ -859,7 +872,7 @@ void trace_report (int argc, char **argv) | |||
859 | {NULL, 0, NULL, 0} | 872 | {NULL, 0, NULL, 0} |
860 | }; | 873 | }; |
861 | 874 | ||
862 | c = getopt_long (argc-1, argv+1, "+hi:feprPNLlEwF:VvTq", | 875 | c = getopt_long (argc-1, argv+1, "+hi:feprPNLlEwF:VvTqO:", |
863 | long_options, &option_index); | 876 | long_options, &option_index); |
864 | if (c == -1) | 877 | if (c == -1) |
865 | break; | 878 | break; |
@@ -912,6 +925,9 @@ void trace_report (int argc, char **argv) | |||
912 | case 'l': | 925 | case 'l': |
913 | latency_format = 1; | 926 | latency_format = 1; |
914 | break; | 927 | break; |
928 | case 'O': | ||
929 | process_plugin_option(optarg); | ||
930 | break; | ||
915 | case 'v': | 931 | case 'v': |
916 | if (neg) | 932 | if (neg) |
917 | die("Only 1 -v can be used"); | 933 | die("Only 1 -v can be used"); |
diff --git a/trace-usage.c b/trace-usage.c index 4b171fe..1497279 100644 --- a/trace-usage.c +++ b/trace-usage.c | |||
@@ -75,7 +75,7 @@ static struct usage_help usage_help[] = { | |||
75 | "report", | 75 | "report", |
76 | "read out the trace stored in a trace.dat file", | 76 | "read out the trace stored in a trace.dat file", |
77 | " %s report [-i file] [--cpu cpu] [-e][-f][-l][-P][-L][-N][-r][-E]\\\n" | 77 | " %s report [-i file] [--cpu cpu] [-e][-f][-l][-P][-L][-N][-r][-E]\\\n" |
78 | " [-F filter][-v][-V][-T]\n" | 78 | " [-F filter][-v][-V][-T][-O option]\n" |
79 | " -i input file [default trace.dat]\n" | 79 | " -i input file [default trace.dat]\n" |
80 | " -e show file endianess\n" | 80 | " -e show file endianess\n" |
81 | " -f show function list\n" | 81 | " -f show function list\n" |
@@ -90,6 +90,7 @@ static struct usage_help usage_help[] = { | |||
90 | " -N do not load any plugins\n" | 90 | " -N do not load any plugins\n" |
91 | " -w show wakeup latencies\n" | 91 | " -w show wakeup latencies\n" |
92 | " -l show latency format (default with latency tracers)\n" | 92 | " -l show latency format (default with latency tracers)\n" |
93 | " -O plugin option -O [plugin:]var[=val]\n" | ||
93 | }, | 94 | }, |
94 | { | 95 | { |
95 | "split", | 96 | "split", |