perf tools: Add support to dynamically get cacheline size
authorDon Zickus <dzickus@redhat.com>
Fri, 30 May 2014 20:10:05 +0000 (16:10 -0400)
committerJiri Olsa <jolsa@kernel.org>
Mon, 9 Jun 2014 11:34:48 +0000 (13:34 +0200)
Different arches may have different cacheline sizes.  Look it up and set
a global variable for reference.

Signed-off-by: Don Zickus <dzickus@redhat.com>
Link: http://lkml.kernel.org/r/1401480605-97442-1-git-send-email-dzickus@redhat.com
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
tools/perf/perf.c
tools/perf/util/util.c
tools/perf/util/util.h

index 78f7b920e5483a1982dd4d164588b689e1b29e6d..95c58fc15284e58ce4e9d744028e52814b9bde3d 100644 (file)
@@ -458,6 +458,7 @@ int main(int argc, const char **argv)
 
        /* The page_size is placed in util object. */
        page_size = sysconf(_SC_PAGE_SIZE);
+       cacheline_size = sysconf(_SC_LEVEL1_DCACHE_LINESIZE);
 
        cmd = perf_extract_argv0_path(argv[0]);
        if (!cmd)
index 7fff6be07f07337e61e7165fdeaa60bdb8e82684..95aefa78bb075a52491b892f7ddccc259d909799 100644 (file)
@@ -17,6 +17,7 @@
  * XXX We need to find a better place for these things...
  */
 unsigned int page_size;
+int cacheline_size;
 
 bool test_attr__enabled;
 
index b03da44e94e4d53517fc398d6b993953549182cb..66864364ccb482230e203b5369ee1fe004fadf78 100644 (file)
@@ -304,6 +304,7 @@ char *rtrim(char *s);
 void dump_stack(void);
 
 extern unsigned int page_size;
+extern int cacheline_size;
 
 void get_term_dimensions(struct winsize *ws);