mirror of
https://github.com/torvalds/linux.git
synced 2026-11-24 07:22:34 +00:00
Try to reduce confusion in particular when the cpu map doesn't contain an entry for every CPU. Signed-off-by: Ian Rogers <[email protected]> Cc: Alexander Shishkin <[email protected]> Cc: Andi Kleen <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: James Clark <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: John Garry <[email protected]> Cc: Kajol Jain <[email protected]> Cc: Kan Liang <[email protected]> Cc: Leo Yan <[email protected]> Cc: Mark Rutland <[email protected]> Cc: Mathieu Poirier <[email protected]> Cc: Mike Leach <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Paul Clarke <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Riccardo Mancini <[email protected]> Cc: Stephane Eranian <[email protected]> Cc: Suzuki Poulouse <[email protected]> Cc: Vineet Singh <[email protected]> Cc: [email protected] Cc: [email protected] Cc: [email protected] Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
47 lines
1.2 KiB
C
47 lines
1.2 KiB
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
#ifndef __PERF_COUNTS_H
|
|
#define __PERF_COUNTS_H
|
|
|
|
#include <linux/types.h>
|
|
#include <internal/xyarray.h>
|
|
#include <perf/evsel.h>
|
|
#include <stdbool.h>
|
|
|
|
struct evsel;
|
|
|
|
struct perf_counts {
|
|
s8 scaled;
|
|
struct perf_counts_values aggr;
|
|
struct xyarray *values;
|
|
struct xyarray *loaded;
|
|
};
|
|
|
|
|
|
static inline struct perf_counts_values*
|
|
perf_counts(struct perf_counts *counts, int cpu_map_idx, int thread)
|
|
{
|
|
return xyarray__entry(counts->values, cpu_map_idx, thread);
|
|
}
|
|
|
|
static inline bool
|
|
perf_counts__is_loaded(struct perf_counts *counts, int cpu_map_idx, int thread)
|
|
{
|
|
return *((bool *) xyarray__entry(counts->loaded, cpu_map_idx, thread));
|
|
}
|
|
|
|
static inline void
|
|
perf_counts__set_loaded(struct perf_counts *counts, int cpu_map_idx, int thread, bool loaded)
|
|
{
|
|
*((bool *) xyarray__entry(counts->loaded, cpu_map_idx, thread)) = loaded;
|
|
}
|
|
|
|
struct perf_counts *perf_counts__new(int ncpus, int nthreads);
|
|
void perf_counts__delete(struct perf_counts *counts);
|
|
void perf_counts__reset(struct perf_counts *counts);
|
|
|
|
void evsel__reset_counts(struct evsel *evsel);
|
|
int evsel__alloc_counts(struct evsel *evsel);
|
|
void evsel__free_counts(struct evsel *evsel);
|
|
|
|
#endif /* __PERF_COUNTS_H */
|