Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 147554
b: refs/heads/master
c: 2d65537
h: refs/heads/master
v: v3
  • Loading branch information
Ingo Molnar committed May 27, 2009
1 parent b8b1a17 commit 9db7c05
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 11 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: 55e5ec41a9de46b6ca06031f4fbdfdfc76dc24dc
refs/heads/master: 2d65537ee7cd4a0818ea80a97ab7932368fff5cd
40 changes: 30 additions & 10 deletions trunk/Documentation/perf_counter/builtin-report.c
Original file line number Diff line number Diff line change
Expand Up @@ -708,6 +708,7 @@ struct sort_entry {
struct list_head list;

int64_t (*cmp)(struct hist_entry *, struct hist_entry *);
size_t (*print_header)(FILE *fp);
size_t (*print)(FILE *fp, struct hist_entry *);
};

Expand All @@ -722,7 +723,7 @@ sort__thread_print(FILE *fp, struct hist_entry *self)
{
char bf[32];

return fprintf(fp, "%14s ",
return fprintf(fp, " %16s",
thread__name(self->thread, bf, sizeof(bf)));
}

Expand Down Expand Up @@ -752,7 +753,7 @@ sort__comm_cmp(struct hist_entry *left, struct hist_entry *right)
static size_t
sort__comm_print(FILE *fp, struct hist_entry *self)
{
return fprintf(fp, "%20s ", self->thread->comm ?: "<unknown>");
return fprintf(fp, " %16s", self->thread->comm ?: "<unknown>");
}

static struct sort_entry sort_comm = {
Expand Down Expand Up @@ -781,7 +782,7 @@ sort__dso_cmp(struct hist_entry *left, struct hist_entry *right)
static size_t
sort__dso_print(FILE *fp, struct hist_entry *self)
{
return fprintf(fp, "%64s ", self->dso ? self->dso->name : "<unknown>");
return fprintf(fp, " %64s", self->dso ? self->dso->name : "<unknown>");
}

static struct sort_entry sort_dso = {
Expand All @@ -803,30 +804,43 @@ sort__sym_cmp(struct hist_entry *left, struct hist_entry *right)
return (int64_t)(ip_r - ip_l);
}

static size_t sort__sym_print_header(FILE *fp)
{
size_t ret = 0;

ret += fprintf(fp, "#\n");
ret += fprintf(fp, "# Overhead Command File: Symbol\n");
ret += fprintf(fp, "# ........ ....... ............\n");
ret += fprintf(fp, "#\n");

return ret;
}

static size_t
sort__sym_print(FILE *fp, struct hist_entry *self)
{
size_t ret = 0;

ret += fprintf(fp, "[%c] ", self->level);
ret += fprintf(fp, " [%c] ", self->level);

if (verbose)
ret += fprintf(fp, "%#018llx ", (unsigned long long)self->ip);
ret += fprintf(fp, " %#018llx", (unsigned long long)self->ip);

if (self->level != '.')
ret += fprintf(fp, "%s ",
ret += fprintf(fp, " kernel: %s",
self->sym ? self->sym->name : "<unknown>");
else
ret += fprintf(fp, "%s: %s ",
ret += fprintf(fp, " %s: %s",
self->dso ? self->dso->name : "<unknown>",
self->sym ? self->sym->name : "<unknown>");

return ret;
}

static struct sort_entry sort_sym = {
.cmp = sort__sym_cmp,
.print = sort__sym_print,
.cmp = sort__sym_cmp,
.print_header = sort__sym_print_header,
.print = sort__sym_print,
};

struct sort_dimension {
Expand Down Expand Up @@ -898,7 +912,7 @@ hist_entry__fprintf(FILE *fp, struct hist_entry *self, uint64_t total_samples)
size_t ret;

if (total_samples) {
ret = fprintf(fp, "%5.2f%% ",
ret = fprintf(fp, " %5.2f%%",
(self->count * 100.0) / total_samples);
} else
ret = fprintf(fp, "%12d ", self->count);
Expand Down Expand Up @@ -1003,9 +1017,15 @@ static void output__resort(void)
static size_t output__fprintf(FILE *fp, uint64_t total_samples)
{
struct hist_entry *pos;
struct sort_entry *se;
struct rb_node *nd;
size_t ret = 0;

list_for_each_entry(se, &hist_entry__sort_list, list) {
if (se->print_header)
ret += se->print_header(fp);
}

for (nd = rb_first(&output_hists); nd; nd = rb_next(nd)) {
pos = rb_entry(nd, struct hist_entry, rb_node);
ret += hist_entry__fprintf(fp, pos, total_samples);
Expand Down

0 comments on commit 9db7c05

Please sign in to comment.