perf/core: Add perf_clear_branch_entry_bitfields() helper
Make it simpler to reset all the info fields on the perf_branch_entry by adding a helper inline function. The goal is to centralize the initialization to avoid missing a field in case more are added. Signed-off-by: Stephane Eranian <eranian@google.com> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Link: https://lore.kernel.org/r/20220322221517.2510440-2-eranian@google.com
This commit is contained in:
parent
3123109284
commit
bfe4daf850
2 changed files with 33 additions and 19 deletions
|
|
@ -1063,6 +1063,22 @@ static inline void perf_sample_data_init(struct perf_sample_data *data,
|
|||
data->txn = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Clear all bitfields in the perf_branch_entry.
|
||||
* The to and from fields are not cleared because they are
|
||||
* systematically modified by caller.
|
||||
*/
|
||||
static inline void perf_clear_branch_entry_bitfields(struct perf_branch_entry *br)
|
||||
{
|
||||
br->mispred = 0;
|
||||
br->predicted = 0;
|
||||
br->in_tx = 0;
|
||||
br->abort = 0;
|
||||
br->cycles = 0;
|
||||
br->type = 0;
|
||||
br->reserved = 0;
|
||||
}
|
||||
|
||||
extern void perf_output_sample(struct perf_output_handle *handle,
|
||||
struct perf_event_header *header,
|
||||
struct perf_sample_data *data,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue