The perf_counts_values should be increased to read the new lost data. Also adjust values after read according the read format. This supports PERF_FORMAT_GROUP which has a different data format but it's only available for leader events. Currently it doesn't have an API to read sibling (member) events in the group. But users may read the sibling event directly. Also reading from mmap would be disabled when the read format has ID or LOST bit as it's not exposed via mmap. Signed-off-by: Namhyung Kim <namhyung@kernel.org> Acked-by: Jiri Olsa <jolsa@kernel.org> Cc: Ian Rogers <irogers@google.com> Cc: Ingo Molnar <mingo@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Link: https://lore.kernel.org/r/20220819003644.508916-3-namhyung@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
50 lines
1.9 KiB
C
50 lines
1.9 KiB
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
#ifndef __LIBPERF_EVSEL_H
|
|
#define __LIBPERF_EVSEL_H
|
|
|
|
#include <stdint.h>
|
|
#include <perf/core.h>
|
|
#include <stdbool.h>
|
|
#include <linux/types.h>
|
|
|
|
struct perf_evsel;
|
|
struct perf_event_attr;
|
|
struct perf_cpu_map;
|
|
struct perf_thread_map;
|
|
|
|
struct perf_counts_values {
|
|
union {
|
|
struct {
|
|
uint64_t val;
|
|
uint64_t ena;
|
|
uint64_t run;
|
|
uint64_t id;
|
|
uint64_t lost;
|
|
};
|
|
uint64_t values[5];
|
|
};
|
|
};
|
|
|
|
LIBPERF_API struct perf_evsel *perf_evsel__new(struct perf_event_attr *attr);
|
|
LIBPERF_API void perf_evsel__delete(struct perf_evsel *evsel);
|
|
LIBPERF_API int perf_evsel__open(struct perf_evsel *evsel, struct perf_cpu_map *cpus,
|
|
struct perf_thread_map *threads);
|
|
LIBPERF_API void perf_evsel__close(struct perf_evsel *evsel);
|
|
LIBPERF_API void perf_evsel__close_cpu(struct perf_evsel *evsel, int cpu_map_idx);
|
|
LIBPERF_API int perf_evsel__mmap(struct perf_evsel *evsel, int pages);
|
|
LIBPERF_API void perf_evsel__munmap(struct perf_evsel *evsel);
|
|
LIBPERF_API void *perf_evsel__mmap_base(struct perf_evsel *evsel, int cpu_map_idx, int thread);
|
|
LIBPERF_API int perf_evsel__read(struct perf_evsel *evsel, int cpu_map_idx, int thread,
|
|
struct perf_counts_values *count);
|
|
LIBPERF_API int perf_evsel__enable(struct perf_evsel *evsel);
|
|
LIBPERF_API int perf_evsel__enable_cpu(struct perf_evsel *evsel, int cpu_map_idx);
|
|
LIBPERF_API int perf_evsel__enable_thread(struct perf_evsel *evsel, int thread);
|
|
LIBPERF_API int perf_evsel__disable(struct perf_evsel *evsel);
|
|
LIBPERF_API int perf_evsel__disable_cpu(struct perf_evsel *evsel, int cpu_map_idx);
|
|
LIBPERF_API struct perf_cpu_map *perf_evsel__cpus(struct perf_evsel *evsel);
|
|
LIBPERF_API struct perf_thread_map *perf_evsel__threads(struct perf_evsel *evsel);
|
|
LIBPERF_API struct perf_event_attr *perf_evsel__attr(struct perf_evsel *evsel);
|
|
LIBPERF_API void perf_counts_values__scale(struct perf_counts_values *count,
|
|
bool scale, __s8 *pscaled);
|
|
|
|
#endif /* __LIBPERF_EVSEL_H */
|