-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathnetdata_hardirq.h
91 lines (76 loc) · 3.42 KB
/
netdata_hardirq.h
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
// SPDX-License-Identifier: GPL-3.0-or-later
#ifndef _NETDATA_HARDIRQ_H_
#define _NETDATA_HARDIRQ_H_ 1
#define NETDATA_HARDIRQ_MAX_IRQS 1024L
#define NETDATA_HARDIRQ_NAME_LEN 32
// /sys/kernel/debug/tracing/events/irq/irq_handler_entry/
struct netdata_irq_handler_entry {
u64 pad; // This is not used with eBPF
int irq; // offset:8; size:4; signed:1;
int data_loc_name; // offset:12; size:4; signed:1; (https://github.com/iovisor/bpftrace/issues/385)
// (https://lists.linuxfoundation.org/pipermail/iovisor-dev/2017-February/000627.html)
};
// /sys/kernel/debug/tracing/events/irq/irq_handler_exit/
struct netdata_irq_handler_exit {
u64 pad; // This is not used with eBPF
int irq; // offset:8; size:4; signed:1;
int ret; // offset:12; size:4; signed:1;
};
typedef struct hardirq_key {
int irq;
} hardirq_key_t;
/*
typedef struct hardirq_val {
// incremental counter storing the total latency so far.
u64 latency;
// temporary timestamp stored at the IRQ entry handler, to be diff'd with a
// timestamp at the IRQ exit handler, to get the latency to add to the
// `latency` field.
u64 ts;
// identifies the IRQ with a human-readable string.
// We are reading it direct from /proc avoiding in some kernels:
// #0 0x000055f9729eb725 in libbpf_err_errno ()
// #1 0x000055f9729ec8a0 in bpf_map_lookup_elem ()
// #2 0x000055f97298be21 in hardirq_read_latency_map (mapfd=69) at collectors/ebpf.plugin/ebpf_hardirq.c:259
// char name[NETDATA_HARDIRQ_NAME_LEN];
} hardirq_val_t;
*/
/************************************************************************************
* HARDIRQ STATIC
***********************************************************************************/
// all of the `irq_vectors` events, except `vector_*`, have the same format.
// cat /sys/kernel/debug/tracing/available_events | grep 'irq_vectors' | grep -v ':vector_'
struct netdata_irq_vectors_entry {
u64 pad; // This is not used with eBPF
int vector; // offset:8; size:4; signed:1;
};
struct netdata_irq_vectors_exit {
u64 pad; // This is not used with eBPF
int vector; // offset:8; size:4; signed:1;
};
// these represent static IRQs that aren't given an IRQ ID like the ones above.
// they each require separate entry/exit tracepoints to track.
enum netdata_hardirq_static {
NETDATA_HARDIRQ_STATIC_APIC_THERMAL,
NETDATA_HARDIRQ_STATIC_APIC_THRESHOLD,
NETDATA_HARDIRQ_STATIC_APIC_ERROR,
NETDATA_HARDIRQ_STATIC_APIC_DEFERRED_ERROR,
NETDATA_HARDIRQ_STATIC_APIC_SPURIOUS,
NETDATA_HARDIRQ_STATIC_FUNC_CALL,
NETDATA_HARDIRQ_STATIC_FUNC_CALL_SINGLE,
NETDATA_HARDIRQ_STATIC_RESCHEDULE,
NETDATA_HARDIRQ_STATIC_LOCAL_TIMER,
NETDATA_HARDIRQ_STATIC_IRQ_WORK,
NETDATA_HARDIRQ_STATIC_X86_PLATFORM_IPI,
// must be last; used as counter.
NETDATA_HARDIRQ_STATIC_END
};
typedef struct hardirq_val {
// incremental counter storing the total latency so far.
u64 latency;
// temporary timestamp stored at the IRQ entry handler, to be diff'd with a
// timestamp at the IRQ exit handler, to get the latency to add to the
// `latency` field.
u64 ts;
} hardirq_val_t;
#endif /* _NETDATA_HARDIRQ_H_ */