[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1382367819-19643-2-git-send-email-Waiman.Long@hp.com>
Date: Mon, 21 Oct 2013 11:03:37 -0400
From: Waiman Long <Waiman.Long@...com>
To: Ingo Molnar <mingo@...hat.com>,
Arnaldo Carvalho de Melo <acme@...stprotocols.net>
Cc: Peter Zijlstra <a.p.zijlstra@...llo.nl>,
Paul Mackerras <paulus@...ba.org>,
Namhyung Kim <namhyung@...nel.org>,
Jiri Olsa <jolsa@...hat.com>,
Adrian Hunter <adrian.hunter@...el.com>,
David Ahern <dsahern@...il.com>,
Stephane Eranian <eranian@...gle.com>,
linux-kernel@...r.kernel.org,
Aswin Chandramouleeswaran <aswin@...com>,
Scott J Norton <scott.norton@...com>,
Davidlohr Bueso <davidlohr@...com>,
Waiman Long <Waiman.Long@...com>
Subject: [PATCH v3 1/3] perf: streamline append_chain() function
When callgraph is enabled, the append_chain() function consumes a major
portion of the total CPU time. This patch tries to streamline the
append_chain() function by removing unneeded conditional test as well as
using ?: statement which can be more efficient than the regular if
statement in some architectures.
Signed-off-by: Waiman Long <Waiman.Long@...com>
---
tools/perf/util/callchain.c | 9 ++++-----
1 files changed, 4 insertions(+), 5 deletions(-)
diff --git a/tools/perf/util/callchain.c b/tools/perf/util/callchain.c
index 482f680..1e79001 100644
--- a/tools/perf/util/callchain.c
+++ b/tools/perf/util/callchain.c
@@ -315,6 +315,7 @@ append_chain(struct callchain_node *root,
struct callchain_list *cnode;
u64 start = cursor->pos;
bool found = false;
+ bool func_mode = (callchain_param.key == CCKEY_FUNCTION);
u64 matches;
/*
@@ -331,17 +332,15 @@ append_chain(struct callchain_node *root,
if (!node)
break;
- sym = node->sym;
+ sym = func_mode ? node->sym : NULL;
- if (cnode->ms.sym && sym &&
- callchain_param.key == CCKEY_FUNCTION) {
+ if (cnode->ms.sym && sym) {
if (cnode->ms.sym->start != sym->start)
break;
} else if (cnode->ip != node->ip)
break;
- if (!found)
- found = true;
+ found = true;
callchain_cursor_advance(cursor);
}
--
1.7.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists