summaryrefslogtreecommitdiffstats
path: root/tools/perf/util/thread-stack.h
diff options
context:
space:
mode:
authorChris Phlipot <cphlipot0@gmail.com>2016-04-28 10:19:10 +0200
committerArnaldo Carvalho de Melo <acme@redhat.com>2016-05-06 18:00:54 +0200
commit2c15f5eb04e9e7e19a2c8be6b50c63a4c6062a44 (patch)
treeced09e79a64751dc2e92629b4974f928bff16ec8 /tools/perf/util/thread-stack.h
parentperf script: Add call path id to exported sample in db export (diff)
downloadlinux-2c15f5eb04e9e7e19a2c8be6b50c63a4c6062a44.tar.xz
linux-2c15f5eb04e9e7e19a2c8be6b50c63a4c6062a44.zip
perf script: Expose usage of the callchain db export via the python api
This change allows python scripts to be able to utilize the recent changes to the db export api allowing the export of call_paths derived from sampled callchains. These call paths are also now associated with the samples from which they were derived. - This feature is enabled by setting "perf_db_export_callchains" to true - When enabled, samples that have callchain information will have the callchains exported via call_path_table - The call_path_id field is added to sample_table to enable association of samples with the corresponding callchain stored in the call paths table. A call_path_id of 0 will be exported if there is no corresponding callchain. - When "perf_db_export_callchains" and "perf_db_export_calls" are both set to True, the call path root data structure will be shared. This prevents duplicating of data and call path ids that would result from building two separate call path trees in memory. - The call_return_processor structure definition was relocated to the header file to make its contents visible to db-export.c. This enables the sharing of call path trees between the two features, as mentioned above. This change is visible to python scripts using the python db export api. The change is backwards compatible with scripts written against the previous API, assuming that the scripts model the sample_table function after the one in export-to-postgresql.py script by allowing for additional arguments to be added in the future. ie. using *x as the final argument of the sample_table function. Signed-off-by: Chris Phlipot <cphlipot0@gmail.com> Acked-by: Adrian Hunter <adrian.hunter@intel.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Link: http://lkml.kernel.org/r/1461831551-12213-6-git-send-email-cphlipot0@gmail.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/thread-stack.h')
-rw-r--r--tools/perf/util/thread-stack.h14
1 files changed, 13 insertions, 1 deletions
diff --git a/tools/perf/util/thread-stack.h b/tools/perf/util/thread-stack.h
index ec9beddfdbab..ad44c7944b8e 100644
--- a/tools/perf/util/thread-stack.h
+++ b/tools/perf/util/thread-stack.h
@@ -25,7 +25,6 @@ struct comm;
struct ip_callchain;
struct symbol;
struct dso;
-struct call_return_processor;
struct comm;
struct perf_sample;
struct addr_location;
@@ -68,6 +67,19 @@ struct call_return {
u32 flags;
};
+/**
+ * struct call_return_processor - provides a call-back to consume call-return
+ * information.
+ * @cpr: call path root
+ * @process: call-back that accepts call/return information
+ * @data: anonymous data for call-back
+ */
+struct call_return_processor {
+ struct call_path_root *cpr;
+ int (*process)(struct call_return *cr, void *data);
+ void *data;
+};
+
int thread_stack__event(struct thread *thread, u32 flags, u64 from_ip,
u64 to_ip, u16 insn_len, u64 trace_nr);
void thread_stack__set_trace_nr(struct thread *thread, u64 trace_nr);