Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1537978
| From | tip-bot for Namhyung Kim <tipbot@zytor.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [tip:perf/core] perf callchain: Introduce callchain_cursor__copy() |
| Date | 2016-12-07 19:30 +0100 |
| Message-ID | <sLP8B-3DP-25@gated-at.bofh.it> (permalink) |
| References | <sLeVs-55B-29@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
Commit-ID: 571f1eb9b967a52732d2e1f41f1b62e27c900325
Gitweb: http://git.kernel.org/tip/571f1eb9b967a52732d2e1f41f1b62e27c900325
Author: Namhyung Kim <namhyung@kernel.org>
AuthorDate: Tue, 6 Dec 2016 12:40:02 +0900
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Wed, 7 Dec 2016 12:00:33 -0300
perf callchain: Introduce callchain_cursor__copy()
The callchain_cursor__copy() function is to save current callchain
captured by a cursor. It'll be used to keep callchains when switching
to idle task for each cpu.
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Minchan Kim <minchan@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/20161206034010.6499-3-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/util/callchain.c | 27 +++++++++++++++++++++++++++
tools/perf/util/callchain.h | 3 +++
2 files changed, 30 insertions(+)
diff --git a/tools/perf/util/callchain.c b/tools/perf/util/callchain.c
index 823befd..4292251 100644
--- a/tools/perf/util/callchain.c
+++ b/tools/perf/util/callchain.c
@@ -1234,3 +1234,30 @@ out:
}
return -ENOMEM;
}
+
+int callchain_cursor__copy(struct callchain_cursor *dst,
+ struct callchain_cursor *src)
+{
+ int rc = 0;
+
+ callchain_cursor_reset(dst);
+ callchain_cursor_commit(src);
+
+ while (true) {
+ struct callchain_cursor_node *node;
+
+ node = callchain_cursor_current(src);
+ if (node == NULL)
+ break;
+
+ rc = callchain_cursor_append(dst, node->ip, node->map, node->sym,
+ node->branch, &node->branch_flags,
+ node->nr_loop_iter, node->samples);
+ if (rc)
+ break;
+
+ callchain_cursor_advance(src);
+ }
+
+ return rc;
+}
diff --git a/tools/perf/util/callchain.h b/tools/perf/util/callchain.h
index d9c70dc..35c8e37 100644
--- a/tools/perf/util/callchain.h
+++ b/tools/perf/util/callchain.h
@@ -216,6 +216,9 @@ static inline void callchain_cursor_advance(struct callchain_cursor *cursor)
cursor->pos++;
}
+int callchain_cursor__copy(struct callchain_cursor *dst,
+ struct callchain_cursor *src);
+
struct option;
struct hist_entry;
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCHSET 00/10] perf sched timehist: Introduce --idle-hist option (v1) Namhyung Kim <namhyung@kernel.org> - 2016-12-06 04:50 +0100
[PATCH 01/10] perf sched: Cleanup option processing Namhyung Kim <namhyung@kernel.org> - 2016-12-06 04:50 +0100
Re: [PATCH 01/10] perf sched: Cleanup option processing David Ahern <dsahern@gmail.com> - 2016-12-06 05:00 +0100
[tip:perf/core] perf sched: Cleanup option processing tip-bot for Namhyung Kim <tipbot@zytor.com> - 2016-12-07 19:30 +0100
[PATCH 02/10] perf tools: Introduce callchain_cursor__copy() Namhyung Kim <namhyung@kernel.org> - 2016-12-06 04:50 +0100
[tip:perf/core] perf callchain: Introduce callchain_cursor__copy() tip-bot for Namhyung Kim <tipbot@zytor.com> - 2016-12-07 19:30 +0100
Re: [PATCHSET 00/10] perf sched timehist: Introduce --idle-hist option (v1) Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-12-06 20:50 +0100
Re: [PATCHSET 00/10] perf sched timehist: Introduce --idle-hist option (v1) David Ahern <dsahern@gmail.com> - 2016-12-06 22:50 +0100
csiph-web