Commit-ID:  4d678e9039b075f9418600dc87ec5e61cfb57115
Gitweb:     https://git.kernel.org/tip/4d678e9039b075f9418600dc87ec5e61cfb57115
Author:     Adrian Hunter <adrian.hun...@intel.com>
AuthorDate: Tue, 4 Jun 2019 16:00:02 +0300
Committer:  Arnaldo Carvalho de Melo <a...@redhat.com>
CommitDate: Mon, 10 Jun 2019 16:20:12 -0300

perf intel-pt: Add lookahead callback

Add a callback function to enable the decoder to lookahead at subsequent
trace buffers. This will be used to implement a "fast forward" facility
which will be needed to support efficient time interval filtering.

Signed-off-by: Adrian Hunter <adrian.hun...@intel.com>
Cc: Jin Yao <yao....@linux.intel.com>
Cc: Jiri Olsa <jo...@redhat.com>
Link: http://lkml.kernel.org/r/20190604130017.31207-5-adrian.hun...@intel.com
Signed-off-by: Arnaldo Carvalho de Melo <a...@redhat.com>
---
 tools/perf/util/intel-pt-decoder/intel-pt-decoder.c | 2 ++
 tools/perf/util/intel-pt-decoder/intel-pt-decoder.h | 3 +++
 2 files changed, 5 insertions(+)

diff --git a/tools/perf/util/intel-pt-decoder/intel-pt-decoder.c 
b/tools/perf/util/intel-pt-decoder/intel-pt-decoder.c
index 9eb778f9c911..13123b195083 100644
--- a/tools/perf/util/intel-pt-decoder/intel-pt-decoder.c
+++ b/tools/perf/util/intel-pt-decoder/intel-pt-decoder.c
@@ -104,6 +104,7 @@ struct intel_pt_decoder {
                         uint64_t *insn_cnt_ptr, uint64_t *ip, uint64_t to_ip,
                         uint64_t max_insn_cnt, void *data);
        bool (*pgd_ip)(uint64_t ip, void *data);
+       int (*lookahead)(void *data, intel_pt_lookahead_cb_t cb, void *cb_data);
        void *data;
        struct intel_pt_state state;
        const unsigned char *buf;
@@ -233,6 +234,7 @@ struct intel_pt_decoder *intel_pt_decoder_new(struct 
intel_pt_params *params)
        decoder->get_trace          = params->get_trace;
        decoder->walk_insn          = params->walk_insn;
        decoder->pgd_ip             = params->pgd_ip;
+       decoder->lookahead          = params->lookahead;
        decoder->data               = params->data;
        decoder->return_compression = params->return_compression;
        decoder->branch_enable      = params->branch_enable;
diff --git a/tools/perf/util/intel-pt-decoder/intel-pt-decoder.h 
b/tools/perf/util/intel-pt-decoder/intel-pt-decoder.h
index 6a61773dc44b..de36254c6ac9 100644
--- a/tools/perf/util/intel-pt-decoder/intel-pt-decoder.h
+++ b/tools/perf/util/intel-pt-decoder/intel-pt-decoder.h
@@ -102,12 +102,15 @@ struct intel_pt_buffer {
        uint64_t trace_nr;
 };
 
+typedef int (*intel_pt_lookahead_cb_t)(struct intel_pt_buffer *, void *);
+
 struct intel_pt_params {
        int (*get_trace)(struct intel_pt_buffer *buffer, void *data);
        int (*walk_insn)(struct intel_pt_insn *intel_pt_insn,
                         uint64_t *insn_cnt_ptr, uint64_t *ip, uint64_t to_ip,
                         uint64_t max_insn_cnt, void *data);
        bool (*pgd_ip)(uint64_t ip, void *data);
+       int (*lookahead)(void *data, intel_pt_lookahead_cb_t cb, void *cb_data);
        void *data;
        bool return_compression;
        bool branch_enable;

Reply via email to