diff options
| author | Steven Rostedt <srostedt@redhat.com> | 2010-02-19 10:53:55 -0500 |
|---|---|---|
| committer | Steven Rostedt <rostedt@goodmis.org> | 2010-02-19 10:53:55 -0500 |
| commit | 752defe72c37513592c014ee52809893b8990931 (patch) | |
| tree | 7317d60f8a6418fa6c73e6e372e12dbe8eb1c3ae | |
| parent | 326a762eb52825cb5d79b147d611bcf9cc99e4f2 (diff) | |
kernelshark/trace-cmd: Use command line as input_file if -i is left out
If a user types "kernelshark mytrace.dat" without using te -i option,
still use the mytrace.dat as the input file for the trace, instead
of the default trace.dat.
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
| -rw-r--r-- | kernel-shark.c | 6 | ||||
| -rw-r--r-- | trace-graph-main.c | 6 | ||||
| -rw-r--r-- | trace-read.c | 12 | ||||
| -rw-r--r-- | trace-view-main.c | 6 |
4 files changed, 29 insertions, 1 deletions
diff --git a/kernel-shark.c b/kernel-shark.c index 86ea2fc..1f1d459 100644 --- a/kernel-shark.c +++ b/kernel-shark.c | |||
| @@ -676,6 +676,12 @@ void kernel_shark(int argc, char **argv) | |||
| 676 | } | 676 | } |
| 677 | } | 677 | } |
| 678 | 678 | ||
| 679 | if ((argc - optind) >= 1) { | ||
| 680 | if (input_file) | ||
| 681 | usage(basename(argv[0])); | ||
| 682 | input_file = argv[optind]; | ||
| 683 | } | ||
| 684 | |||
| 679 | info = g_new0(typeof(*info), 1); | 685 | info = g_new0(typeof(*info), 1); |
| 680 | if (!info) | 686 | if (!info) |
| 681 | die("Unable to allocate info"); | 687 | die("Unable to allocate info"); |
diff --git a/trace-graph-main.c b/trace-graph-main.c index a6507ee..b373dd2 100644 --- a/trace-graph-main.c +++ b/trace-graph-main.c | |||
| @@ -189,6 +189,12 @@ void trace_graph(int argc, char **argv) | |||
| 189 | } | 189 | } |
| 190 | } | 190 | } |
| 191 | 191 | ||
| 192 | if ((argc - optind) >= 1) { | ||
| 193 | if (input_file) | ||
| 194 | usage(basename(argv[0])); | ||
| 195 | input_file = argv[optind]; | ||
| 196 | } | ||
| 197 | |||
| 192 | if (!input_file) { | 198 | if (!input_file) { |
| 193 | ret = stat(default_input_file, &st); | 199 | ret = stat(default_input_file, &st); |
| 194 | if (ret >= 0) | 200 | if (ret >= 0) |
diff --git a/trace-read.c b/trace-read.c index 76f5b7b..ca6661e 100644 --- a/trace-read.c +++ b/trace-read.c | |||
| @@ -51,7 +51,8 @@ static struct event_filter *event_filter_out; | |||
| 51 | 51 | ||
| 52 | static unsigned int page_size; | 52 | static unsigned int page_size; |
| 53 | static int input_fd; | 53 | static int input_fd; |
| 54 | const char *input_file = "trace.dat"; | 54 | const char *default_input_file = "trace.dat"; |
| 55 | const char *input_file; | ||
| 55 | 56 | ||
| 56 | static int filter_cpu = -1; | 57 | static int filter_cpu = -1; |
| 57 | 58 | ||
| @@ -632,6 +633,15 @@ void trace_report (int argc, char **argv) | |||
| 632 | } | 633 | } |
| 633 | } | 634 | } |
| 634 | 635 | ||
| 636 | if ((argc - optind) >= 2) { | ||
| 637 | if (input_file) | ||
| 638 | usage(argv); | ||
| 639 | input_file = argv[optind + 1]; | ||
| 640 | } | ||
| 641 | |||
| 642 | if (!input_file) | ||
| 643 | input_file = default_input_file; | ||
| 644 | |||
| 635 | handle = read_trace_header(); | 645 | handle = read_trace_header(); |
| 636 | if (!handle) | 646 | if (!handle) |
| 637 | die("error reading header"); | 647 | die("error reading header"); |
diff --git a/trace-view-main.c b/trace-view-main.c index d298e68..52678ce 100644 --- a/trace-view-main.c +++ b/trace-view-main.c | |||
| @@ -212,6 +212,12 @@ void trace_view(int argc, char **argv) | |||
| 212 | } | 212 | } |
| 213 | } | 213 | } |
| 214 | 214 | ||
| 215 | if ((argc - optind) >= 1) { | ||
| 216 | if (input_file) | ||
| 217 | usage(basename(argv[0])); | ||
| 218 | input_file = argv[optind]; | ||
| 219 | } | ||
| 220 | |||
| 215 | if (!input_file) { | 221 | if (!input_file) { |
| 216 | ret = stat(default_input_file, &st); | 222 | ret = stat(default_input_file, &st); |
| 217 | if (ret >= 0) | 223 | if (ret >= 0) |
