summaryrefslogtreecommitdiffstats
path: root/tools/perf/util
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2019-09-23 12:20:38 -0300
committerArnaldo Carvalho de Melo <acme@redhat.com>2019-09-25 09:51:45 -0300
commite0fcfb086fbbb6233de1062d4b2f05e9afedab3b (patch)
tree7a77407acd4c2b535b2b4d45bd0d701bdc8085f8 /tools/perf/util
parentd80a5540bccb4a9e7bd49d249056ce4c7d385ff3 (diff)
downloadlinux-e0fcfb086fbbb6233de1062d4b2f05e9afedab3b.tar.bz2
perf evlist: Adopt backwards ring buffer state enum
As this isn't used at all in mmap.h but in evlist.h, so to cut down the header dependency tree, move it to where it is used. Also add mmap.h to the places using it but previously getting it indirectly via evlist.h. Add missing pthread.h to evlist.h, as it has a pthread_t struct member and was getting the header via mmap.h. Noticed while processing a Jiri's libperf batch touching mmap.h, where almost everything gets rebuilt because evlist.h is so popular, so cut down't this rebuild the world party. Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Song Liu <songliubraving@fb.com> Link: https://lkml.kernel.org/n/tip-he0uljeftl0xfveh3d6vtode@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util')
-rw-r--r--tools/perf/util/annotate.c1
-rw-r--r--tools/perf/util/auxtrace.c1
-rw-r--r--tools/perf/util/evlist.c1
-rw-r--r--tools/perf/util/evlist.h30
-rw-r--r--tools/perf/util/mmap.h28
-rw-r--r--tools/perf/util/parse-events.c1
6 files changed, 33 insertions, 29 deletions
diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c
index d441cca6a517..69d0a1991b29 100644
--- a/tools/perf/util/annotate.c
+++ b/tools/perf/util/annotate.c
@@ -34,6 +34,7 @@
#include "bpf-event.h"
#include "block-range.h"
#include "string2.h"
+#include "util/mmap.h"
#include "arch/common.h"
#include <regex.h>
#include <pthread.h>
diff --git a/tools/perf/util/auxtrace.c b/tools/perf/util/auxtrace.c
index 1d22ffd972ac..4bd92f5bfb5f 100644
--- a/tools/perf/util/auxtrace.c
+++ b/tools/perf/util/auxtrace.c
@@ -51,6 +51,7 @@
#include "arm-spe.h"
#include "s390-cpumsf.h"
#include "util.h" // page_size
+#include "util/mmap.h"
#include <linux/ctype.h>
#include <linux/kernel.h>
diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c
index c96c743cc1d2..f700dbe043b7 100644
--- a/tools/perf/util/evlist.c
+++ b/tools/perf/util/evlist.c
@@ -10,6 +10,7 @@
#include <inttypes.h>
#include <poll.h>
#include "cpumap.h"
+#include "util/mmap.h"
#include "thread_map.h"
#include "target.h"
#include "evlist.h"
diff --git a/tools/perf/util/evlist.h b/tools/perf/util/evlist.h
index b33c5d67410a..8b9c35efea67 100644
--- a/tools/perf/util/evlist.h
+++ b/tools/perf/util/evlist.h
@@ -11,7 +11,7 @@
#include <internal/evlist.h>
#include "events_stats.h"
#include "evsel.h"
-#include "mmap.h"
+#include <pthread.h>
#include <signal.h>
#include <unistd.h>
@@ -20,6 +20,34 @@ struct thread_map;
struct perf_cpu_map;
struct record_opts;
+/*
+ * State machine of bkw_mmap_state:
+ *
+ * .________________(forbid)_____________.
+ * | V
+ * NOTREADY --(0)--> RUNNING --(1)--> DATA_PENDING --(2)--> EMPTY
+ * ^ ^ | ^ |
+ * | |__(forbid)____/ |___(forbid)___/|
+ * | |
+ * \_________________(3)_______________/
+ *
+ * NOTREADY : Backward ring buffers are not ready
+ * RUNNING : Backward ring buffers are recording
+ * DATA_PENDING : We are required to collect data from backward ring buffers
+ * EMPTY : We have collected data from backward ring buffers.
+ *
+ * (0): Setup backward ring buffer
+ * (1): Pause ring buffers for reading
+ * (2): Read from ring buffers
+ * (3): Resume ring buffers for recording
+ */
+enum bkw_mmap_state {
+ BKW_MMAP_NOTREADY,
+ BKW_MMAP_RUNNING,
+ BKW_MMAP_DATA_PENDING,
+ BKW_MMAP_EMPTY,
+};
+
#define PERF_EVLIST__HLIST_BITS 8
#define PERF_EVLIST__HLIST_SIZE (1 << PERF_EVLIST__HLIST_BITS)
diff --git a/tools/perf/util/mmap.h b/tools/perf/util/mmap.h
index 01524608a984..ab086ede044a 100644
--- a/tools/perf/util/mmap.h
+++ b/tools/perf/util/mmap.h
@@ -45,34 +45,6 @@ struct mmap {
int comp_level;
};
-/*
- * State machine of bkw_mmap_state:
- *
- * .________________(forbid)_____________.
- * | V
- * NOTREADY --(0)--> RUNNING --(1)--> DATA_PENDING --(2)--> EMPTY
- * ^ ^ | ^ |
- * | |__(forbid)____/ |___(forbid)___/|
- * | |
- * \_________________(3)_______________/
- *
- * NOTREADY : Backward ring buffers are not ready
- * RUNNING : Backward ring buffers are recording
- * DATA_PENDING : We are required to collect data from backward ring buffers
- * EMPTY : We have collected data from backward ring buffers.
- *
- * (0): Setup backward ring buffer
- * (1): Pause ring buffers for reading
- * (2): Read from ring buffers
- * (3): Resume ring buffers for recording
- */
-enum bkw_mmap_state {
- BKW_MMAP_NOTREADY,
- BKW_MMAP_RUNNING,
- BKW_MMAP_DATA_PENDING,
- BKW_MMAP_EMPTY,
-};
-
struct mmap_params {
int prot, mask, nr_cblocks, affinity, flush, comp_level;
struct auxtrace_mmap_params auxtrace_mp;
diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
index a33a1d5059a2..9cf1371c90a3 100644
--- a/tools/perf/util/parse-events.c
+++ b/tools/perf/util/parse-events.c
@@ -34,6 +34,7 @@
#include "asm/bug.h"
#include "util/parse-branch-options.h"
#include "metricgroup.h"
+#include "util/mmap.h"
#define MAX_NAME_LEN 100