https://github.com/rigtorp/c2clat
A tool to measure CPU core to core latency
https://github.com/rigtorp/c2clat
benchmark cpu latency
Last synced: 8 months ago
JSON representation
A tool to measure CPU core to core latency
- Host: GitHub
- URL: https://github.com/rigtorp/c2clat
- Owner: rigtorp
- License: mit
- Created: 2020-10-09T03:16:51.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2023-03-06T01:57:49.000Z (over 3 years ago)
- Last Synced: 2025-03-24T00:31:28.505Z (about 1 year ago)
- Topics: benchmark, cpu, latency
- Language: C++
- Homepage:
- Size: 13.7 KB
- Stars: 146
- Watchers: 5
- Forks: 24
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# c2clat
A tool to measure CPU core to core latency (inter-core latency).
Build:
```console
g++ -O3 -DNDEBUG c2clat.cpp -o c2clat -pthread
```
Example usage:
```console
$ ./c2clat
CPU 0 1 2 3 4 5 6 7
0 0 92 66 62 16 56 54 53
1 92 0 50 54 53 14 49 50
2 66 50 0 48 51 49 13 48
3 62 54 48 0 53 50 48 13
4 16 53 51 53 0 53 51 53
5 56 14 49 50 53 0 49 50
6 54 49 13 48 51 49 0 48
7 53 50 48 13 53 50 48 0
```
Create plot using [gnuplot](http://gnuplot.sourceforge.net/):
```console
c2clat -p | gnuplot -p
```

If you want to run on a subset of cores use [taskset](https://www.man7.org/linux/man-pages/man1/taskset.1.html):
```console
$ taskset -c 10-11 ./c2clat
CPU 10 11
10 0 52
11 52 0
```
If you want to label the heatmap plot replace the plot command with:
```gnuplot
plot '$data' matrix rowheaders columnheaders using 2:1:3 with image, \
'$data' matrix rowheaders columnheaders using 2:1:(sprintf("%g",$3)) with labels
```