From: Andi Kleen <a...@linux.intel.com>

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

Signed-off-by: Andi Kleen <a...@linux.intel.com>
---
 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 majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to