forked from cloudflare/ebpf_exporter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
llcstat.yaml
50 lines (46 loc) · 1.47 KB
/
llcstat.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
programs:
# See:
# * https://github.com/iovisor/bcc/blob/master/tools/llcstat.py
# * https://github.com/iovisor/bcc/blob/master/tools/llcstat_example.txt
- name: llcstat
metrics:
counters:
- name: llc_references_total
help: Last level cache operations by type
table: references
labels:
- name: cpu
size: 4
decoders:
- name: uint
- name: llc_misses_total
help: Last level cache operations by type
table: misses
labels:
- name: cpu
size: 4
decoders:
- name: uint
perf_events:
- type: 0x0 # HARDWARE
name: 0x3 # PERF_COUNT_HW_CACHE_MISSES
target: on_cache_miss
sample_frequency: 99
- type: 0x0 # HARDWARE
name: 0x2 # PERF_COUNT_HW_CACHE_REFERENCES
target: on_cache_reference
sample_frequency: 99
code: |
#include <linux/ptrace.h>
#include <uapi/linux/bpf_perf_event.h>
const int max_cpus = 128;
BPF_ARRAY(references, u64, max_cpus);
BPF_ARRAY(misses, u64, max_cpus);
int on_cache_miss(struct bpf_perf_event_data *ctx) {
misses.increment(bpf_get_smp_processor_id(), ctx->sample_period);
return 0;
}
int on_cache_reference(struct bpf_perf_event_data *ctx) {
references.increment(bpf_get_smp_processor_id(), ctx->sample_period);
return 0;
}