diff options
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 | ||