Loading...
Note: File does not exist in v4.6.
1.. SPDX-License-Identifier: (LGPL-2.1 OR BSD-2-Clause)
2
3libperf
4
5The libperf library provides an API to access the linux kernel perf
6events subsystem. It provides the following high level objects:
7
8 - struct perf_cpu_map
9 - struct perf_thread_map
10 - struct perf_evlist
11 - struct perf_evsel
12
13reference
14=========
15Function reference by header files:
16
17perf/core.h
18-----------
19.. code-block:: c
20
21 typedef int (\*libperf_print_fn_t)(enum libperf_print_level level,
22 const char \*, va_list ap);
23
24 void libperf_set_print(libperf_print_fn_t fn);
25
26perf/cpumap.h
27-------------
28.. code-block:: c
29
30 struct perf_cpu_map \*perf_cpu_map__dummy_new(void);
31 struct perf_cpu_map \*perf_cpu_map__new(const char \*cpu_list);
32 struct perf_cpu_map \*perf_cpu_map__read(FILE \*file);
33 struct perf_cpu_map \*perf_cpu_map__get(struct perf_cpu_map \*map);
34 void perf_cpu_map__put(struct perf_cpu_map \*map);
35 int perf_cpu_map__cpu(const struct perf_cpu_map \*cpus, int idx);
36 int perf_cpu_map__nr(const struct perf_cpu_map \*cpus);
37 perf_cpu_map__for_each_cpu(cpu, idx, cpus)
38
39perf/threadmap.h
40----------------
41.. code-block:: c
42
43 struct perf_thread_map \*perf_thread_map__new_dummy(void);
44 void perf_thread_map__set_pid(struct perf_thread_map \*map, int thread, pid_t pid);
45 char \*perf_thread_map__comm(struct perf_thread_map \*map, int thread);
46 struct perf_thread_map \*perf_thread_map__get(struct perf_thread_map \*map);
47 void perf_thread_map__put(struct perf_thread_map \*map);
48
49perf/evlist.h
50-------------
51.. code-block::
52
53 void perf_evlist__init(struct perf_evlist \*evlist);
54 void perf_evlist__add(struct perf_evlist \*evlist,
55 struct perf_evsel \*evsel);
56 void perf_evlist__remove(struct perf_evlist \*evlist,
57 struct perf_evsel \*evsel);
58 struct perf_evlist \*perf_evlist__new(void);
59 void perf_evlist__delete(struct perf_evlist \*evlist);
60 struct perf_evsel\* perf_evlist__next(struct perf_evlist \*evlist,
61 struct perf_evsel \*evsel);
62 int perf_evlist__open(struct perf_evlist \*evlist);
63 void perf_evlist__close(struct perf_evlist \*evlist);
64 void perf_evlist__enable(struct perf_evlist \*evlist);
65 void perf_evlist__disable(struct perf_evlist \*evlist);
66 perf_evlist__for_each_evsel(evlist, pos)
67 void perf_evlist__set_maps(struct perf_evlist \*evlist,
68 struct perf_cpu_map \*cpus,
69 struct perf_thread_map \*threads);
70
71perf/evsel.h
72------------
73.. code-block:: c
74
75 struct perf_counts_values {
76 union {
77 struct {
78 uint64_t val;
79 uint64_t ena;
80 uint64_t run;
81 };
82 uint64_t values[3];
83 };
84 };
85
86 void perf_evsel__init(struct perf_evsel \*evsel,
87 struct perf_event_attr \*attr);
88 struct perf_evsel \*perf_evsel__new(struct perf_event_attr \*attr);
89 void perf_evsel__delete(struct perf_evsel \*evsel);
90 int perf_evsel__open(struct perf_evsel \*evsel, struct perf_cpu_map \*cpus,
91 struct perf_thread_map \*threads);
92 void perf_evsel__close(struct perf_evsel \*evsel);
93 int perf_evsel__read(struct perf_evsel \*evsel, int cpu, int thread,
94 struct perf_counts_values \*count);
95 int perf_evsel__enable(struct perf_evsel \*evsel);
96 int perf_evsel__disable(struct perf_evsel \*evsel);
97 int perf_evsel__apply_filter(struct perf_evsel \*evsel, const char \*filter);
98 struct perf_cpu_map \*perf_evsel__cpus(struct perf_evsel \*evsel);
99 struct perf_thread_map \*perf_evsel__threads(struct perf_evsel \*evsel);
100 struct perf_event_attr \*perf_evsel__attr(struct perf_evsel \*evsel);