Skip to content

Commit aab364d

Browse files
committed
document bench code
Signed-off-by: Yoshua Wuyts <[email protected]>
1 parent eded1dc commit aab364d

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

README.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,34 @@ Asynchronous HTTP 1.1 parser.
1818
$ cargo add async-h1
1919
```
2020

21+
## Profiling
22+
__build server__
23+
```sh
24+
$ cargo build --examples server --release
25+
```
26+
27+
__profile script__
28+
```sh
29+
#!/bin/bash
30+
set -x
31+
perf record -F 997 -g "./target/release/examples/server"
32+
perf script > /tmp/out.perf
33+
stackcollapse-perf /tmp/out.perf > /tmp/out.folded
34+
35+
outfile="/tmp/$(date +%F-%T)-flamegraph.svg"
36+
flamegraph /tmp/out.folded > "$outfile"
37+
# rm perf.data /tmp/out.perf /tmp/out.folded
38+
39+
firefox "$outfile"
40+
```
41+
42+
__load testing__
43+
Using [autocannon](https://github.com/mcollina/autocannon) do:
44+
45+
```rust
46+
$ autocannon localhost:8080 -l
47+
```
48+
2149
## Safety
2250
This crate uses ``#![deny(unsafe_code)]`` to ensure everything is implemented in
2351
100% Safe Rust.

0 commit comments

Comments
 (0)