Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jaymody/measure-cpu-cache-size
Empirically measuring CPU caches sizes using a simple C program.
https://github.com/jaymody/measure-cpu-cache-size
Last synced: 7 days ago
JSON representation
Empirically measuring CPU caches sizes using a simple C program.
- Host: GitHub
- URL: https://github.com/jaymody/measure-cpu-cache-size
- Owner: jaymody
- Created: 2023-07-20T00:12:08.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-05-03T16:48:25.000Z (6 months ago)
- Last Synced: 2024-05-03T19:13:42.186Z (6 months ago)
- Language: C
- Size: 1.02 MB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
A simple C program that can help empirically determine your CPU's cache size. Inspired by [Chapter 7.4 of ThinkOS "measuring cache performance"](https://greenteapress.com/thinkos/html/thinkos009.html#sec44).
Plotting is done in Python using [Plotly](https://plotly.com):
```shell
pip install plotly
```The main program `cache.c` iterates an array at various sizes and strides and outputs the elapsed times for each stride/size pair as a csv, which can be directly piped into `plot.py` to plot the result:
```shell
gcc cache.c && ./a.out | python plot.py
```
This should output a file `plot.html`, which you can open in your browser.