diff options
author | Arjan van de Ven <arjan@infradead.org> | 2009-09-19 07:34:42 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-09-19 12:57:51 -0400 |
commit | 3c09eebd61eaacca866cd60b50416f18640bc731 (patch) | |
tree | ff4de07d2a8197943ff60f04bd60e18c6371346e /tools | |
parent | 10274989fd595db455874fc2c83272fb33f6b27b (diff) |
perf timechart: Add "perf timechart record"
Add a command line option to record a trace, similar to "perf sched record".
Signed-off-by: Arjan van de Ven <arjan@linux.intel.com>
Cc: fweisbec@gmail.com
Cc: peterz@infradead.org
Cc: Paul Mackerras <paulus@samba.org>
LKML-Reference: <20090919133442.0dc2c7f5@infradead.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/perf/builtin-timechart.c | 47 |
1 files changed, 39 insertions, 8 deletions
diff --git a/tools/perf/builtin-timechart.c b/tools/perf/builtin-timechart.c index 00fac1b362fd..58d737ec8f5e 100644 --- a/tools/perf/builtin-timechart.c +++ b/tools/perf/builtin-timechart.c | |||
@@ -1086,11 +1086,42 @@ done: | |||
1086 | return rc; | 1086 | return rc; |
1087 | } | 1087 | } |
1088 | 1088 | ||
1089 | static const char * const report_usage[] = { | 1089 | static const char * const timechart_usage[] = { |
1090 | "perf report [<options>] <command>", | 1090 | "perf timechart [<options>] {record}", |
1091 | NULL | 1091 | NULL |
1092 | }; | 1092 | }; |
1093 | 1093 | ||
1094 | static const char *record_args[] = { | ||
1095 | "record", | ||
1096 | "-a", | ||
1097 | "-R", | ||
1098 | "-M", | ||
1099 | "-f", | ||
1100 | "-c", "1", | ||
1101 | "-e", "power:power_start", | ||
1102 | "-e", "power:power_end", | ||
1103 | "-e", "power:power_frequency", | ||
1104 | "-e", "sched:sched_wakeup", | ||
1105 | "-e", "sched:sched_switch", | ||
1106 | }; | ||
1107 | |||
1108 | static int __cmd_record(int argc, const char **argv) | ||
1109 | { | ||
1110 | unsigned int rec_argc, i, j; | ||
1111 | const char **rec_argv; | ||
1112 | |||
1113 | rec_argc = ARRAY_SIZE(record_args) + argc - 1; | ||
1114 | rec_argv = calloc(rec_argc + 1, sizeof(char *)); | ||
1115 | |||
1116 | for (i = 0; i < ARRAY_SIZE(record_args); i++) | ||
1117 | rec_argv[i] = strdup(record_args[i]); | ||
1118 | |||
1119 | for (j = 1; j < (unsigned int)argc; j++, i++) | ||
1120 | rec_argv[i] = argv[j]; | ||
1121 | |||
1122 | return cmd_record(i, rec_argv, NULL); | ||
1123 | } | ||
1124 | |||
1094 | static const struct option options[] = { | 1125 | static const struct option options[] = { |
1095 | OPT_STRING('i', "input", &input_name, "file", | 1126 | OPT_STRING('i', "input", &input_name, "file", |
1096 | "input file name"), | 1127 | "input file name"), |
@@ -1106,13 +1137,13 @@ int cmd_timechart(int argc, const char **argv, const char *prefix __used) | |||
1106 | 1137 | ||
1107 | page_size = getpagesize(); | 1138 | page_size = getpagesize(); |
1108 | 1139 | ||
1109 | argc = parse_options(argc, argv, options, report_usage, 0); | 1140 | argc = parse_options(argc, argv, options, timechart_usage, |
1141 | PARSE_OPT_STOP_AT_NON_OPTION); | ||
1110 | 1142 | ||
1111 | /* | 1143 | if (argc && !strncmp(argv[0], "rec", 3)) |
1112 | * Any (unrecognized) arguments left? | 1144 | return __cmd_record(argc, argv); |
1113 | */ | 1145 | else if (argc) |
1114 | if (argc) | 1146 | usage_with_options(timechart_usage, options); |
1115 | usage_with_options(report_usage, options); | ||
1116 | 1147 | ||
1117 | setup_pager(); | 1148 | setup_pager(); |
1118 | 1149 | ||