aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tools/perf/util/callchain.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/tools/perf/util/callchain.c b/tools/perf/util/callchain.c
index 9eb4f57f8663..662867d5c374 100644
--- a/tools/perf/util/callchain.c
+++ b/tools/perf/util/callchain.c
@@ -15,6 +15,8 @@
15#include <errno.h> 15#include <errno.h>
16#include <math.h> 16#include <math.h>
17 17
18#include "asm/bug.h"
19
18#include "hist.h" 20#include "hist.h"
19#include "util.h" 21#include "util.h"
20#include "sort.h" 22#include "sort.h"
@@ -358,19 +360,14 @@ append_chain_children(struct callchain_node *root,
358 /* lookup in childrens */ 360 /* lookup in childrens */
359 while (*p) { 361 while (*p) {
360 s64 ret; 362 s64 ret;
361 struct callchain_list *cnode;
362 363
363 parent = *p; 364 parent = *p;
364 rnode = rb_entry(parent, struct callchain_node, rb_node_in); 365 rnode = rb_entry(parent, struct callchain_node, rb_node_in);
365 cnode = list_first_entry(&rnode->val, struct callchain_list,
366 list);
367 366
368 /* just check first entry */ 367 /* If at least first entry matches, rely to children */
369 ret = match_chain(node, cnode); 368 ret = append_chain(rnode, cursor, period);
370 if (ret == 0) { 369 if (ret == 0)
371 append_chain(rnode, cursor, period);
372 goto inc_children_hit; 370 goto inc_children_hit;
373 }
374 371
375 if (ret < 0) 372 if (ret < 0)
376 p = &parent->rb_left; 373 p = &parent->rb_left;
@@ -396,6 +393,7 @@ append_chain(struct callchain_node *root,
396 u64 start = cursor->pos; 393 u64 start = cursor->pos;
397 bool found = false; 394 bool found = false;
398 u64 matches; 395 u64 matches;
396 int cmp = 0;
399 397
400 /* 398 /*
401 * Lookup in the current node 399 * Lookup in the current node
@@ -410,7 +408,8 @@ append_chain(struct callchain_node *root,
410 if (!node) 408 if (!node)
411 break; 409 break;
412 410
413 if (match_chain(node, cnode) != 0) 411 cmp = match_chain(node, cnode);
412 if (cmp)
414 break; 413 break;
415 414
416 found = true; 415 found = true;
@@ -420,9 +419,10 @@ append_chain(struct callchain_node *root,
420 419
421 /* matches not, relay no the parent */ 420 /* matches not, relay no the parent */
422 if (!found) { 421 if (!found) {
422 WARN_ONCE(!cmp, "Chain comparison error\n");
423 cursor->curr = curr_snap; 423 cursor->curr = curr_snap;
424 cursor->pos = start; 424 cursor->pos = start;
425 return -1; 425 return cmp;
426 } 426 }
427 427
428 matches = cursor->pos - start; 428 matches = cursor->pos - start;