aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation/perf_counter/builtin-top.c
diff options
context:
space:
mode:
Diffstat (limited to 'Documentation/perf_counter/builtin-top.c')
-rw-r--r--Documentation/perf_counter/builtin-top.c46
1 files changed, 23 insertions, 23 deletions
diff --git a/Documentation/perf_counter/builtin-top.c b/Documentation/perf_counter/builtin-top.c
index 2fee5951b231..ff7e13c4647c 100644
--- a/Documentation/perf_counter/builtin-top.c
+++ b/Documentation/perf_counter/builtin-top.c
@@ -137,8 +137,8 @@ static double sym_weight(const struct sym_entry *sym)
137 return weight; 137 return weight;
138} 138}
139 139
140static long events; 140static long samples;
141static long userspace_events; 141static long userspace_samples;
142static const char CONSOLE_CLEAR[] = ""; 142static const char CONSOLE_CLEAR[] = "";
143 143
144static void __list_insert_active_sym(struct sym_entry *syme) 144static void __list_insert_active_sym(struct sym_entry *syme)
@@ -177,14 +177,14 @@ static void print_sym_table(void)
177{ 177{
178 int printed = 0, j; 178 int printed = 0, j;
179 int counter; 179 int counter;
180 float events_per_sec = events/delay_secs; 180 float samples_per_sec = samples/delay_secs;
181 float kevents_per_sec = (events-userspace_events)/delay_secs; 181 float ksamples_per_sec = (samples-userspace_samples)/delay_secs;
182 float sum_kevents = 0.0; 182 float sum_ksamples = 0.0;
183 struct sym_entry *syme, *n; 183 struct sym_entry *syme, *n;
184 struct rb_root tmp = RB_ROOT; 184 struct rb_root tmp = RB_ROOT;
185 struct rb_node *nd; 185 struct rb_node *nd;
186 186
187 events = userspace_events = 0; 187 samples = userspace_samples = 0;
188 188
189 /* Sort the active symbols */ 189 /* Sort the active symbols */
190 pthread_mutex_lock(&active_symbols_lock); 190 pthread_mutex_lock(&active_symbols_lock);
@@ -196,7 +196,7 @@ static void print_sym_table(void)
196 if (syme->snap_count != 0) { 196 if (syme->snap_count != 0) {
197 syme->weight = sym_weight(syme); 197 syme->weight = sym_weight(syme);
198 rb_insert_active_sym(&tmp, syme); 198 rb_insert_active_sym(&tmp, syme);
199 sum_kevents += syme->snap_count; 199 sum_ksamples += syme->snap_count;
200 200
201 for (j = 0; j < nr_counters; j++) 201 for (j = 0; j < nr_counters; j++)
202 syme->count[j] = zero ? 0 : syme->count[j] * 7 / 8; 202 syme->count[j] = zero ? 0 : syme->count[j] * 7 / 8;
@@ -209,8 +209,8 @@ static void print_sym_table(void)
209 printf( 209 printf(
210"------------------------------------------------------------------------------\n"); 210"------------------------------------------------------------------------------\n");
211 printf( " PerfTop:%8.0f irqs/sec kernel:%4.1f%% [", 211 printf( " PerfTop:%8.0f irqs/sec kernel:%4.1f%% [",
212 events_per_sec, 212 samples_per_sec,
213 100.0 - (100.0*((events_per_sec-kevents_per_sec)/events_per_sec))); 213 100.0 - (100.0*((samples_per_sec-ksamples_per_sec)/samples_per_sec)));
214 214
215 if (nr_counters == 1) { 215 if (nr_counters == 1) {
216 printf("%d", event_count[0]); 216 printf("%d", event_count[0]);
@@ -246,12 +246,12 @@ static void print_sym_table(void)
246 printf("------------------------------------------------------------------------------\n\n"); 246 printf("------------------------------------------------------------------------------\n\n");
247 247
248 if (nr_counters == 1) 248 if (nr_counters == 1)
249 printf(" events pcnt"); 249 printf(" samples pcnt");
250 else 250 else
251 printf(" weight events pcnt"); 251 printf(" weight samples pcnt");
252 252
253 printf(" RIP kernel function\n" 253 printf(" RIP kernel function\n"
254 " ______ ______ _____ ________________ _______________\n\n" 254 " ______ _______ _____ ________________ _______________\n\n"
255 ); 255 );
256 256
257 for (nd = rb_first(&tmp); nd; nd = rb_next(nd)) { 257 for (nd = rb_first(&tmp); nd; nd = rb_next(nd)) {
@@ -263,8 +263,8 @@ static void print_sym_table(void)
263 if (++printed > print_entries || syme->snap_count < count_filter) 263 if (++printed > print_entries || syme->snap_count < count_filter)
264 continue; 264 continue;
265 265
266 pcnt = 100.0 - (100.0 * ((sum_kevents - syme->snap_count) / 266 pcnt = 100.0 - (100.0 * ((sum_ksamples - syme->snap_count) /
267 sum_kevents)); 267 sum_ksamples));
268 268
269 /* 269 /*
270 * We color high-overhead entries in red, low-overhead 270 * We color high-overhead entries in red, low-overhead
@@ -276,9 +276,9 @@ static void print_sym_table(void)
276 color = PERF_COLOR_GREEN; 276 color = PERF_COLOR_GREEN;
277 277
278 if (nr_counters == 1) 278 if (nr_counters == 1)
279 printf("%19.2f - ", syme->weight); 279 printf("%20.2f - ", syme->weight);
280 else 280 else
281 printf("%8.1f %10ld - ", syme->weight, syme->snap_count); 281 printf("%9.1f %10ld - ", syme->weight, syme->snap_count);
282 282
283 color_fprintf(stdout, color, "%4.1f%%", pcnt); 283 color_fprintf(stdout, color, "%4.1f%%", pcnt);
284 printf(" - %016llx : %s\n", sym->start, sym->name); 284 printf(" - %016llx : %s\n", sym->start, sym->name);
@@ -318,7 +318,7 @@ static int symbol_filter(struct dso *self, struct symbol *sym)
318 return 1; 318 return 1;
319 319
320 syme = dso__sym_priv(self, sym); 320 syme = dso__sym_priv(self, sym);
321 /* Tag events to be skipped. */ 321 /* Tag samples to be skipped. */
322 if (!strcmp("default_idle", name) || 322 if (!strcmp("default_idle", name) ||
323 !strcmp("cpu_idle", name) || 323 !strcmp("cpu_idle", name) ||
324 !strcmp("enter_idle", name) || 324 !strcmp("enter_idle", name) ||
@@ -405,15 +405,15 @@ static void record_ip(uint64_t ip, int counter)
405 } 405 }
406 } 406 }
407 407
408 events--; 408 samples--;
409} 409}
410 410
411static void process_event(uint64_t ip, int counter) 411static void process_event(uint64_t ip, int counter)
412{ 412{
413 events++; 413 samples++;
414 414
415 if (ip < min_ip || ip > max_ip) { 415 if (ip < min_ip || ip > max_ip) {
416 userspace_events++; 416 userspace_samples++;
417 return; 417 return;
418 } 418 }
419 419
@@ -451,7 +451,7 @@ static void mmap_read(struct mmap_data *md)
451 451
452 /* 452 /*
453 * If we're further behind than half the buffer, there's a chance 453 * If we're further behind than half the buffer, there's a chance
454 * the writer will bite our tail and screw up the events under us. 454 * the writer will bite our tail and mess up the samples under us.
455 * 455 *
456 * If we somehow ended up ahead of the head, we got messed up. 456 * If we somehow ended up ahead of the head, we got messed up.
457 * 457 *
@@ -608,14 +608,14 @@ static int __cmd_top(void)
608 } 608 }
609 609
610 while (1) { 610 while (1) {
611 int hits = events; 611 int hits = samples;
612 612
613 for (i = 0; i < nr_cpus; i++) { 613 for (i = 0; i < nr_cpus; i++) {
614 for (counter = 0; counter < nr_counters; counter++) 614 for (counter = 0; counter < nr_counters; counter++)
615 mmap_read(&mmap_array[i][counter]); 615 mmap_read(&mmap_array[i][counter]);
616 } 616 }
617 617
618 if (hits == events) 618 if (hits == samples)
619 ret = poll(event_array, nr_poll, 100); 619 ret = poll(event_array, nr_poll, 100);
620 } 620 }
621 621