aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2019-09-23 11:20:38 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2019-09-25 08:51:45 -0400
commite0fcfb086fbbb6233de1062d4b2f05e9afedab3b (patch)
tree7a77407acd4c2b535b2b4d45bd0d701bdc8085f8 /tools
parentd80a5540bccb4a9e7bd49d249056ce4c7d385ff3 (diff)
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')
-rw-r--r--tools/perf/arch/s390/util/auxtrace.c1
-rw-r--r--tools/perf/arch/x86/tests/perf-time-to-tsc.c1
-rw-r--r--tools/perf/arch/x86/util/intel-bts.c1
-rw-r--r--tools/perf/arch/x86/util/intel-pt.c1
-rw-r--r--tools/perf/builtin-kvm.c1
-rw-r--r--tools/perf/builtin-record.c1
-rw-r--r--tools/perf/builtin-top.c1
-rw-r--r--tools/perf/builtin-trace.c1
-rw-r--r--tools/perf/tests/backward-ring-buffer.c1
-rw-r--r--tools/perf/tests/bpf.c1
-rw-r--r--tools/perf/tests/code-reading.c1
-rw-r--r--tools/perf/tests/hists_link.c1
-rw-r--r--tools/perf/tests/keep-tracking.c1
-rw-r--r--tools/perf/tests/mmap-basic.c1
-rw-r--r--tools/perf/tests/openat-syscall-tp-fields.c1
-rw-r--r--tools/perf/tests/perf-record.c1
-rw-r--r--tools/perf/tests/sw-clock.c1
-rw-r--r--tools/perf/tests/switch-tracking.c1
-rw-r--r--tools/perf/tests/task-exit.c1
-rw-r--r--tools/perf/ui/gtk/hists.c1
-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
26 files changed, 53 insertions, 29 deletions
diff --git a/tools/perf/arch/s390/util/auxtrace.c b/tools/perf/arch/s390/util/auxtrace.c
index b0fb70e38960..0db5c58c98e8 100644
--- a/tools/perf/arch/s390/util/auxtrace.c
+++ b/tools/perf/arch/s390/util/auxtrace.c
@@ -1,4 +1,5 @@
1#include <stdbool.h> 1#include <stdbool.h>
2#include <stdlib.h>
2#include <linux/kernel.h> 3#include <linux/kernel.h>
3#include <linux/types.h> 4#include <linux/types.h>
4#include <linux/bitops.h> 5#include <linux/bitops.h>
diff --git a/tools/perf/arch/x86/tests/perf-time-to-tsc.c b/tools/perf/arch/x86/tests/perf-time-to-tsc.c
index 42ae47525a76..e1dd5f8894ba 100644
--- a/tools/perf/arch/x86/tests/perf-time-to-tsc.c
+++ b/tools/perf/arch/x86/tests/perf-time-to-tsc.c
@@ -17,6 +17,7 @@
17#include "thread_map.h" 17#include "thread_map.h"
18#include "record.h" 18#include "record.h"
19#include "tsc.h" 19#include "tsc.h"
20#include "util/mmap.h"
20#include "tests/tests.h" 21#include "tests/tests.h"
21 22
22#include "arch-tests.h" 23#include "arch-tests.h"
diff --git a/tools/perf/arch/x86/util/intel-bts.c b/tools/perf/arch/x86/util/intel-bts.c
index 090d90e093df..64b409dad6e2 100644
--- a/tools/perf/arch/x86/util/intel-bts.c
+++ b/tools/perf/arch/x86/util/intel-bts.c
@@ -15,6 +15,7 @@
15#include "../../util/event.h" 15#include "../../util/event.h"
16#include "../../util/evsel.h" 16#include "../../util/evsel.h"
17#include "../../util/evlist.h" 17#include "../../util/evlist.h"
18#include "../../util/mmap.h"
18#include "../../util/session.h" 19#include "../../util/session.h"
19#include "../../util/pmu.h" 20#include "../../util/pmu.h"
20#include "../../util/debug.h" 21#include "../../util/debug.h"
diff --git a/tools/perf/arch/x86/util/intel-pt.c b/tools/perf/arch/x86/util/intel-pt.c
index 3d041b89f018..6c139611d231 100644
--- a/tools/perf/arch/x86/util/intel-pt.c
+++ b/tools/perf/arch/x86/util/intel-pt.c
@@ -18,6 +18,7 @@
18#include "../../util/evlist.h" 18#include "../../util/evlist.h"
19#include "../../util/evsel.h" 19#include "../../util/evsel.h"
20#include "../../util/cpumap.h" 20#include "../../util/cpumap.h"
21#include "../../util/mmap.h"
21#include <subcmd/parse-options.h> 22#include <subcmd/parse-options.h>
22#include "../../util/parse-events.h" 23#include "../../util/parse-events.h"
23#include "../../util/pmu.h" 24#include "../../util/pmu.h"
diff --git a/tools/perf/builtin-kvm.c b/tools/perf/builtin-kvm.c
index 72debb7bd20d..30852848ed9c 100644
--- a/tools/perf/builtin-kvm.c
+++ b/tools/perf/builtin-kvm.c
@@ -5,6 +5,7 @@
5#include "util/build-id.h" 5#include "util/build-id.h"
6#include "util/evsel.h" 6#include "util/evsel.h"
7#include "util/evlist.h" 7#include "util/evlist.h"
8#include "util/mmap.h"
8#include "util/term.h" 9#include "util/term.h"
9#include "util/symbol.h" 10#include "util/symbol.h"
10#include "util/thread.h" 11#include "util/thread.h"
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index 093d9ab5633e..1bb3d91c6599 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -20,6 +20,7 @@
20#include "util/evlist.h" 20#include "util/evlist.h"
21#include "util/evsel.h" 21#include "util/evsel.h"
22#include "util/debug.h" 22#include "util/debug.h"
23#include "util/mmap.h"
23#include "util/target.h" 24#include "util/target.h"
24#include "util/session.h" 25#include "util/session.h"
25#include "util/tool.h" 26#include "util/tool.h"
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index 771b3ff47dc3..e637a08655db 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -30,6 +30,7 @@
30#include "util/event.h" 30#include "util/event.h"
31#include "util/machine.h" 31#include "util/machine.h"
32#include "util/map.h" 32#include "util/map.h"
33#include "util/mmap.h"
33#include "util/session.h" 34#include "util/session.h"
34#include "util/symbol.h" 35#include "util/symbol.h"
35#include "util/synthetic-events.h" 36#include "util/synthetic-events.h"
diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c
index ff989351567d..c44280358e58 100644
--- a/tools/perf/builtin-trace.c
+++ b/tools/perf/builtin-trace.c
@@ -31,6 +31,7 @@
31#include "util/synthetic-events.h" 31#include "util/synthetic-events.h"
32#include "util/evlist.h" 32#include "util/evlist.h"
33#include "util/evswitch.h" 33#include "util/evswitch.h"
34#include "util/mmap.h"
34#include <subcmd/pager.h> 35#include <subcmd/pager.h>
35#include <subcmd/exec-cmd.h> 36#include <subcmd/exec-cmd.h>
36#include "util/machine.h" 37#include "util/machine.h"
diff --git a/tools/perf/tests/backward-ring-buffer.c b/tools/perf/tests/backward-ring-buffer.c
index 3073a68d17b9..c59d3752d48d 100644
--- a/tools/perf/tests/backward-ring-buffer.c
+++ b/tools/perf/tests/backward-ring-buffer.c
@@ -10,6 +10,7 @@
10#include "tests.h" 10#include "tests.h"
11#include "debug.h" 11#include "debug.h"
12#include "parse-events.h" 12#include "parse-events.h"
13#include "util/mmap.h"
13#include <errno.h> 14#include <errno.h>
14#include <linux/string.h> 15#include <linux/string.h>
15 16
diff --git a/tools/perf/tests/bpf.c b/tools/perf/tests/bpf.c
index 964731915498..3c8533fdbce5 100644
--- a/tools/perf/tests/bpf.c
+++ b/tools/perf/tests/bpf.c
@@ -19,6 +19,7 @@
19#include "llvm.h" 19#include "llvm.h"
20#include "debug.h" 20#include "debug.h"
21#include "parse-events.h" 21#include "parse-events.h"
22#include "util/mmap.h"
22#define NR_ITERS 111 23#define NR_ITERS 111
23#define PERF_TEST_BPF_PATH "/sys/fs/bpf/perf_test" 24#define PERF_TEST_BPF_PATH "/sys/fs/bpf/perf_test"
24 25
diff --git a/tools/perf/tests/code-reading.c b/tools/perf/tests/code-reading.c
index 413783b69006..bc6db3e7a1c5 100644
--- a/tools/perf/tests/code-reading.c
+++ b/tools/perf/tests/code-reading.c
@@ -24,6 +24,7 @@
24#include "symbol.h" 24#include "symbol.h"
25#include "event.h" 25#include "event.h"
26#include "record.h" 26#include "record.h"
27#include "util/mmap.h"
27#include "util/synthetic-events.h" 28#include "util/synthetic-events.h"
28#include "thread.h" 29#include "thread.h"
29 30
diff --git a/tools/perf/tests/hists_link.c b/tools/perf/tests/hists_link.c
index 8be4d0b61e3a..1a3bdc0a2d14 100644
--- a/tools/perf/tests/hists_link.c
+++ b/tools/perf/tests/hists_link.c
@@ -8,6 +8,7 @@
8#include "machine.h" 8#include "machine.h"
9#include "parse-events.h" 9#include "parse-events.h"
10#include "hists_common.h" 10#include "hists_common.h"
11#include "util/mmap.h"
11#include <errno.h> 12#include <errno.h>
12#include <linux/kernel.h> 13#include <linux/kernel.h>
13 14
diff --git a/tools/perf/tests/keep-tracking.c b/tools/perf/tests/keep-tracking.c
index 8e2ec5f72042..c6030fdf7d4c 100644
--- a/tools/perf/tests/keep-tracking.c
+++ b/tools/perf/tests/keep-tracking.c
@@ -13,6 +13,7 @@
13#include "record.h" 13#include "record.h"
14#include "thread_map.h" 14#include "thread_map.h"
15#include "tests.h" 15#include "tests.h"
16#include "util/mmap.h"
16 17
17#define CHECK__(x) { \ 18#define CHECK__(x) { \
18 while ((x) < 0) { \ 19 while ((x) < 0) { \
diff --git a/tools/perf/tests/mmap-basic.c b/tools/perf/tests/mmap-basic.c
index 4d42e455feb7..3a22dce991ba 100644
--- a/tools/perf/tests/mmap-basic.c
+++ b/tools/perf/tests/mmap-basic.c
@@ -11,6 +11,7 @@
11#include "evsel.h" 11#include "evsel.h"
12#include "thread_map.h" 12#include "thread_map.h"
13#include "tests.h" 13#include "tests.h"
14#include "util/mmap.h"
14#include <linux/err.h> 15#include <linux/err.h>
15#include <linux/kernel.h> 16#include <linux/kernel.h>
16#include <linux/string.h> 17#include <linux/string.h>
diff --git a/tools/perf/tests/openat-syscall-tp-fields.c b/tools/perf/tests/openat-syscall-tp-fields.c
index 5c2576174ae9..e20eaadb1a35 100644
--- a/tools/perf/tests/openat-syscall-tp-fields.c
+++ b/tools/perf/tests/openat-syscall-tp-fields.c
@@ -11,6 +11,7 @@
11#include "record.h" 11#include "record.h"
12#include "tests.h" 12#include "tests.h"
13#include "debug.h" 13#include "debug.h"
14#include "util/mmap.h"
14#include <errno.h> 15#include <errno.h>
15 16
16#ifndef O_DIRECTORY 17#ifndef O_DIRECTORY
diff --git a/tools/perf/tests/perf-record.c b/tools/perf/tests/perf-record.c
index 669fd88e7f30..ea8bcaa13ea5 100644
--- a/tools/perf/tests/perf-record.c
+++ b/tools/perf/tests/perf-record.c
@@ -11,6 +11,7 @@
11#include "debug.h" 11#include "debug.h"
12#include "record.h" 12#include "record.h"
13#include "tests.h" 13#include "tests.h"
14#include "util/mmap.h"
14 15
15static int sched__get_first_possible_cpu(pid_t pid, cpu_set_t *maskp) 16static int sched__get_first_possible_cpu(pid_t pid, cpu_set_t *maskp)
16{ 17{
diff --git a/tools/perf/tests/sw-clock.c b/tools/perf/tests/sw-clock.c
index fbff60815be8..84519df87f30 100644
--- a/tools/perf/tests/sw-clock.c
+++ b/tools/perf/tests/sw-clock.c
@@ -12,6 +12,7 @@
12#include "util/evsel.h" 12#include "util/evsel.h"
13#include "util/evlist.h" 13#include "util/evlist.h"
14#include "util/cpumap.h" 14#include "util/cpumap.h"
15#include "util/mmap.h"
15#include "util/thread_map.h" 16#include "util/thread_map.h"
16#include <perf/evlist.h> 17#include <perf/evlist.h>
17 18
diff --git a/tools/perf/tests/switch-tracking.c b/tools/perf/tests/switch-tracking.c
index c92e287e0f53..e5c3f2ee223a 100644
--- a/tools/perf/tests/switch-tracking.c
+++ b/tools/perf/tests/switch-tracking.c
@@ -16,6 +16,7 @@
16#include "thread_map.h" 16#include "thread_map.h"
17#include "record.h" 17#include "record.h"
18#include "tests.h" 18#include "tests.h"
19#include "util/mmap.h"
19 20
20static int spin_sleep(void) 21static int spin_sleep(void)
21{ 22{
diff --git a/tools/perf/tests/task-exit.c b/tools/perf/tests/task-exit.c
index 718838b5e724..7fc39af48a76 100644
--- a/tools/perf/tests/task-exit.c
+++ b/tools/perf/tests/task-exit.c
@@ -5,6 +5,7 @@
5#include "target.h" 5#include "target.h"
6#include "thread_map.h" 6#include "thread_map.h"
7#include "tests.h" 7#include "tests.h"
8#include "util/mmap.h"
8 9
9#include <errno.h> 10#include <errno.h>
10#include <signal.h> 11#include <signal.h>
diff --git a/tools/perf/ui/gtk/hists.c b/tools/perf/ui/gtk/hists.c
index 6c2efc10bf5c..ed1a97b2c4b0 100644
--- a/tools/perf/ui/gtk/hists.c
+++ b/tools/perf/ui/gtk/hists.c
@@ -8,6 +8,7 @@
8#include "../string2.h" 8#include "../string2.h"
9#include "gtk.h" 9#include "gtk.h"
10#include <signal.h> 10#include <signal.h>
11#include <stdlib.h>
11#include <linux/string.h> 12#include <linux/string.h>
12 13
13#define MAX_COLUMNS 32 14#define MAX_COLUMNS 32
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 @@
34#include "bpf-event.h" 34#include "bpf-event.h"
35#include "block-range.h" 35#include "block-range.h"
36#include "string2.h" 36#include "string2.h"
37#include "util/mmap.h"
37#include "arch/common.h" 38#include "arch/common.h"
38#include <regex.h> 39#include <regex.h>
39#include <pthread.h> 40#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 @@
51#include "arm-spe.h" 51#include "arm-spe.h"
52#include "s390-cpumsf.h" 52#include "s390-cpumsf.h"
53#include "util.h" // page_size 53#include "util.h" // page_size
54#include "util/mmap.h"
54 55
55#include <linux/ctype.h> 56#include <linux/ctype.h>
56#include <linux/kernel.h> 57#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 @@
10#include <inttypes.h> 10#include <inttypes.h>
11#include <poll.h> 11#include <poll.h>
12#include "cpumap.h" 12#include "cpumap.h"
13#include "util/mmap.h"
13#include "thread_map.h" 14#include "thread_map.h"
14#include "target.h" 15#include "target.h"
15#include "evlist.h" 16#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 @@
11#include <internal/evlist.h> 11#include <internal/evlist.h>
12#include "events_stats.h" 12#include "events_stats.h"
13#include "evsel.h" 13#include "evsel.h"
14#include "mmap.h" 14#include <pthread.h>
15#include <signal.h> 15#include <signal.h>
16#include <unistd.h> 16#include <unistd.h>
17 17
@@ -20,6 +20,34 @@ struct thread_map;
20struct perf_cpu_map; 20struct perf_cpu_map;
21struct record_opts; 21struct record_opts;
22 22
23/*
24 * State machine of bkw_mmap_state:
25 *
26 * .________________(forbid)_____________.
27 * | V
28 * NOTREADY --(0)--> RUNNING --(1)--> DATA_PENDING --(2)--> EMPTY
29 * ^ ^ | ^ |
30 * | |__(forbid)____/ |___(forbid)___/|
31 * | |
32 * \_________________(3)_______________/
33 *
34 * NOTREADY : Backward ring buffers are not ready
35 * RUNNING : Backward ring buffers are recording
36 * DATA_PENDING : We are required to collect data from backward ring buffers
37 * EMPTY : We have collected data from backward ring buffers.
38 *
39 * (0): Setup backward ring buffer
40 * (1): Pause ring buffers for reading
41 * (2): Read from ring buffers
42 * (3): Resume ring buffers for recording
43 */
44enum bkw_mmap_state {
45 BKW_MMAP_NOTREADY,
46 BKW_MMAP_RUNNING,
47 BKW_MMAP_DATA_PENDING,
48 BKW_MMAP_EMPTY,
49};
50
23#define PERF_EVLIST__HLIST_BITS 8 51#define PERF_EVLIST__HLIST_BITS 8
24#define PERF_EVLIST__HLIST_SIZE (1 << PERF_EVLIST__HLIST_BITS) 52#define PERF_EVLIST__HLIST_SIZE (1 << PERF_EVLIST__HLIST_BITS)
25 53
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 {
45 int comp_level; 45 int comp_level;
46}; 46};
47 47
48/*
49 * State machine of bkw_mmap_state:
50 *
51 * .________________(forbid)_____________.
52 * | V
53 * NOTREADY --(0)--> RUNNING --(1)--> DATA_PENDING --(2)--> EMPTY
54 * ^ ^ | ^ |
55 * | |__(forbid)____/ |___(forbid)___/|
56 * | |
57 * \_________________(3)_______________/
58 *
59 * NOTREADY : Backward ring buffers are not ready
60 * RUNNING : Backward ring buffers are recording
61 * DATA_PENDING : We are required to collect data from backward ring buffers
62 * EMPTY : We have collected data from backward ring buffers.
63 *
64 * (0): Setup backward ring buffer
65 * (1): Pause ring buffers for reading
66 * (2): Read from ring buffers
67 * (3): Resume ring buffers for recording
68 */
69enum bkw_mmap_state {
70 BKW_MMAP_NOTREADY,
71 BKW_MMAP_RUNNING,
72 BKW_MMAP_DATA_PENDING,
73 BKW_MMAP_EMPTY,
74};
75
76struct mmap_params { 48struct mmap_params {
77 int prot, mask, nr_cblocks, affinity, flush, comp_level; 49 int prot, mask, nr_cblocks, affinity, flush, comp_level;
78 struct auxtrace_mmap_params auxtrace_mp; 50 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 @@
34#include "asm/bug.h" 34#include "asm/bug.h"
35#include "util/parse-branch-options.h" 35#include "util/parse-branch-options.h"
36#include "metricgroup.h" 36#include "metricgroup.h"
37#include "util/mmap.h"
37 38
38#define MAX_NAME_LEN 100 39#define MAX_NAME_LEN 100
39 40