mirror of
https://github.com/torvalds/linux.git
synced 2024-10-25 22:44:30 +00:00
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>
This commit is contained in:
parent
10274989fd
commit
3c09eebd61
|
@ -1086,11 +1086,42 @@ done:
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char * const report_usage[] = {
|
static const char * const timechart_usage[] = {
|
||||||
"perf report [<options>] <command>",
|
"perf timechart [<options>] {record}",
|
||||||
NULL
|
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[] = {
|
static const struct option options[] = {
|
||||||
OPT_STRING('i', "input", &input_name, "file",
|
OPT_STRING('i', "input", &input_name, "file",
|
||||||
"input file name"),
|
"input file name"),
|
||||||
|
@ -1106,13 +1137,13 @@ int cmd_timechart(int argc, const char **argv, const char *prefix __used)
|
||||||
|
|
||||||
page_size = getpagesize();
|
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);
|
||||||
|
|
||||||
/*
|
if (argc && !strncmp(argv[0], "rec", 3))
|
||||||
* Any (unrecognized) arguments left?
|
return __cmd_record(argc, argv);
|
||||||
*/
|
else if (argc)
|
||||||
if (argc)
|
usage_with_options(timechart_usage, options);
|
||||||
usage_with_options(report_usage, options);
|
|
||||||
|
|
||||||
setup_pager();
|
setup_pager();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user