blob: ef2aec10f6f694358be1aff187a44a6380862a33 [file] [log] [blame]
Teng Qin2f3cdbf2016-10-20 16:50:06 -07001Demonstrations of llcstat.
2
Brendan Gregg715f7e62016-10-20 22:50:08 -07003
Teng Qin2f3cdbf2016-10-20 16:50:06 -07004llcstat traces cache reference and cache miss events system-wide, and summarizes
5them by PID and CPU.
Brendan Gregg715f7e62016-10-20 22:50:08 -07006
Teng Qin2f3cdbf2016-10-20 16:50:06 -07007These events, defined in uapi/linux/perf_event.h, have different meanings on
8different architecture. For x86-64, they mean misses and references to LLC.
9
10Example output:
11
12# ./llcstat.py 20 -c 5000
13Running for 20 seconds or hit Ctrl-C to end.
14PID NAME CPU REFERENCE MISS HIT%
150 swapper/15 15 3515000 640000 81.79%
16238 migration/38 38 5000 0 100.00%
174512 ntpd 11 5000 0 100.00%
18150867 ipmitool 3 25000 5000 80.00%
19150895 lscpu 17 280000 25000 91.07%
20151807 ipmitool 15 15000 5000 66.67%
21150757 awk 2 15000 5000 66.67%
22151213 chef-client 5 1770000 240000 86.44%
23151822 scribe-dispatch 12 15000 0 100.00%
24123386 mysqld 5 5000 0 100.00%
25[...]
26Total References: 518920000 Total Misses: 90265000 Hit Rate: 82.61%
27
28This shows each PID's cache hit rate during the 20 seconds run period.
29
Brendan Gregg715f7e62016-10-20 22:50:08 -070030A count of 5000 was used in this example, which means that one in every 5,000
31events will trigger an in-kernel counter to be incremented. This is refactored
32on the output, which is why it is always in multiples of 5,000.
33
34We don't instrument every single event since the overhead would be prohibitive,
35nor do we need to: this is a type of sampling profiler. Because of this, the
36processes that trigger the 5,000'th cache reference or misses can happen to
37some degree by chance. Overall it should make sense. But for low counts,
38you might find a case where -- by chance -- a process has been tallied with
39more misses than references, which would seem impossible.
40
41
Teng Qin2f3cdbf2016-10-20 16:50:06 -070042USAGE message:
43
44# ./llcstat.py --help
45usage: llcstat.py [-h] [-c SAMPLE_PERIOD] [duration]
46
47Summarize cache references and misses by PID
48
49positional arguments:
50 duration Duration, in seconds, to run
51
52 optional arguments:
53 -h, --help show this help message and exit
54 -c SAMPLE_PERIOD, --sample_period SAMPLE_PERIOD
55 Sample one in this many number of cache reference
56 and miss events