libperf: Move 'page_size' global variable to libperf

We need the 'page_size' variable in libperf, so move it there.

Add a libperf_init() as a global libperf init function to obtain this
value via sysconf() at tool start.

Committer notes:

Add internal/lib.h to tools/perf/ files using 'page_size', sometimes
replacing util.h with it if that was the only reason for having util.h
included.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Michael Petlan <mpetlan@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lore.kernel.org/lkml/20190913132355.21634-33-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
Jiri Olsa 2019-08-06 15:25:25 +02:00 committed by Arnaldo Carvalho de Melo
parent d5a99483de
commit 20f2be1d48
28 changed files with 36 additions and 25 deletions

View file

@ -16,7 +16,6 @@
#include "util/synthetic-events.h"
#include "util/target.h"
#include "util/time-utils.h"
#include "util/util.h"
#include <linux/bitops.h>
#include <linux/kernel.h>
#include <linux/string.h>
@ -26,6 +25,7 @@
#include <perf/evsel.h>
#include <internal/cpumap.h>
#include <perf/cpumap.h>
#include <internal/lib.h> // page_size
#include <internal/threadmap.h>
#include <perf/threadmap.h>
#include <symbol/kallsyms.h>