aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util/annotate.h
diff options
context:
space:
mode:
authorAndi Kleen <ak@linux.intel.com>2015-07-18 08:24:48 -0700
committerArnaldo Carvalho de Melo <acme@redhat.com>2015-08-06 16:32:45 -0300
commitd4957633bf9dab70e566e7dbb2b8d0c61c3a2f1e (patch)
tree2dcf2a678a146eb1dc533921521d73ecd91f8b29 /tools/perf/util/annotate.h
parentperf report: Add flag for non ANY branch mode (diff)
downloadlinux-dev-d4957633bf9dab70e566e7dbb2b8d0c61c3a2f1e.tar.xz
linux-dev-d4957633bf9dab70e566e7dbb2b8d0c61c3a2f1e.zip
perf report: Add infrastructure for a cycles histogram
This adds the basic infrastructure to keep track of cycle counts per basic block for annotate. We allocate an array similar to the normal accounting, and then account branch cycles there. We handle two cases: cycles per basic block with start and cycles per branch (these are later used for either IPC or just cycles per BB) In the start case we cannot handle overlaps, so always the longest basic block wins. For the cycles per branch case everything is accurately accounted. v2: Remove unnecessary checks. Slight restructure. Move symbol__get_annotation to another patch. Move histogram allocation. v3: Merged with current tree Signed-off-by: Andi Kleen <ak@linux.intel.com> Acked-by: Jiri Olsa <jolsa@kernel.org> Cc: Namhyung Kim <namhyung@kernel.org> Link: http://lkml.kernel.org/r/1437233094-12844-4-git-send-email-andi@firstfloor.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/annotate.h')
-rw-r--r--tools/perf/util/annotate.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/tools/perf/util/annotate.h b/tools/perf/util/annotate.h
index 7e78e6c27078..a06518dca4b7 100644
--- a/tools/perf/util/annotate.h
+++ b/tools/perf/util/annotate.h
@@ -79,6 +79,17 @@ struct sym_hist {
u64 addr[0];
};
+struct cyc_hist {
+ u64 start;
+ u64 cycles;
+ u64 cycles_aggr;
+ u32 num;
+ u32 num_aggr;
+ u8 have_start;
+ /* 1 byte padding */
+ u16 reset;
+};
+
struct source_line_samples {
double percent;
double percent_sum;
@@ -97,6 +108,7 @@ struct source_line {
* @histogram: Array of addr hit histograms per event being monitored
* @lines: If 'print_lines' is specified, per source code line percentages
* @source: source parsed from a disassembler like objdump -dS
+ * @cyc_hist: Average cycles per basic block
*
* lines is allocated, percentages calculated and all sorted by percentage
* when the annotation is about to be presented, so the percentages are for
@@ -109,6 +121,7 @@ struct annotated_source {
struct source_line *lines;
int nr_histograms;
int sizeof_sym_hist;
+ struct cyc_hist *cycles_hist;
struct sym_hist histograms[0];
};
@@ -130,6 +143,10 @@ static inline struct annotation *symbol__annotation(struct symbol *sym)
int addr_map_symbol__inc_samples(struct addr_map_symbol *ams, int evidx);
+int addr_map_symbol__account_cycles(struct addr_map_symbol *ams,
+ struct addr_map_symbol *start,
+ unsigned cycles);
+
int hist_entry__inc_addr_samples(struct hist_entry *he, int evidx, u64 addr);
int symbol__alloc_hist(struct symbol *sym);