Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 191316
b: refs/heads/master
c: 232a5c9
h: refs/heads/master
v: v3
  • Loading branch information
Arnaldo Carvalho de Melo committed May 10, 2010
1 parent d1a1f45 commit 2169fcf
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 2 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: 1f626bc36847ac8dd192f055aed0f9678a781313
refs/heads/master: 232a5c948da5e23dff27e48180abf4a4238f7602
5 changes: 4 additions & 1 deletion trunk/tools/perf/builtin-report.c
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ static int
parse_callchain_opt(const struct option *opt __used, const char *arg,
int unset)
{
char *tok;
char *tok, *tok2;
char *endptr;

/*
Expand Down Expand Up @@ -388,10 +388,13 @@ parse_callchain_opt(const struct option *opt __used, const char *arg,
if (!tok)
goto setup;

tok2 = strtok(NULL, ",");
callchain_param.min_percent = strtod(tok, &endptr);
if (tok == endptr)
return -1;

if (tok2)
callchain_param.print_limit = strtod(tok2, &endptr);
setup:
if (register_callchain_param(&callchain_param) < 0) {
fprintf(stderr, "Can't register callchain params\n");
Expand Down
1 change: 1 addition & 0 deletions trunk/tools/perf/util/callchain.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ typedef void (*sort_chain_func_t)(struct rb_root *, struct callchain_node *,

struct callchain_param {
enum chain_mode mode;
u32 print_limit;
double min_percent;
sort_chain_func_t sort;
};
Expand Down
10 changes: 10 additions & 0 deletions trunk/tools/perf/util/hist.c
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,7 @@ static size_t __callchain__fprintf_graph(FILE *fp, struct callchain_node *self,
u64 remaining;
size_t ret = 0;
int i;
uint entries_printed = 0;

if (callchain_param.mode == CHAIN_GRAPH_REL)
new_total = self->children_hit;
Expand Down Expand Up @@ -379,6 +380,8 @@ static size_t __callchain__fprintf_graph(FILE *fp, struct callchain_node *self,
new_depth_mask | (1 << depth),
left_margin);
node = next;
if (++entries_printed == callchain_param.print_limit)
break;
}

if (callchain_param.mode == CHAIN_GRAPH_REL &&
Expand All @@ -404,6 +407,7 @@ static size_t callchain__fprintf_graph(FILE *fp, struct callchain_node *self,
bool printed = false;
int i = 0;
int ret = 0;
u32 entries_printed = 0;

list_for_each_entry(chain, &self->val, list) {
if (!i++ && sort__first_dimension == SORT_SYM)
Expand All @@ -424,6 +428,9 @@ static size_t callchain__fprintf_graph(FILE *fp, struct callchain_node *self,
ret += fprintf(fp, " %s\n", chain->ms.sym->name);
else
ret += fprintf(fp, " %p\n", (void *)(long)chain->ip);

if (++entries_printed == callchain_param.print_limit)
break;
}

ret += __callchain__fprintf_graph(fp, self, total_samples, 1, 1, left_margin);
Expand Down Expand Up @@ -462,6 +469,7 @@ static size_t hist_entry_callchain__fprintf(FILE *fp, struct hist_entry *self,
struct rb_node *rb_node;
struct callchain_node *chain;
size_t ret = 0;
u32 entries_printed = 0;

rb_node = rb_first(&self->sorted_chain);
while (rb_node) {
Expand All @@ -484,6 +492,8 @@ static size_t hist_entry_callchain__fprintf(FILE *fp, struct hist_entry *self,
break;
}
ret += fprintf(fp, "\n");
if (++entries_printed == callchain_param.print_limit)
break;
rb_node = rb_next(rb_node);
}

Expand Down

0 comments on commit 2169fcf

Please sign in to comment.