diff options
author | Namhyung Kim <namhyung.kim@lge.com> | 2012-04-26 01:15:17 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2012-05-02 14:20:30 -0400 |
commit | fe9d18a71d2018f8021fd2bd2aaf5137954ef839 (patch) | |
tree | e0cb4b12af0a7660d97e7b2e1f2c341e524e8f07 /tools/perf/builtin-top.c | |
parent | 20f946b4a49dfd89c1c4ddeb55c0632893332674 (diff) |
perf top: Convert to struct perf_target
Use struct perf_target as it is introduced by previous patch.
This is a preparation of further changes.
Signed-off-by: Namhyung Kim <namhyung.kim@lge.com>
Reviewed-by: David Ahern <dsahern@gmail.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Namhyung Kim <namhyung@gmail.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1335417327-11796-4-git-send-email-namhyung.kim@lge.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/builtin-top.c')
-rw-r--r-- | tools/perf/builtin-top.c | 33 |
1 files changed, 17 insertions, 16 deletions
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c index 8ef59f8262bb..2c1c207627b4 100644 --- a/tools/perf/builtin-top.c +++ b/tools/perf/builtin-top.c | |||
@@ -588,7 +588,7 @@ static void *display_thread_tui(void *arg) | |||
588 | * via --uid. | 588 | * via --uid. |
589 | */ | 589 | */ |
590 | list_for_each_entry(pos, &top->evlist->entries, node) | 590 | list_for_each_entry(pos, &top->evlist->entries, node) |
591 | pos->hists.uid_filter_str = top->uid_str; | 591 | pos->hists.uid_filter_str = top->target.uid_str; |
592 | 592 | ||
593 | perf_evlist__tui_browse_hists(top->evlist, help, | 593 | perf_evlist__tui_browse_hists(top->evlist, help, |
594 | perf_top__sort_new_samples, | 594 | perf_top__sort_new_samples, |
@@ -1016,7 +1016,7 @@ static int __cmd_top(struct perf_top *top) | |||
1016 | if (ret) | 1016 | if (ret) |
1017 | goto out_delete; | 1017 | goto out_delete; |
1018 | 1018 | ||
1019 | if (top->target_tid || top->uid != UINT_MAX) | 1019 | if (top->target.tid || top->target.uid != UINT_MAX) |
1020 | perf_event__synthesize_thread_map(&top->tool, top->evlist->threads, | 1020 | perf_event__synthesize_thread_map(&top->tool, top->evlist->threads, |
1021 | perf_event__process, | 1021 | perf_event__process, |
1022 | &top->session->host_machine); | 1022 | &top->session->host_machine); |
@@ -1154,7 +1154,6 @@ int cmd_top(int argc, const char **argv, const char *prefix __used) | |||
1154 | struct perf_top top = { | 1154 | struct perf_top top = { |
1155 | .count_filter = 5, | 1155 | .count_filter = 5, |
1156 | .delay_secs = 2, | 1156 | .delay_secs = 2, |
1157 | .uid = UINT_MAX, | ||
1158 | .freq = 1000, /* 1 KHz */ | 1157 | .freq = 1000, /* 1 KHz */ |
1159 | .mmap_pages = 128, | 1158 | .mmap_pages = 128, |
1160 | .sym_pcnt_filter = 5, | 1159 | .sym_pcnt_filter = 5, |
@@ -1166,13 +1165,13 @@ int cmd_top(int argc, const char **argv, const char *prefix __used) | |||
1166 | parse_events_option), | 1165 | parse_events_option), |
1167 | OPT_INTEGER('c', "count", &top.default_interval, | 1166 | OPT_INTEGER('c', "count", &top.default_interval, |
1168 | "event period to sample"), | 1167 | "event period to sample"), |
1169 | OPT_STRING('p', "pid", &top.target_pid, "pid", | 1168 | OPT_STRING('p', "pid", &top.target.pid, "pid", |
1170 | "profile events on existing process id"), | 1169 | "profile events on existing process id"), |
1171 | OPT_STRING('t', "tid", &top.target_tid, "tid", | 1170 | OPT_STRING('t', "tid", &top.target.tid, "tid", |
1172 | "profile events on existing thread id"), | 1171 | "profile events on existing thread id"), |
1173 | OPT_BOOLEAN('a', "all-cpus", &top.system_wide, | 1172 | OPT_BOOLEAN('a', "all-cpus", &top.target.system_wide, |
1174 | "system-wide collection from all CPUs"), | 1173 | "system-wide collection from all CPUs"), |
1175 | OPT_STRING('C', "cpu", &top.cpu_list, "cpu", | 1174 | OPT_STRING('C', "cpu", &top.target.cpu_list, "cpu", |
1176 | "list of cpus to monitor"), | 1175 | "list of cpus to monitor"), |
1177 | OPT_STRING('k', "vmlinux", &symbol_conf.vmlinux_name, | 1176 | OPT_STRING('k', "vmlinux", &symbol_conf.vmlinux_name, |
1178 | "file", "vmlinux pathname"), | 1177 | "file", "vmlinux pathname"), |
@@ -1227,7 +1226,7 @@ int cmd_top(int argc, const char **argv, const char *prefix __used) | |||
1227 | "Display raw encoding of assembly instructions (default)"), | 1226 | "Display raw encoding of assembly instructions (default)"), |
1228 | OPT_STRING('M', "disassembler-style", &disassembler_style, "disassembler style", | 1227 | OPT_STRING('M', "disassembler-style", &disassembler_style, "disassembler style", |
1229 | "Specify disassembler style (e.g. -M intel for intel syntax)"), | 1228 | "Specify disassembler style (e.g. -M intel for intel syntax)"), |
1230 | OPT_STRING('u', "uid", &top.uid_str, "user", "user to profile"), | 1229 | OPT_STRING('u', "uid", &top.target.uid_str, "user", "user to profile"), |
1231 | OPT_END() | 1230 | OPT_END() |
1232 | }; | 1231 | }; |
1233 | 1232 | ||
@@ -1253,22 +1252,24 @@ int cmd_top(int argc, const char **argv, const char *prefix __used) | |||
1253 | 1252 | ||
1254 | setup_browser(false); | 1253 | setup_browser(false); |
1255 | 1254 | ||
1256 | top.uid = parse_target_uid(top.uid_str, top.target_tid, top.target_pid); | 1255 | top.target.uid = parse_target_uid(top.target.uid_str, top.target.tid, |
1257 | if (top.uid_str != NULL && top.uid == UINT_MAX - 1) | 1256 | top.target.pid); |
1257 | if (top.target.uid_str != NULL && top.target.uid == UINT_MAX - 1) | ||
1258 | goto out_delete_evlist; | 1258 | goto out_delete_evlist; |
1259 | 1259 | ||
1260 | /* CPU and PID are mutually exclusive */ | 1260 | /* CPU and PID are mutually exclusive */ |
1261 | if (top.target_tid && top.cpu_list) { | 1261 | if (top.target.tid && top.target.cpu_list) { |
1262 | printf("WARNING: PID switch overriding CPU\n"); | 1262 | printf("WARNING: PID switch overriding CPU\n"); |
1263 | sleep(1); | 1263 | sleep(1); |
1264 | top.cpu_list = NULL; | 1264 | top.target.cpu_list = NULL; |
1265 | } | 1265 | } |
1266 | 1266 | ||
1267 | if (top.target_pid) | 1267 | if (top.target.pid) |
1268 | top.target_tid = top.target_pid; | 1268 | top.target.tid = top.target.pid; |
1269 | 1269 | ||
1270 | if (perf_evlist__create_maps(top.evlist, top.target_pid, | 1270 | if (perf_evlist__create_maps(top.evlist, top.target.pid, |
1271 | top.target_tid, top.uid, top.cpu_list) < 0) | 1271 | top.target.tid, top.target.uid, |
1272 | top.target.cpu_list) < 0) | ||
1272 | usage_with_options(top_usage, options); | 1273 | usage_with_options(top_usage, options); |
1273 | 1274 | ||
1274 | if (!top.evlist->nr_entries && | 1275 | if (!top.evlist->nr_entries && |