Skip to content

Commit

Permalink
perf tools: Add support to dynamically get cacheline size
Browse files Browse the repository at this point in the history
Different arches may have different cacheline sizes.  Look it up and set
a global variable for reference.

Signed-off-by: Don Zickus <[email protected]>
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Jiri Olsa <[email protected]>
  • Loading branch information
dzickusrh authored and olsajiri committed Jun 9, 2014
1 parent 7365be5 commit 2b1b710
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions tools/perf/perf.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions tools/perf/util/util.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
1 change: 1 addition & 0 deletions tools/perf/util/util.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit 2b1b710

Please sign in to comment.