aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util
diff options
context:
space:
mode:
authorJiri Olsa <jolsa@kernel.org>2019-08-06 15:25:25 +0200
committerArnaldo Carvalho de Melo <acme@redhat.com>2019-09-25 09:51:48 -0300
commit20f2be1d48ec293b5a935595bd0c2e2915ffa77c (patch)
treef949d8ac25875acc7639ba10f5cc026c94103760 /tools/perf/util
parentlibperf: Add perf_evlist__id_add_fd() function (diff)
downloadlinux-dev-20f2be1d48ec293b5a935595bd0c2e2915ffa77c.tar.xz
linux-dev-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/util')
-rw-r--r--tools/perf/util/auxtrace.c1
-rw-r--r--tools/perf/util/evlist.c2
-rw-r--r--tools/perf/util/header.c2
-rw-r--r--tools/perf/util/machine.c1
-rw-r--r--tools/perf/util/mmap.c2
-rw-r--r--tools/perf/util/python.c2
-rw-r--r--tools/perf/util/session.c1
-rw-r--r--tools/perf/util/srccode.c2
-rw-r--r--tools/perf/util/synthetic-events.c2
-rw-r--r--tools/perf/util/trace-event-info.c2
-rw-r--r--tools/perf/util/util.c3
-rw-r--r--tools/perf/util/util.h2
12 files changed, 9 insertions, 13 deletions
diff --git a/tools/perf/util/auxtrace.c b/tools/perf/util/auxtrace.c
index 4bd92f5bfb5f..8470dfe9fe97 100644
--- a/tools/perf/util/auxtrace.c
+++ b/tools/perf/util/auxtrace.c
@@ -50,7 +50,6 @@
#include "intel-bts.h"
#include "arm-spe.h"
#include "s390-cpumsf.h"
-#include "util.h" // page_size
#include "util/mmap.h"
#include <linux/ctype.h>
diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c
index a37eccf65eae..6069fb52661f 100644
--- a/tools/perf/util/evlist.c
+++ b/tools/perf/util/evlist.c
@@ -17,7 +17,7 @@
#include "evsel.h"
#include "debug.h"
#include "units.h"
-#include "util.h" // page_size
+#include <internal/lib.h> // page_size
#include "../perf.h"
#include "asm/bug.h"
#include "bpf-event.h"
diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c
index 02602bc8cabf..3b24b4974c5f 100644
--- a/tools/perf/util/header.c
+++ b/tools/perf/util/header.c
@@ -42,7 +42,7 @@
#include "tool.h"
#include "time-utils.h"
#include "units.h"
-#include "util.h" // page_size, perf_exe()
+#include "util/util.h" // perf_exe()
#include "cputopo.h"
#include "bpf-event.h"
diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c
index 0535338f2d7a..70a9f8716a4b 100644
--- a/tools/perf/util/machine.c
+++ b/tools/perf/util/machine.c
@@ -32,6 +32,7 @@
#include "linux/hash.h"
#include "asm/bug.h"
#include "bpf-event.h"
+#include <internal/lib.h> // page_size
#include <linux/ctype.h>
#include <symbol/kallsyms.h>
diff --git a/tools/perf/util/mmap.c b/tools/perf/util/mmap.c
index 4cc3b54b2f73..12671d089748 100644
--- a/tools/perf/util/mmap.c
+++ b/tools/perf/util/mmap.c
@@ -20,7 +20,7 @@
#include "event.h"
#include "mmap.h"
#include "../perf.h"
-#include "util.h" /* page_size */
+#include <internal/lib.h> /* page_size */
size_t perf_mmap__mmap_len(struct mmap *map)
{
diff --git a/tools/perf/util/python.c b/tools/perf/util/python.c
index fcbafb1e8d9d..6c46d7dbd263 100644
--- a/tools/perf/util/python.c
+++ b/tools/perf/util/python.c
@@ -14,7 +14,7 @@
#include "thread_map.h"
#include "trace-event.h"
#include "mmap.h"
-#include "util.h"
+#include <internal/lib.h>
#include "../perf-sys.h"
#if PY_MAJOR_VERSION < 3
diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c
index 84a30ff3968a..061bb4d6a3f5 100644
--- a/tools/perf/util/session.c
+++ b/tools/perf/util/session.c
@@ -29,7 +29,6 @@
#include "thread-stack.h"
#include "sample-raw.h"
#include "stat.h"
-#include "util.h"
#include "ui/progress.h"
#include "../perf.h"
#include "arch/common.h"
diff --git a/tools/perf/util/srccode.c b/tools/perf/util/srccode.c
index b402f9ca89ab..d84ed8b6caaa 100644
--- a/tools/perf/util/srccode.c
+++ b/tools/perf/util/srccode.c
@@ -15,7 +15,7 @@
#include <string.h>
#include "srccode.h"
#include "debug.h"
-#include "util.h" // page_size
+#include <internal/lib.h> // page_size
#define MAXSRCCACHE (32*1024*1024)
#define MAXSRCFILES 64
diff --git a/tools/perf/util/synthetic-events.c b/tools/perf/util/synthetic-events.c
index 96ed008c2775..807cbca403a7 100644
--- a/tools/perf/util/synthetic-events.c
+++ b/tools/perf/util/synthetic-events.c
@@ -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>
diff --git a/tools/perf/util/trace-event-info.c b/tools/perf/util/trace-event-info.c
index fe07e7550930..086e98ff42a3 100644
--- a/tools/perf/util/trace-event-info.c
+++ b/tools/perf/util/trace-event-info.c
@@ -2,7 +2,6 @@
/*
* Copyright (C) 2008,2009, Steven Rostedt <srostedt@redhat.com>
*/
-#include "util.h" // page_size
#include <dirent.h>
#include <mntent.h>
#include <stdio.h>
@@ -19,6 +18,7 @@
#include <linux/list.h>
#include <linux/kernel.h>
#include <linux/zalloc.h>
+#include <internal/lib.h> // page_size
#include "trace-event.h"
#include <api/fs/tracing_path.h>
diff --git a/tools/perf/util/util.c b/tools/perf/util/util.c
index 32322a20a68b..cb6fa4c98470 100644
--- a/tools/perf/util/util.c
+++ b/tools/perf/util/util.c
@@ -3,6 +3,7 @@
#include "debug.h"
#include "event.h"
#include "namespaces.h"
+#include <internal/lib.h>
#include <api/fs/fs.h>
#include <sys/mman.h>
#include <sys/stat.h>
@@ -41,8 +42,6 @@ void perf_set_multithreaded(void)
perf_singlethreaded = false;
}
-unsigned int page_size;
-
int sysctl_perf_event_max_stack = PERF_MAX_STACK_DEPTH;
int sysctl_perf_event_max_contexts_per_stack = PERF_MAX_CONTEXTS_PER_STACK;
diff --git a/tools/perf/util/util.h b/tools/perf/util/util.h
index 45a5c6f20197..d6ae394e67c4 100644
--- a/tools/perf/util/util.h
+++ b/tools/perf/util/util.h
@@ -33,8 +33,6 @@ int copyfile_offset(int ifd, loff_t off_in, int ofd, loff_t off_out, u64 size);
size_t hex_width(u64 v);
-extern unsigned int page_size;
-
int sysctl__max_stack(void);
int fetch_kernel_version(unsigned int *puint,