diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2019-01-27 05:55:39 -0500 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2019-02-06 08:00:38 -0500 |
commit | 7b644f9ad18f74aeac42360bee9c4c1cf874f4c0 (patch) | |
tree | 70b183c8c15a087a94e39e56193fda27d5af9c15 | |
parent | 4fed072609b8aae27eac7169033f762867a5ab4c (diff) |
perf callchain: Uninline callchain_cursor_reset() to remove map.h dependency
That was the only thing that made including map.h in callchain.h a
requiriment, so uninline it and just add a 'struct map' forward
declaration.
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Link: https://lkml.kernel.org/n/tip-7fjz4hvv1bpzqaeriku44fn4@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-rw-r--r-- | tools/perf/ui/gtk/annotate.c | 1 | ||||
-rw-r--r-- | tools/perf/ui/stdio/hist.c | 1 | ||||
-rw-r--r-- | tools/perf/util/callchain.c | 15 | ||||
-rw-r--r-- | tools/perf/util/callchain.h | 18 |
4 files changed, 20 insertions, 15 deletions
diff --git a/tools/perf/ui/gtk/annotate.c b/tools/perf/ui/gtk/annotate.c index f22a7d142ada..f42666ee0672 100644 --- a/tools/perf/ui/gtk/annotate.c +++ b/tools/perf/ui/gtk/annotate.c | |||
@@ -4,6 +4,7 @@ | |||
4 | #include "util/debug.h" | 4 | #include "util/debug.h" |
5 | #include "util/annotate.h" | 5 | #include "util/annotate.h" |
6 | #include "util/evsel.h" | 6 | #include "util/evsel.h" |
7 | #include "util/map.h" | ||
7 | #include "ui/helpline.h" | 8 | #include "ui/helpline.h" |
8 | #include <inttypes.h> | 9 | #include <inttypes.h> |
9 | #include <signal.h> | 10 | #include <signal.h> |
diff --git a/tools/perf/ui/stdio/hist.c b/tools/perf/ui/stdio/hist.c index 2a9fa4dcbc2a..814abf5e9a5c 100644 --- a/tools/perf/ui/stdio/hist.c +++ b/tools/perf/ui/stdio/hist.c | |||
@@ -4,6 +4,7 @@ | |||
4 | 4 | ||
5 | #include "../../util/util.h" | 5 | #include "../../util/util.h" |
6 | #include "../../util/hist.h" | 6 | #include "../../util/hist.h" |
7 | #include "../../util/map.h" | ||
7 | #include "../../util/sort.h" | 8 | #include "../../util/sort.h" |
8 | #include "../../util/evsel.h" | 9 | #include "../../util/evsel.h" |
9 | #include "../../util/srcline.h" | 10 | #include "../../util/srcline.h" |
diff --git a/tools/perf/util/callchain.c b/tools/perf/util/callchain.c index dc2212e12184..2974950039ac 100644 --- a/tools/perf/util/callchain.c +++ b/tools/perf/util/callchain.c | |||
@@ -1577,3 +1577,18 @@ int callchain_cursor__copy(struct callchain_cursor *dst, | |||
1577 | 1577 | ||
1578 | return rc; | 1578 | return rc; |
1579 | } | 1579 | } |
1580 | |||
1581 | /* | ||
1582 | * Initialize a cursor before adding entries inside, but keep | ||
1583 | * the previously allocated entries as a cache. | ||
1584 | */ | ||
1585 | void callchain_cursor_reset(struct callchain_cursor *cursor) | ||
1586 | { | ||
1587 | struct callchain_cursor_node *node; | ||
1588 | |||
1589 | cursor->nr = 0; | ||
1590 | cursor->last = &cursor->first; | ||
1591 | |||
1592 | for (node = cursor->first; node != NULL; node = node->next) | ||
1593 | map__zput(node->map); | ||
1594 | } | ||
diff --git a/tools/perf/util/callchain.h b/tools/perf/util/callchain.h index 8afe1622edf3..b6f18c2d4b14 100644 --- a/tools/perf/util/callchain.h +++ b/tools/perf/util/callchain.h | |||
@@ -5,10 +5,11 @@ | |||
5 | #include <linux/list.h> | 5 | #include <linux/list.h> |
6 | #include <linux/rbtree.h> | 6 | #include <linux/rbtree.h> |
7 | #include "event.h" | 7 | #include "event.h" |
8 | #include "map.h" | ||
9 | #include "symbol.h" | 8 | #include "symbol.h" |
10 | #include "branch.h" | 9 | #include "branch.h" |
11 | 10 | ||
11 | struct map; | ||
12 | |||
12 | #define HELP_PAD "\t\t\t\t" | 13 | #define HELP_PAD "\t\t\t\t" |
13 | 14 | ||
14 | #define CALLCHAIN_HELP "setup and enables call-graph (stack chain/backtrace):\n\n" | 15 | #define CALLCHAIN_HELP "setup and enables call-graph (stack chain/backtrace):\n\n" |
@@ -187,20 +188,7 @@ int callchain_append(struct callchain_root *root, | |||
187 | int callchain_merge(struct callchain_cursor *cursor, | 188 | int callchain_merge(struct callchain_cursor *cursor, |
188 | struct callchain_root *dst, struct callchain_root *src); | 189 | struct callchain_root *dst, struct callchain_root *src); |
189 | 190 | ||
190 | /* | 191 | void callchain_cursor_reset(struct callchain_cursor *cursor); |
191 | * Initialize a cursor before adding entries inside, but keep | ||
192 | * the previously allocated entries as a cache. | ||
193 | */ | ||
194 | static inline void callchain_cursor_reset(struct callchain_cursor *cursor) | ||
195 | { | ||
196 | struct callchain_cursor_node *node; | ||
197 | |||
198 | cursor->nr = 0; | ||
199 | cursor->last = &cursor->first; | ||
200 | |||
201 | for (node = cursor->first; node != NULL; node = node->next) | ||
202 | map__zput(node->map); | ||
203 | } | ||
204 | 192 | ||
205 | int callchain_cursor_append(struct callchain_cursor *cursor, u64 ip, | 193 | int callchain_cursor_append(struct callchain_cursor *cursor, u64 ip, |
206 | struct map *map, struct symbol *sym, | 194 | struct map *map, struct symbol *sym, |