mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-08-05 16:54:27 +00:00
perf script: Add not taken event for branch stack
The branch stack has an existed field for printing mispredict, extend the field for printing events and add support not-taken event. Reviewed-by: Ian Rogers <irogers@google.com> Reviewed-by: James Clark <james.clark@linaro.org> Signed-off-by: Leo Yan <leo.yan@arm.com> Link: https://lore.kernel.org/r/20250304111240.3378214-6-leo.yan@arm.com Signed-off-by: Namhyung Kim <namhyung@kernel.org>
This commit is contained in:
parent
4caa971050
commit
1e66dcff7b
2 changed files with 15 additions and 8 deletions
|
@ -935,19 +935,25 @@ static int perf_sample__fprintf_start(struct perf_script *script,
|
||||||
return printed;
|
return printed;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline char
|
static inline size_t
|
||||||
mispred_str(struct branch_entry *br)
|
bstack_event_str(struct branch_entry *br, char *buf, size_t sz)
|
||||||
{
|
{
|
||||||
if (!(br->flags.mispred || br->flags.predicted))
|
if (!(br->flags.mispred || br->flags.predicted || br->flags.not_taken))
|
||||||
return '-';
|
return snprintf(buf, sz, "-");
|
||||||
|
|
||||||
return br->flags.predicted ? 'P' : 'M';
|
return snprintf(buf, sz, "%s%s",
|
||||||
|
br->flags.predicted ? "P" : "M",
|
||||||
|
br->flags.not_taken ? "N" : "");
|
||||||
}
|
}
|
||||||
|
|
||||||
static int print_bstack_flags(FILE *fp, struct branch_entry *br)
|
static int print_bstack_flags(FILE *fp, struct branch_entry *br)
|
||||||
{
|
{
|
||||||
return fprintf(fp, "/%c/%c/%c/%d/%s/%s ",
|
char events[16] = { 0 };
|
||||||
mispred_str(br),
|
size_t pos;
|
||||||
|
|
||||||
|
pos = bstack_event_str(br, events, sizeof(events));
|
||||||
|
return fprintf(fp, "/%s/%c/%c/%d/%s/%s ",
|
||||||
|
pos < 0 ? "-" : events,
|
||||||
br->flags.in_tx ? 'X' : '-',
|
br->flags.in_tx ? 'X' : '-',
|
||||||
br->flags.abort ? 'A' : '-',
|
br->flags.abort ? 'A' : '-',
|
||||||
br->flags.cycles,
|
br->flags.cycles,
|
||||||
|
|
|
@ -25,7 +25,8 @@ struct branch_flags {
|
||||||
u64 spec:2;
|
u64 spec:2;
|
||||||
u64 new_type:4;
|
u64 new_type:4;
|
||||||
u64 priv:3;
|
u64 priv:3;
|
||||||
u64 reserved:31;
|
u64 not_taken:1;
|
||||||
|
u64 reserved:30;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Reference in a new issue