Skip to content

Commit

Permalink
perf script: Add not taken event for branches
Browse files Browse the repository at this point in the history
Some hardware (e.g., Arm SPE) can trace the not taken event for
branches.  Add a flag for this event and support printing it.

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-5-leo.yan@arm.com
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
  • Loading branch information
Leo Yan authored and Namhyung Kim committed Mar 5, 2025
1 parent 88b1473 commit 4caa971
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
6 changes: 4 additions & 2 deletions tools/perf/util/event.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,10 @@ enum {
PERF_IP_FLAG_INTR_DISABLE = 1ULL << 13,
PERF_IP_FLAG_INTR_TOGGLE = 1ULL << 14,
PERF_IP_FLAG_BRANCH_MISS = 1ULL << 15,
PERF_IP_FLAG_NOT_TAKEN = 1ULL << 16,
};

#define PERF_IP_FLAG_CHARS "bcrosyiABExghDtm"
#define PERF_IP_FLAG_CHARS "bcrosyiABExghDtmn"

#define PERF_ADDITIONAL_STATE_MASK \
(PERF_IP_FLAG_IN_TX | \
Expand All @@ -91,7 +92,8 @@ enum {
PERF_IP_FLAG_VMEXIT)

#define PERF_IP_FLAG_BRACH_EVENT_MASK \
PERF_IP_FLAG_BRANCH_MISS
(PERF_IP_FLAG_BRANCH_MISS | \
PERF_IP_FLAG_NOT_TAKEN)

#define PERF_MEM_DATA_SRC_NONE \
(PERF_MEM_S(OP, NA) |\
Expand Down
1 change: 1 addition & 0 deletions tools/perf/util/trace-event-scripting.c
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,7 @@ static const struct {
const char *name;
} branch_events[] = {
{PERF_IP_FLAG_BRANCH_MISS, "miss"},
{PERF_IP_FLAG_NOT_TAKEN, "not_taken"},
{0, NULL}
};

Expand Down

0 comments on commit 4caa971

Please sign in to comment.