-
Notifications
You must be signed in to change notification settings - Fork 336
/
perf_metrics.py
36 lines (33 loc) · 1.15 KB
/
perf_metrics.py
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
class CPU_Utilization:
name = "CPU utilization"
desc = """
Number of CPUs used. The top down CPU metrics are only meaningful
when a CPU thread is executing. The percentage are always relative to
the executing time. When the utilization is low the workload may
actually not be CPU bound, but IO (network, block) IO bound
instead. Check the scheduler and IO metrics below. Or it may be CPU
bound, but not use enough parallelism, if the number of CPUs is less
than the number of cores."""
nogroup = True
subplot = "CPU Utilization"
unit = "CPUs"
def compute(self, EV):
try:
# interval-ns is not a perf event, but handled by toplev internally.
self.val = (EV("task-clock", 1) * 1e6) / EV("interval-ns", 1)
except ZeroDivisionError:
self.val = 0
class MUX:
name = "MUX"
desc = """
PerfMon Event Multiplexing accuracy indicator"""
unit = "%"
maxval = 100.0
errcount = 0
def compute(self, EV):
self.val = EV("mux", 0)
self.thresh = 0 < self.val < 100.0
class Setup:
def __init__(self, r):
#r.force_metric(CPU_Utilization())
r.force_metric(MUX())