[PATCH 6/9] perf, tools: Fix max stack handling with lbr-as-callgraph

From: Andi Kleen
Date: Sat Jan 11 2014 - 14:44:57 EST


From: Andi Kleen <ak@xxxxxxxxxxxxxxx>

The original lbr-as-callstack code ignored the maxium callgraph
length set by the user. Fix this.

Signed-off-by: Andi Kleen <ak@xxxxxxxxxxxxxxx>
---
tools/perf/util/machine.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c
index 4032634..853639c 100644
--- a/tools/perf/util/machine.c
+++ b/tools/perf/util/machine.c
@@ -1372,7 +1372,7 @@ static int machine__resolve_callchain_sample(struct machine *machine,
}

if (callchain_param.branch_callstack) {
- int nr = branch->nr;
+ int nr = min(max_stack, branch->nr);
struct branch_entry be[nr];

for (i = 0; i < nr; i++) {
@@ -1397,6 +1397,7 @@ static int machine__resolve_callchain_sample(struct machine *machine,
if (err)
return err;
}
+ chain_nr -= nr;
}

if (chain->nr > PERF_MAX_STACK_DEPTH) {
--
1.8.3.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/