2015-08-07 18:51:03 +08:00
|
|
|
#ifndef __PERF_COUNTS_H
|
|
|
|
#define __PERF_COUNTS_H
|
|
|
|
|
|
|
|
#include "xyarray.h"
|
|
|
|
|
|
|
|
struct perf_counts_values {
|
|
|
|
union {
|
|
|
|
struct {
|
|
|
|
u64 val;
|
|
|
|
u64 ena;
|
|
|
|
u64 run;
|
|
|
|
};
|
|
|
|
u64 values[3];
|
|
|
|
};
|
perf stat: Use group read for event groups
Make perf stat use group read if there are groups defined. The group
read will get the values for all member of groups within a single
syscall instead of calling read syscall for every event.
We can see considerable less amount of kernel cycles spent on single
group read, than reading each event separately, like for following perf
stat command:
# perf stat -e {cycles,instructions} -I 10 -a sleep 1
Monitored with "perf stat -r 5 -e '{cycles:u,cycles:k}'"
Before:
24,325,676 cycles:u
297,040,775 cycles:k
1.038554134 seconds time elapsed
After:
25,034,418 cycles:u
158,256,395 cycles:k
1.036864497 seconds time elapsed
The perf_evsel__open fallback changes contributed by Andi Kleen.
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/20170726120206.9099-4-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2017-07-26 20:02:06 +08:00
|
|
|
bool loaded;
|
2015-08-07 18:51:03 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
struct perf_counts {
|
|
|
|
s8 scaled;
|
|
|
|
struct perf_counts_values aggr;
|
|
|
|
struct xyarray *values;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
static inline struct perf_counts_values*
|
|
|
|
perf_counts(struct perf_counts *counts, int cpu, int thread)
|
|
|
|
{
|
|
|
|
return xyarray__entry(counts->values, cpu, thread);
|
|
|
|
}
|
|
|
|
|
|
|
|
struct perf_counts *perf_counts__new(int ncpus, int nthreads);
|
|
|
|
void perf_counts__delete(struct perf_counts *counts);
|
|
|
|
|
|
|
|
void perf_evsel__reset_counts(struct perf_evsel *evsel);
|
|
|
|
int perf_evsel__alloc_counts(struct perf_evsel *evsel, int ncpus, int nthreads);
|
|
|
|
void perf_evsel__free_counts(struct perf_evsel *evsel);
|
|
|
|
|
|
|
|
#endif /* __PERF_COUNTS_H */
|