[PATCH 03/11] perf tools: Introduce cl_offset function

From: Arnaldo Carvalho de Melo
Date: Tue Feb 23 2016 - 15:03:13 EST


From: Jiri Olsa <jolsa@xxxxxxxxxx>

It'll be used in following patches.

Signed-off-by: Jiri Olsa <jolsa@xxxxxxxxxx>
Cc: Andi Kleen <ak@xxxxxxxxxxxxxxx>
Cc: David Ahern <dsahern@xxxxxxxxx>
Cc: Namhyung Kim <namhyung@xxxxxxxxxx>
Cc: Peter Zijlstra <a.p.zijlstra@xxxxxxxxx>
Cc: Stephane Eranian <eranian@xxxxxxxxxx>
Link: http://lkml.kernel.org/r/1455525293-8671-4-git-send-email-jolsa@xxxxxxxxxx
Signed-off-by: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>
---
tools/perf/util/sort.h | 6 ++++++
1 file changed, 6 insertions(+)

diff --git a/tools/perf/util/sort.h b/tools/perf/util/sort.h
index 46f159f9d947..5b9c6246de6d 100644
--- a/tools/perf/util/sort.h
+++ b/tools/perf/util/sort.h
@@ -168,6 +168,12 @@ static inline u64 cl_address(u64 address)
return (address & ~(cacheline_size - 1));
}

+static inline u64 cl_offset(u64 address)
+{
+ /* return the cacheline of the address */
+ return (address & (cacheline_size - 1));
+}
+
enum sort_mode {
SORT_MODE__NORMAL,
SORT_MODE__BRANCH,
--
2.5.0