Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 333945
b: refs/heads/master
c: 73bdc71
h: refs/heads/master
i:
  333943: e3fb0df
v: v3
  • Loading branch information
Arnaldo Carvalho de Melo committed Oct 2, 2012
1 parent 5b5e5f3 commit a41542d
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 60 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: c75d98afa7bb059169587b838e0a25436b8d3e62
refs/heads/master: 73bdc7159b0a83146fa8d1b8df7baf1cea992d4c
100 changes: 41 additions & 59 deletions trunk/tools/perf/builtin-timechart.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,6 @@
#define PWR_EVENT_EXIT -1


static const char *input_name;
static const char *output_name = "output.svg";

static unsigned int numcpus;
static u64 min_freq; /* Lowest CPU frequency seen */
static u64 max_freq; /* Highest CPU frequency seen */
Expand Down Expand Up @@ -968,16 +965,15 @@ static void write_svg_file(const char *filename)
svg_close();
}

static struct perf_tool perf_timechart = {
.comm = process_comm_event,
.fork = process_fork_event,
.exit = process_exit_event,
.sample = process_sample_event,
.ordered_samples = true,
};

static int __cmd_timechart(void)
static int __cmd_timechart(const char *input_name, const char *output_name)
{
struct perf_tool perf_timechart = {
.comm = process_comm_event,
.fork = process_fork_event,
.exit = process_exit_event,
.sample = process_sample_event,
.ordered_samples = true,
};
struct perf_session *session = perf_session__new(input_name, O_RDONLY,
0, false, &perf_timechart);
int ret = -EINVAL;
Expand Down Expand Up @@ -1005,40 +1001,25 @@ static int __cmd_timechart(void)
return ret;
}

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

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

static const char * const record_new_args[] = {
"record",
"-a",
"-R",
"-f",
"-c", "1",
"-e", "power:cpu_frequency",
"-e", "power:cpu_idle",
"-e", "sched:sched_wakeup",
"-e", "sched:sched_switch",
};

static int __cmd_record(int argc, const char **argv)
{
#ifdef SUPPORT_OLD_POWER_EVENTS
const char * const record_old_args[] = {
"record", "-a", "-R", "-f", "-c", "1",
"-e", "power:power_start",
"-e", "power:power_end",
"-e", "power:power_frequency",
"-e", "sched:sched_wakeup",
"-e", "sched:sched_switch",
};
#endif
const char * const record_new_args[] = {
"record", "-a", "-R", "-f", "-c", "1",
"-e", "power:cpu_frequency",
"-e", "power:cpu_idle",
"-e", "sched:sched_wakeup",
"-e", "sched:sched_switch",
};
unsigned int rec_argc, i, j;
const char **rec_argv;
const char * const *record_args = record_new_args;
Expand Down Expand Up @@ -1077,27 +1058,28 @@ parse_process(const struct option *opt __maybe_unused, const char *arg,
return 0;
}

static const struct option options[] = {
OPT_STRING('i', "input", &input_name, "file",
"input file name"),
OPT_STRING('o', "output", &output_name, "file",
"output file name"),
OPT_INTEGER('w', "width", &svg_page_width,
"page width"),
OPT_BOOLEAN('P', "power-only", &power_only,
"output power data only"),
int cmd_timechart(int argc, const char **argv,
const char *prefix __maybe_unused)
{
const char *input_name;
const char *output_name = "output.svg";
const struct option options[] = {
OPT_STRING('i', "input", &input_name, "file", "input file name"),
OPT_STRING('o', "output", &output_name, "file", "output file name"),
OPT_INTEGER('w', "width", &svg_page_width, "page width"),
OPT_BOOLEAN('P', "power-only", &power_only, "output power data only"),
OPT_CALLBACK('p', "process", NULL, "process",
"process selector. Pass a pid or process name.",
parse_process),
OPT_STRING(0, "symfs", &symbol_conf.symfs, "directory",
"Look for files with symbols relative to this directory"),
OPT_END()
};

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

int cmd_timechart(int argc, const char **argv,
const char *prefix __maybe_unused)
{
argc = parse_options(argc, argv, options, timechart_usage,
PARSE_OPT_STOP_AT_NON_OPTION);

Expand All @@ -1110,5 +1092,5 @@ int cmd_timechart(int argc, const char **argv,

setup_pager();

return __cmd_timechart();
return __cmd_timechart(input_name, output_name);
}

0 comments on commit a41542d

Please sign in to comment.