Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 147496
b: refs/heads/master
c: d94b943
h: refs/heads/master
v: v3
  • Loading branch information
Mike Galbraith authored and Ingo Molnar committed May 25, 2009
1 parent 6ec8445 commit 3d6c844
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 27 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: 85a9f9200226ddffc2ea50dae6a8df04c033ecd4
refs/heads/master: d94b943054721c346b0881865d645f000cd19880
54 changes: 28 additions & 26 deletions trunk/Documentation/perf_counter/builtin-top.c
Original file line number Diff line number Diff line change
Expand Up @@ -374,18 +374,26 @@ static struct sym_entry tmp[MAX_SYMS];

static void print_sym_table(void)
{
int i, printed;
int i, j, active_count, printed;
int counter;
float events_per_sec = events/delay_secs;
float kevents_per_sec = (events-userspace_events)/delay_secs;
float sum_kevents = 0.0;

events = userspace_events = 0;
memcpy(tmp, sym_table, sizeof(sym_table[0])*sym_table_count);
qsort(tmp, sym_table_count, sizeof(tmp[0]), compare);

for (i = 0; i < sym_table_count && tmp[i].count[0]; i++)
sum_kevents += tmp[i].count[0];
/* Iterate over symbol table and copy/tally/decay active symbols. */
for (i = 0, active_count = 0; i < sym_table_count; i++) {
if (sym_table[i].count[0]) {
tmp[active_count++] = sym_table[i];
sum_kevents += sym_table[i].count[0];

for (j = 0; j < nr_counters; j++)
sym_table[i].count[j] = zero ? 0 : sym_table[i].count[j] * 7 / 8;
}
}

qsort(tmp, active_count + 1, sizeof(tmp[0]), compare);

write(1, CONSOLE_CLEAR, strlen(CONSOLE_CLEAR));

Expand Down Expand Up @@ -433,29 +441,23 @@ static void print_sym_table(void)
" ______ ______ _____ ________________ _______________\n\n"
);

for (i = 0, printed = 0; i < sym_table_count; i++) {
for (i = 0, printed = 0; i < active_count; i++) {
float pcnt;
int count;

if (printed <= 18 && tmp[i].count[0] >= count_filter) {
pcnt = 100.0 - (100.0*((sum_kevents-tmp[i].count[0])/sum_kevents));

if (nr_counters == 1)
printf("%19.2f - %4.1f%% - %016llx : %s\n",
sym_weight(tmp + i),
pcnt, tmp[i].addr, tmp[i].sym);
else
printf("%8.1f %10ld - %4.1f%% - %016llx : %s\n",
sym_weight(tmp + i),
tmp[i].count[0],
pcnt, tmp[i].addr, tmp[i].sym);
printed++;
}
/*
* Add decay to the counts:
*/
for (count = 0; count < nr_counters; count++)
sym_table[i].count[count] = zero ? 0 : sym_table[i].count[count] * 7 / 8;
if (++printed > 18 || tmp[i].count[0] < count_filter)
break;

pcnt = 100.0 - (100.0*((sum_kevents-tmp[i].count[0])/sum_kevents));

if (nr_counters == 1)
printf("%19.2f - %4.1f%% - %016llx : %s\n",
sym_weight(tmp + i),
pcnt, tmp[i].addr, tmp[i].sym);
else
printf("%8.1f %10ld - %4.1f%% - %016llx : %s\n",
sym_weight(tmp + i),
tmp[i].count[0],
pcnt, tmp[i].addr, tmp[i].sym);
}

if (sym_filter_entry)
Expand Down

0 comments on commit 3d6c844

Please sign in to comment.