Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 163792
b: refs/heads/master
c: 3c09eeb
h: refs/heads/master
v: v3
  • Loading branch information
Arjan van de Ven authored and Ingo Molnar committed Sep 19, 2009
1 parent 9579214 commit 210263b
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 9 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 10274989fd595db455874fc2c83272fb33f6b27b
refs/heads/master: 3c09eebd61eaacca866cd60b50416f18640bc731
47 changes: 39 additions & 8 deletions trunk/tools/perf/builtin-timechart.c
Original file line number Diff line number Diff line change
Expand Up @@ -1086,11 +1086,42 @@ static int __cmd_timechart(void)
return rc;
}

static const char * const report_usage[] = {
"perf report [<options>] <command>",
static const char * const timechart_usage[] = {
"perf timechart [<options>] {record}",
NULL
};

static const char *record_args[] = {
"record",
"-a",
"-R",
"-M",
"-f",
"-c", "1",
"-e", "power:power_start",
"-e", "power:power_end",
"-e", "power:power_frequency",
"-e", "sched:sched_wakeup",
"-e", "sched:sched_switch",
};

static int __cmd_record(int argc, const char **argv)
{
unsigned int rec_argc, i, j;
const char **rec_argv;

rec_argc = ARRAY_SIZE(record_args) + argc - 1;
rec_argv = calloc(rec_argc + 1, sizeof(char *));

for (i = 0; i < ARRAY_SIZE(record_args); i++)
rec_argv[i] = strdup(record_args[i]);

for (j = 1; j < (unsigned int)argc; j++, i++)
rec_argv[i] = argv[j];

return cmd_record(i, rec_argv, NULL);
}

static const struct option options[] = {
OPT_STRING('i', "input", &input_name, "file",
"input file name"),
Expand All @@ -1106,13 +1137,13 @@ int cmd_timechart(int argc, const char **argv, const char *prefix __used)

page_size = getpagesize();

argc = parse_options(argc, argv, options, report_usage, 0);
argc = parse_options(argc, argv, options, timechart_usage,
PARSE_OPT_STOP_AT_NON_OPTION);

/*
* Any (unrecognized) arguments left?
*/
if (argc)
usage_with_options(report_usage, options);
if (argc && !strncmp(argv[0], "rec", 3))
return __cmd_record(argc, argv);
else if (argc)
usage_with_options(timechart_usage, options);

setup_pager();

Expand Down

0 comments on commit 210263b

Please sign in to comment.