llcstat(8) System Manager's Manual llcstat(8)

# [NAME](#NAME)

llcstat - Summarize CPU cache references and misses by process. Uses Linux eBPF/bcc.

# [SYNOPSIS](#SYNOPSIS)

**llcstat \[-h] \[-c SAMPLE\_PERIOD] \[duration]**

# [DESCRIPTION](#DESCRIPTION)

llcstat instruments CPU cache references and cache misses system-side, and summarizes them by PID and CPU. These events have different meanings on different architecture. For x86-64, they mean misses and references to LLC. This can be useful to locate and debug performance issues caused by cache hit rate.

This works by sampling corresponding events defined in uapi/linux/perf\_event.h, namely PERF\_COUNT\_HW\_CACHE\_REFERENCES and PERF\_COUNT\_HW\_CACHE\_MISSES, using BPF perf event tracing. Upon each sampled event, the attached BPF program records the PID and CPU ID on which the event happened, and stores it in table.

This makes use of a Linux 4.9 feature (BPF\_PROG\_TYPE\_PERF\_EVENT).

Since this uses BPF, only the root user can use this tool.

# [REQUIREMENTS](#REQUIREMENTS)

CONFIG\_BPF and bcc.

# [OPTIONS](#OPTIONS)

[-h](#h)

Print usage message.

[-c SAMPLE\_PERIOD](#c)

Sample one in this many cache reference and cache miss events.

[-t](#t)

Summarize cache references and misses by PID/TID

[duration](#duration)

Duration to trace, in seconds.

# [EXAMPLES](#EXAMPLES)

[Sample one in 100 events, trace for 20 seconds:](#Sample)

\# **llcstat -c 100 20**

# [FIELDS](#FIELDS)

[PID](#PID)

Process ID

[NAME](#NAME~2)

Process name

[CPU](#CPU)

CPU ID

[REFERENCE](#REFERENCE)

Number of cache reference events

[MISS](#MISS)

Number of cache miss events

[HIT%](#HIT_)

Cache hit ratio

# [SOURCE](#SOURCE)

This is from bcc.

https://github.com/iovisor/bcc

Also look in the bcc distribution for a companion \_examples.txt file containing example usage, output, and commentary for this tool.

# [OS](#OS)

Linux

# [STABILITY](#STABILITY)

Unstable - in development.

# [AUTHOR](#AUTHOR)

Teng Qin

# [SEE ALSO](#SEE_ALSO)

[Perf can be used as a generic event counter tool. An example for LLC:](#Perf)

\# **perf top -e cache-misses -e cache-references -a -ns pid,cpu,comm**

2015-08-18 USER COMMANDS

---

Document: llcstat(8) from bcc 0.37.0-r2 (Chainguard OS)
Source: https://github.com/iovisor/bcc
