remove valgrind, update docs
This commit is contained in:
parent
4f680b6a2d
commit
c8f56cf3f1
11
README.md
11
README.md
@ -65,7 +65,6 @@ sudo apt install -y \
|
|||||||
# Optional but recommended
|
# Optional but recommended
|
||||||
sudo apt install -y \
|
sudo apt install -y \
|
||||||
hyperfine \
|
hyperfine \
|
||||||
valgrind \
|
|
||||||
systemtap-sdt-dev
|
systemtap-sdt-dev
|
||||||
|
|
||||||
# Python tools
|
# Python tools
|
||||||
@ -125,7 +124,7 @@ Get all workshop tools in your current shell without installing anything system-
|
|||||||
cd perf-workshop
|
cd perf-workshop
|
||||||
nix develop
|
nix develop
|
||||||
|
|
||||||
# Now you have: perf, strace, py-spy, bpftrace, hyperfine, valgrind, flamegraph, pyroscope
|
# Now you have: perf, strace, py-spy, bpftrace, hyperfine, flamegraph, pyroscope
|
||||||
perf --version
|
perf --version
|
||||||
py-spy --help
|
py-spy --help
|
||||||
```
|
```
|
||||||
@ -272,8 +271,11 @@ perf-workshop/
|
|||||||
├── scenario4-cache-misses/
|
├── scenario4-cache-misses/
|
||||||
│ ├── README.md
|
│ ├── README.md
|
||||||
│ ├── Makefile
|
│ ├── Makefile
|
||||||
│ ├── cache_demo.c # Row vs column major
|
│ ├── matrix_col_major.c # BAD: Column-major traversal
|
||||||
│ └── list_vs_array.c # Array vs linked list
|
│ ├── matrix_row_major.c # GOOD: Row-major traversal
|
||||||
|
│ ├── list_scattered.c # BAD: Scattered linked list
|
||||||
|
│ ├── list_sequential.c # MEDIUM: Sequential linked list
|
||||||
|
│ └── array_sum.c # GOOD: Contiguous array
|
||||||
├── scenario5-debug-symbols/
|
├── scenario5-debug-symbols/
|
||||||
│ ├── README.md
|
│ ├── README.md
|
||||||
│ ├── Makefile
|
│ ├── Makefile
|
||||||
@ -372,7 +374,6 @@ cat README.md
|
|||||||
### Tools to Explore Later
|
### Tools to Explore Later
|
||||||
- `bpftrace` - High-level tracing language
|
- `bpftrace` - High-level tracing language
|
||||||
- `eBPF` - In-kernel programmability
|
- `eBPF` - In-kernel programmability
|
||||||
- `Valgrind` - Memory profiling
|
|
||||||
- `gprof` - Traditional profiler
|
- `gprof` - Traditional profiler
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|||||||
@ -22,9 +22,8 @@ with pkgs; [
|
|||||||
]))
|
]))
|
||||||
py-spy
|
py-spy
|
||||||
|
|
||||||
# Benchmarking and debugging
|
# Benchmarking and visualization
|
||||||
hyperfine
|
hyperfine
|
||||||
valgrind
|
|
||||||
flamegraph
|
flamegraph
|
||||||
|
|
||||||
# USDT/SDT support (provides sys/sdt.h)
|
# USDT/SDT support (provides sys/sdt.h)
|
||||||
|
|||||||
@ -134,6 +134,24 @@ Look at:
|
|||||||
- `cpu-migrations`
|
- `cpu-migrations`
|
||||||
- `instructions per cycle`
|
- `instructions per cycle`
|
||||||
|
|
||||||
|
## Exercise 6: Benchmarking with hyperfine
|
||||||
|
|
||||||
|
Use `hyperfine` for proper statistical benchmarking with warmup runs:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
hyperfine --warmup 1 './read_slow testfile' './read_fast testfile'
|
||||||
|
```
|
||||||
|
|
||||||
|
This gives you:
|
||||||
|
- Mean execution time with standard deviation
|
||||||
|
- Min/max times
|
||||||
|
- Direct comparison between implementations
|
||||||
|
|
||||||
|
For all three implementations:
|
||||||
|
```bash
|
||||||
|
hyperfine --warmup 1 './read_slow testfile' './read_stdio testfile' './read_fast testfile'
|
||||||
|
```
|
||||||
|
|
||||||
## Further Exploration
|
## Further Exploration
|
||||||
|
|
||||||
1. What happens with `read(fd, buf, 4096)` vs `read(fd, buf, 65536)`?
|
1. What happens with `read(fd, buf, 4096)` vs `read(fd, buf, 65536)`?
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user