From 9c6c3f471d85a9b0bcda3ce6fc1e2646685e3f60 Mon Sep 17 00:00:00 2001 From: Kan Liang Date: Thu, 19 Mar 2020 13:25:10 -0700 Subject: perf thread: Save previous sample for LBR stitching approach To retrieve the overwritten LBRs from previous sample for LBR stitching approach, perf has to save the previous sample. Only allocate the struct lbr_stitch once, when LBR stitching approach is enabled and kernel supports hw_idx. Signed-off-by: Kan Liang Reviewed-by: Andi Kleen Acked-by: Jiri Olsa Cc: Adrian Hunter Cc: Alexey Budankov Cc: Mathieu Poirier Cc: Michael Ellerman Cc: Namhyung Kim Cc: Pavel Gerasimov Cc: Peter Zijlstra Cc: Ravi Bangoria Cc: Stephane Eranian Cc: Vitaly Slobodskoy Link: http://lore.kernel.org/lkml/20200319202517.23423-11-kan.liang@linux.intel.com [ Use zalloc()/zfree() for thread->lbr_stitch ] Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/util/thread.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'tools/perf/util/thread.h') diff --git a/tools/perf/util/thread.h b/tools/perf/util/thread.h index 95294050cff2..34eb61cee6a4 100644 --- a/tools/perf/util/thread.h +++ b/tools/perf/util/thread.h @@ -5,6 +5,7 @@ #include #include #include +#include #include #include #include @@ -13,6 +14,7 @@ #include #include #include "rwsem.h" +#include "event.h" struct addr_location; struct map; @@ -20,6 +22,10 @@ struct perf_record_namespaces; struct thread_stack; struct unwind_libunwind_ops; +struct lbr_stitch { + struct perf_sample prev_sample; +}; + struct thread { union { struct rb_node rb_node; @@ -49,6 +55,7 @@ struct thread { /* LBR call stack stitch */ bool lbr_stitch_enable; + struct lbr_stitch *lbr_stitch; }; struct machine; @@ -145,4 +152,9 @@ static inline bool thread__is_filtered(struct thread *thread) return false; } +static inline void thread__free_stitch_list(struct thread *thread) +{ + zfree(&thread->lbr_stitch); +} + #endif /* __PERF_THREAD_H */ -- cgit v1.2.3-59-g8ed1b