diff options
author | Jiri Olsa <jolsa@kernel.org> | 2019-08-06 15:25:25 +0200 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2019-09-25 14:51:48 +0200 |
commit | 20f2be1d48ec293b5a935595bd0c2e2915ffa77c (patch) | |
tree | f949d8ac25875acc7639ba10f5cc026c94103760 /tools/perf/perf.c | |
parent | libperf: Add perf_evlist__id_add_fd() function (diff) | |
download | linux-20f2be1d48ec293b5a935595bd0c2e2915ffa77c.tar.xz linux-20f2be1d48ec293b5a935595bd0c2e2915ffa77c.zip |
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>
Diffstat (limited to 'tools/perf/perf.c')
-rw-r--r-- | tools/perf/perf.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/tools/perf/perf.c b/tools/perf/perf.c index bb40a108b8f7..c012ceb64ff9 100644 --- a/tools/perf/perf.c +++ b/tools/perf/perf.c @@ -12,6 +12,7 @@ #include "util/build-id.h" #include "util/cache.h" #include "util/env.h" +#include <internal/lib.h> // page_size #include <subcmd/exec-cmd.h> #include "util/config.h" #include <subcmd/run-command.h> @@ -20,11 +21,12 @@ #include "util/bpf-loader.h" #include "util/debug.h" #include "util/event.h" -#include "util/util.h" // page_size, usage() +#include "util/util.h" // usage() #include "ui/ui.h" #include "perf-sys.h" #include <api/fs/fs.h> #include <api/fs/tracing_path.h> +#include <perf/core.h> #include <errno.h> #include <pthread.h> #include <signal.h> @@ -438,8 +440,7 @@ int main(int argc, const char **argv) exec_cmd_init("perf", PREFIX, PERF_EXEC_PATH, EXEC_PATH_ENVIRONMENT); pager_init(PERF_PAGER_ENVIRONMENT); - /* The page_size is placed in util object. */ - page_size = sysconf(_SC_PAGE_SIZE); + libperf_init(); cmd = extract_argv0_path(argv[0]); if (!cmd) |