summaryrefslogtreecommitdiffstats
path: root/tools/perf/util/annotate-data.h
diff options
context:
space:
mode:
authorNamhyung Kim <namhyung@kernel.org>2023-12-13 01:13:17 +0100
committerArnaldo Carvalho de Melo <acme@redhat.com>2023-12-24 02:39:42 +0100
commit9bd7ddd1576164fbb8d369c6a7b018af9544e202 (patch)
tree978aa0776ae2dd726cc65cf3fc5e430575e9c3c1 /tools/perf/util/annotate-data.h
parentperf annotate-data: Add member field in the data type (diff)
downloadlinux-9bd7ddd1576164fbb8d369c6a7b018af9544e202.tar.xz
linux-9bd7ddd1576164fbb8d369c6a7b018af9544e202.zip
perf annotate-data: Update sample histogram for type
The annotated_data_type__update_samples() to get histogram for data type access. It'll be called by perf annotate to show which fields in the data type are accessed frequently. Signed-off-by: Namhyung Kim <namhyung@kernel.org> Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Ian Rogers <irogers@google.com> Cc: Ingo Molnar <mingo@kernel.org> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Masami Hiramatsu <mhiramat@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Stephane Eranian <eranian@google.com> Cc: linux-toolchains@vger.kernel.org Cc: linux-trace-devel@vger.kernel.org Link: https://lore.kernel.org/r/20231213001323.718046-12-namhyung@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/annotate-data.h')
-rw-r--r--tools/perf/util/annotate-data.h42
1 files changed, 42 insertions, 0 deletions
diff --git a/tools/perf/util/annotate-data.h b/tools/perf/util/annotate-data.h
index 33748222e6aa..d2dc025b1934 100644
--- a/tools/perf/util/annotate-data.h
+++ b/tools/perf/util/annotate-data.h
@@ -7,6 +7,7 @@
#include <linux/rbtree.h>
#include <linux/types.h>
+struct evsel;
struct map_symbol;
/**
@@ -30,15 +31,41 @@ struct annotated_member {
};
/**
+ * struct type_hist_entry - Histogram entry per offset
+ * @nr_samples: Number of samples
+ * @period: Count of event
+ */
+struct type_hist_entry {
+ int nr_samples;
+ u64 period;
+};
+
+/**
+ * struct type_hist - Type histogram for each event
+ * @nr_samples: Total number of samples in this data type
+ * @period: Total count of the event in this data type
+ * @offset: Array of histogram entry
+ */
+struct type_hist {
+ u64 nr_samples;
+ u64 period;
+ struct type_hist_entry addr[];
+};
+
+/**
* struct annotated_data_type - Data type to profile
* @node: RB-tree node for dso->type_tree
* @self: Actual type information
+ * @nr_histogram: Number of histogram entries
+ * @histograms: An array of pointers to histograms
*
* This represents a data type accessed by samples in the profile data.
*/
struct annotated_data_type {
struct rb_node node;
struct annotated_member self;
+ int nr_histograms;
+ struct type_hist **histograms;
};
extern struct annotated_data_type unknown_type;
@@ -49,6 +76,11 @@ extern struct annotated_data_type unknown_type;
struct annotated_data_type *find_data_type(struct map_symbol *ms, u64 ip,
int reg, int offset);
+/* Update type access histogram at the given offset */
+int annotated_data_type__update_samples(struct annotated_data_type *adt,
+ struct evsel *evsel, int offset,
+ int nr_samples, u64 period);
+
/* Release all data type information in the tree */
void annotated_data_type__tree_delete(struct rb_root *root);
@@ -61,6 +93,16 @@ find_data_type(struct map_symbol *ms __maybe_unused, u64 ip __maybe_unused,
return NULL;
}
+static inline int
+annotated_data_type__update_samples(struct annotated_data_type *adt __maybe_unused,
+ struct evsel *evsel __maybe_unused,
+ int offset __maybe_unused,
+ int nr_samples __maybe_unused,
+ u64 period __maybe_unused)
+{
+ return -1;
+}
+
static inline void annotated_data_type__tree_delete(struct rb_root *root __maybe_unused)
{
}