summaryrefslogtreecommitdiffstats
path: root/tools/perf/util/sort.h
diff options
context:
space:
mode:
authorNamhyung Kim2013-10-31 02:17:39 +0100
committerJiri Olsa2014-06-01 14:35:02 +0200
commit14135663f1d770bb057f8bf345e5436c985eb29c (patch)
tree390e9bb413cf8b6fb65375d339ce26b0ea2b5315 /tools/perf/util/sort.h
parentperf ui/gtk: Add support to accumulated hist stat (diff)
downloadkernel-qcow2-linux-14135663f1d770bb057f8bf345e5436c985eb29c.tar.gz
kernel-qcow2-linux-14135663f1d770bb057f8bf345e5436c985eb29c.tar.xz
kernel-qcow2-linux-14135663f1d770bb057f8bf345e5436c985eb29c.zip
perf tools: Apply percent-limit to cumulative percentage
If -g cumulative option is given, it needs to show entries which don't have self overhead. So apply percent-limit to accumulated overhead percentage in this case. Signed-off-by: Namhyung Kim <namhyung@kernel.org> Tested-by: Arun Sharma <asharma@fb.com> Tested-by: Rodrigo Campos <rodrigo@sdfg.com.ar> Cc: Frederic Weisbecker <fweisbec@gmail.com> Link: http://lkml.kernel.org/r/1401335910-16832-14-git-send-email-namhyung@kernel.org Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Diffstat (limited to 'tools/perf/util/sort.h')
-rw-r--r--tools/perf/util/sort.h17
1 files changed, 16 insertions, 1 deletions
diff --git a/tools/perf/util/sort.h b/tools/perf/util/sort.h
index c9ffa031becd..426b873e16ff 100644
--- a/tools/perf/util/sort.h
+++ b/tools/perf/util/sort.h
@@ -20,7 +20,7 @@
#include "parse-options.h"
#include "parse-events.h"
-
+#include "hist.h"
#include "thread.h"
extern regex_t parent_regex;
@@ -131,6 +131,21 @@ static inline void hist_entry__add_pair(struct hist_entry *pair,
list_add_tail(&pair->pairs.node, &he->pairs.head);
}
+static inline float hist_entry__get_percent_limit(struct hist_entry *he)
+{
+ u64 period = he->stat.period;
+ u64 total_period = hists__total_period(he->hists);
+
+ if (unlikely(total_period == 0))
+ return 0;
+
+ if (symbol_conf.cumulate_callchain)
+ period = he->stat_acc->period;
+
+ return period * 100.0 / total_period;
+}
+
+
enum sort_mode {
SORT_MODE__NORMAL,
SORT_MODE__BRANCH,