diff options
| author | Steven Rostedt <srostedt@redhat.com> | 2011-01-21 11:58:53 -0500 |
|---|---|---|
| committer | Steven Rostedt <rostedt@goodmis.org> | 2011-01-21 12:07:34 -0500 |
| commit | 0d8c0ce5775fc3fa11170cfe560afae2ae9e50e2 (patch) | |
| tree | b1e2bc82053775de0f27e0450c03f4df0434559f | |
| parent | 33f493c4de54138bcd9aac9454aae01d648e85f0 (diff) | |
trace-cmd: Add -T option to report to test filters
Add the -T option to print the filter strings created by -F
and exit.
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
| -rw-r--r-- | Documentation/trace-cmd-report.1.txt | 8 | ||||
| -rw-r--r-- | trace-read.c | 10 | ||||
| -rw-r--r-- | trace-usage.c | 3 |
3 files changed, 19 insertions, 2 deletions
diff --git a/Documentation/trace-cmd-report.1.txt b/Documentation/trace-cmd-report.1.txt index 86169f2..148f9d9 100644 --- a/Documentation/trace-cmd-report.1.txt +++ b/Documentation/trace-cmd-report.1.txt | |||
| @@ -117,6 +117,14 @@ OPTIONS | |||
| 117 | Will not display any sched_switch events that have a prev_state of 0. | 117 | Will not display any sched_switch events that have a prev_state of 0. |
| 118 | Removing the *-v* will only print out those events. | 118 | Removing the *-v* will only print out those events. |
| 119 | 119 | ||
| 120 | *-T*:: | ||
| 121 | Test the filters of -F. After processing a filter string, the | ||
| 122 | resulting filter will be displayed for each event. This is useful | ||
| 123 | for using a filter for more than one event where a field may not | ||
| 124 | exist in all events. Also it can be used to make sure there are no | ||
| 125 | misspelled event field names, as they will simply be ignored. | ||
| 126 | *-T* is ignored if *-F* is not specified. | ||
| 127 | |||
| 120 | *-V*:: | 128 | *-V*:: |
| 121 | Show the plugins that are loaded. | 129 | Show the plugins that are loaded. |
| 122 | 130 | ||
diff --git a/trace-read.c b/trace-read.c index a4c3538..37a7bc4 100644 --- a/trace-read.c +++ b/trace-read.c | |||
| @@ -688,6 +688,7 @@ void trace_report (int argc, char **argv) | |||
| 688 | int latency_format = 0; | 688 | int latency_format = 0; |
| 689 | int show_events = 0; | 689 | int show_events = 0; |
| 690 | int print_events = 0; | 690 | int print_events = 0; |
| 691 | int test_filters = 0; | ||
| 691 | int raw = 0; | 692 | int raw = 0; |
| 692 | int neg = 0; | 693 | int neg = 0; |
| 693 | int c; | 694 | int c; |
| @@ -705,11 +706,12 @@ void trace_report (int argc, char **argv) | |||
| 705 | static struct option long_options[] = { | 706 | static struct option long_options[] = { |
| 706 | {"cpu", required_argument, NULL, 0}, | 707 | {"cpu", required_argument, NULL, 0}, |
| 707 | {"events", no_argument, NULL, 0}, | 708 | {"events", no_argument, NULL, 0}, |
| 709 | {"filter-test", no_argument, NULL, 'T'}, | ||
| 708 | {"help", no_argument, NULL, '?'}, | 710 | {"help", no_argument, NULL, '?'}, |
| 709 | {NULL, 0, NULL, 0} | 711 | {NULL, 0, NULL, 0} |
| 710 | }; | 712 | }; |
| 711 | 713 | ||
| 712 | c = getopt_long (argc-1, argv+1, "+hi:feprPNLlEwF:Vvq", | 714 | c = getopt_long (argc-1, argv+1, "+hi:feprPNLlEwF:VvTq", |
| 713 | long_options, &option_index); | 715 | long_options, &option_index); |
| 714 | if (c == -1) | 716 | if (c == -1) |
| 715 | break; | 717 | break; |
| @@ -723,6 +725,9 @@ void trace_report (int argc, char **argv) | |||
| 723 | case 'F': | 725 | case 'F': |
| 724 | add_filter(optarg, neg); | 726 | add_filter(optarg, neg); |
| 725 | break; | 727 | break; |
| 728 | case 'T': | ||
| 729 | test_filters = 1; | ||
| 730 | break; | ||
| 726 | case 'f': | 731 | case 'f': |
| 727 | show_funcs = 1; | 732 | show_funcs = 1; |
| 728 | break; | 733 | break; |
| @@ -811,6 +816,9 @@ void trace_report (int argc, char **argv) | |||
| 811 | if (raw) | 816 | if (raw) |
| 812 | pevent->print_raw = 1; | 817 | pevent->print_raw = 1; |
| 813 | 818 | ||
| 819 | if (test_filters) | ||
| 820 | pevent->test_filters = 1; | ||
| 821 | |||
| 814 | if (show_endian) { | 822 | if (show_endian) { |
| 815 | printf("file is %s endian and host is %s endian\n", | 823 | printf("file is %s endian and host is %s endian\n", |
| 816 | pevent_is_file_bigendian(pevent) ? "big" : "little", | 824 | pevent_is_file_bigendian(pevent) ? "big" : "little", |
diff --git a/trace-usage.c b/trace-usage.c index a6280e8..88f744c 100644 --- a/trace-usage.c +++ b/trace-usage.c | |||
| @@ -71,7 +71,7 @@ static struct usage_help usage_help[] = { | |||
| 71 | "report", | 71 | "report", |
| 72 | "read out the trace stored in a trace.dat file", | 72 | "read out the trace stored in a trace.dat file", |
| 73 | " %s report [-i file] [--cpu cpu] [-e][-f][-l][-P][-L][-N][-r][-E]\\\n" | 73 | " %s report [-i file] [--cpu cpu] [-e][-f][-l][-P][-L][-N][-r][-E]\\\n" |
| 74 | " [-F filter][-v][-V]\n" | 74 | " [-F filter][-v][-V][-T]\n" |
| 75 | " -i input file [default trace.dat]\n" | 75 | " -i input file [default trace.dat]\n" |
| 76 | " -e show file endianess\n" | 76 | " -e show file endianess\n" |
| 77 | " -f show function list\n" | 77 | " -f show function list\n" |
| @@ -80,6 +80,7 @@ static struct usage_help usage_help[] = { | |||
| 80 | " -F filter to filter output on\n" | 80 | " -F filter to filter output on\n" |
| 81 | " -r raw format: ignore print format and only show field data\n" | 81 | " -r raw format: ignore print format and only show field data\n" |
| 82 | " -v will negate all -F after it (Not show matches)\n" | 82 | " -v will negate all -F after it (Not show matches)\n" |
| 83 | " -T print out the filter strings created and exit\n" | ||
| 83 | " -V verbose (shows plugins being loaded)\n" | 84 | " -V verbose (shows plugins being loaded)\n" |
| 84 | " -L load only local (~/.trace-cmd/plugins) plugins\n" | 85 | " -L load only local (~/.trace-cmd/plugins) plugins\n" |
| 85 | " -N do not load any plugins\n" | 86 | " -N do not load any plugins\n" |
