Commit 01797c59 authored by Corey Ashford's avatar Corey Ashford Committed by Ingo Molnar

perf: Fix usages of profile_cpu in builtin-top.c to use cpu_list

profile_cpu was left over from an earlier implementation that
supported running perf top on a single CPU.  profile_cpu was no
longer set by any switch and usages of it resulted in dead code.

Instead, convert the code to use cpu_list, which is set by the
-C <cpu_list> option.

Also improved the printing of nr_cpus and cpu_list by correcting
the plurals.
Signed-off-by: default avatarCorey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: a.p.zijlstra@chello.nl
Cc: acme@redhat.com
LKML-Reference: <1289269245-9388-1-git-send-email-cjashfor@linux.vnet.ibm.com>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent a3da8e45
...@@ -69,7 +69,6 @@ static int target_tid = -1; ...@@ -69,7 +69,6 @@ static int target_tid = -1;
static pid_t *all_tids = NULL; static pid_t *all_tids = NULL;
static int thread_num = 0; static int thread_num = 0;
static bool inherit = false; static bool inherit = false;
static int profile_cpu = -1;
static int nr_cpus = 0; static int nr_cpus = 0;
static int realtime_prio = 0; static int realtime_prio = 0;
static bool group = false; static bool group = false;
...@@ -558,13 +557,13 @@ static void print_sym_table(void) ...@@ -558,13 +557,13 @@ static void print_sym_table(void)
else else
printf(" (all"); printf(" (all");
if (profile_cpu != -1) if (cpu_list)
printf(", cpu: %d)\n", profile_cpu); printf(", CPU%s: %s)\n", nr_cpus > 1 ? "s" : "", cpu_list);
else { else {
if (target_tid != -1) if (target_tid != -1)
printf(")\n"); printf(")\n");
else else
printf(", %d CPUs)\n", nr_cpus); printf(", %d CPU%s)\n", nr_cpus, nr_cpus > 1 ? "s" : "");
} }
printf("%-*.*s\n", win_width, win_width, graph_dotted_line); printf("%-*.*s\n", win_width, win_width, graph_dotted_line);
...@@ -1187,11 +1186,10 @@ int group_fd; ...@@ -1187,11 +1186,10 @@ int group_fd;
static void start_counter(int i, int counter) static void start_counter(int i, int counter)
{ {
struct perf_event_attr *attr; struct perf_event_attr *attr;
int cpu; int cpu = -1;
int thread_index; int thread_index;
cpu = profile_cpu; if (target_tid == -1)
if (target_tid == -1 && profile_cpu == -1)
cpu = cpumap[i]; cpu = cpumap[i];
attr = attrs + counter; attr = attrs + counter;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment