summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorDon Zickus <dzickus@redhat.com>2014-05-31 00:10:05 +0400
committerJiri Olsa <jolsa@kernel.org>2014-06-09 15:34:48 +0400
commit2b1b71003ea809e619bd73e74dfc2a73069de66f (patch)
tree314e28161d9cebf3630eaf46b9096abb73e3316a /tools
parent7365be55eee37ddb4f487263b4ba5bc8beb9638f (diff)
downloadlinux-2b1b71003ea809e619bd73e74dfc2a73069de66f.tar.xz
perf tools: Add support to dynamically get cacheline size
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>
Diffstat (limited to 'tools')
-rw-r--r--tools/perf/perf.c1
-rw-r--r--tools/perf/util/util.c1
-rw-r--r--tools/perf/util/util.h1
3 files changed, 3 insertions, 0 deletions
diff --git a/tools/perf/perf.c b/tools/perf/perf.c
index 78f7b920e548..95c58fc15284 100644
--- a/tools/perf/perf.c
+++ b/tools/perf/perf.c
@@ -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)
diff --git a/tools/perf/util/util.c b/tools/perf/util/util.c
index 7fff6be07f07..95aefa78bb07 100644
--- a/tools/perf/util/util.c
+++ b/tools/perf/util/util.c
@@ -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;
diff --git a/tools/perf/util/util.h b/tools/perf/util/util.h
index b03da44e94e4..66864364ccb4 100644
--- a/tools/perf/util/util.h
+++ b/tools/perf/util/util.h
@@ -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);