aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/builtin-top.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/perf/builtin-top.c')
-rw-r--r--tools/perf/builtin-top.c24
1 files changed, 9 insertions, 15 deletions
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index 9acca8856ccb..b8f8e29db332 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -950,14 +950,8 @@ static int __cmd_top(struct perf_top *top)
950 if (ret) 950 if (ret)
951 goto out_delete; 951 goto out_delete;
952 952
953 if (perf_target__has_task(&opts->target)) 953 machine__synthesize_threads(&top->session->machines.host, &opts->target,
954 perf_event__synthesize_thread_map(&top->tool, top->evlist->threads, 954 top->evlist->threads, false);
955 perf_event__process,
956 &top->session->machines.host);
957 else
958 perf_event__synthesize_threads(&top->tool, perf_event__process,
959 &top->session->machines.host);
960
961 ret = perf_top__start_counters(top); 955 ret = perf_top__start_counters(top);
962 if (ret) 956 if (ret)
963 goto out_delete; 957 goto out_delete;
@@ -973,7 +967,7 @@ static int __cmd_top(struct perf_top *top)
973 * XXX 'top' still doesn't start workloads like record, trace, but should, 967 * XXX 'top' still doesn't start workloads like record, trace, but should,
974 * so leave the check here. 968 * so leave the check here.
975 */ 969 */
976 if (!perf_target__none(&opts->target)) 970 if (!target__none(&opts->target))
977 perf_evlist__enable(top->evlist); 971 perf_evlist__enable(top->evlist);
978 972
979 /* Wait for a minimal set of events before starting the snapshot */ 973 /* Wait for a minimal set of events before starting the snapshot */
@@ -1059,7 +1053,7 @@ int cmd_top(int argc, const char **argv, const char *prefix __maybe_unused)
1059 .sym_pcnt_filter = 5, 1053 .sym_pcnt_filter = 5,
1060 }; 1054 };
1061 struct perf_record_opts *opts = &top.record_opts; 1055 struct perf_record_opts *opts = &top.record_opts;
1062 struct perf_target *target = &opts->target; 1056 struct target *target = &opts->target;
1063 const struct option options[] = { 1057 const struct option options[] = {
1064 OPT_CALLBACK('e', "event", &top.evlist, "event", 1058 OPT_CALLBACK('e', "event", &top.evlist, "event",
1065 "event selector. use 'perf list' to list available events", 1059 "event selector. use 'perf list' to list available events",
@@ -1175,24 +1169,24 @@ int cmd_top(int argc, const char **argv, const char *prefix __maybe_unused)
1175 1169
1176 setup_browser(false); 1170 setup_browser(false);
1177 1171
1178 status = perf_target__validate(target); 1172 status = target__validate(target);
1179 if (status) { 1173 if (status) {
1180 perf_target__strerror(target, status, errbuf, BUFSIZ); 1174 target__strerror(target, status, errbuf, BUFSIZ);
1181 ui__warning("%s", errbuf); 1175 ui__warning("%s", errbuf);
1182 } 1176 }
1183 1177
1184 status = perf_target__parse_uid(target); 1178 status = target__parse_uid(target);
1185 if (status) { 1179 if (status) {
1186 int saved_errno = errno; 1180 int saved_errno = errno;
1187 1181
1188 perf_target__strerror(target, status, errbuf, BUFSIZ); 1182 target__strerror(target, status, errbuf, BUFSIZ);
1189 ui__error("%s", errbuf); 1183 ui__error("%s", errbuf);
1190 1184
1191 status = -saved_errno; 1185 status = -saved_errno;
1192 goto out_delete_evlist; 1186 goto out_delete_evlist;
1193 } 1187 }
1194 1188
1195 if (perf_target__none(target)) 1189 if (target__none(target))
1196 target->system_wide = true; 1190 target->system_wide = true;
1197 1191
1198 if (perf_evlist__create_maps(top.evlist, target) < 0) 1192 if (perf_evlist__create_maps(top.evlist, target) < 0)