Skip to content

Commit d27f158

Browse files
committed
Do latency calculation as part of vmops.
Ideally we would just output all our latency measurement, but it's taking too long on the 115k baud-rate serial line. Alternative is to use the network to ship results out or get virtio-serial working.
1 parent 7cadc3e commit d27f158

8 files changed

Lines changed: 2128 additions & 47 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ proptest-regressions
2929
memfs_benchmark.csv
3030
redis_benchmark.csv
3131
vmops_benchmark.csv
32+
vmops_benchmark_latency.csv
3233
vspace.dot
3334
vspace.dot.svg
3435
out.log

doc/src/Benchmarking.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,3 +61,27 @@ virtio:
6161
64 bytes from 172.31.0.10: icmp_seq=6 ttl=64 time=0.292 ms
6262
64 bytes from 172.31.0.10: icmp_seq=7 ttl=64 time=0.196 ms
6363
```
64+
65+
## Compare against sv6
66+
67+
Clone & Build:
68+
69+
```bash
70+
git clone https://github.com/aclements/sv6.git
71+
sudo apt-get install gcc-4.8 g++-4.8
72+
CXX=g++-4.8 CC=gcc-4.8 make
73+
```
74+
75+
Update param.h:
76+
77+
```bash
78+
QEMU ?= qemu-system-x86_64 -enable-kvm
79+
QEMUSMP ?= 56
80+
QEMUMEM ?= 24000
81+
```
82+
83+
Run:
84+
85+
```bash
86+
CXX=g++-4.8 CC=gcc-4.8 make qemu`
87+
```

kernel/tests/integration-test.rs

Lines changed: 30 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1354,44 +1354,39 @@ fn s06_vmops_latency_benchmark() {
13541354
let mut qemu_run = |with_cores: usize| -> Result<WaitStatus> {
13551355
let mut p = spawn_bespin(&cmdline)?;
13561356

1357-
// Parse lines like
1358-
// `init::vmops: 1,maponly,1,4096,10000,1000,634948`
1359-
// write them to a CSV file
1360-
let expected_lines = if cfg!(feature = "smoke") {
1361-
1
1362-
} else {
1363-
with_cores * 1_000
1364-
};
1365-
1366-
for _i in 0..expected_lines {
1367-
let (prev, matched) =
1368-
p.exp_regex(r#"init::vmops: (\d+),(.*),(\d+),(\d+),(\d+),(\d+),(\d+)"#)?;
1369-
output += prev.as_str();
1370-
output += matched.as_str();
1371-
1372-
// Append parsed results to a CSV file
1373-
let write_headers = !Path::new(file_name).exists();
1374-
let mut csv_file = OpenOptions::new()
1375-
.append(true)
1376-
.create(true)
1377-
.open(file_name)
1378-
.expect("Can't open file");
1379-
if write_headers {
1380-
let row =
1381-
"git_rev,thread_id,benchmark,ncores,memsize,samples_total,sample_id,latency\n";
1382-
let r = csv_file.write(row.as_bytes());
1383-
assert!(r.is_ok());
1384-
}
1385-
1386-
let parts: Vec<&str> = matched.split("init::vmops: ").collect();
1387-
let r = csv_file.write(format!("{},", env!("GIT_HASH")).as_bytes());
1388-
assert!(r.is_ok());
1389-
let r = csv_file.write(parts[1].as_bytes());
1390-
assert!(r.is_ok());
1391-
let r = csv_file.write("\n".as_bytes());
1357+
// Parse lines like:
1358+
// "Latency percentiles [ns]: maponly,2,4096,1092,1351,1939,3111,4711,9864,2089812"
1359+
// and writes them to a CSV file
1360+
let (prev, matched) =
1361+
p.exp_regex(r#"init::vmops: Latency percentiles: (.*),(\d+),(\d+),(\d+),(\d+),(\d+),(\d+),(\d+),(\d+),(\d+)"#)?;
1362+
output += prev.as_str();
1363+
output += matched.as_str();
1364+
1365+
// Append parsed results to a CSV file
1366+
let write_headers = !Path::new(file_name).exists();
1367+
let mut csv_file = OpenOptions::new()
1368+
.append(true)
1369+
.create(true)
1370+
.open(file_name)
1371+
.expect("Can't open file");
1372+
1373+
if write_headers {
1374+
let row = "git_rev,benchmark,ncores,memsize,p1,p25,p50,p75,p99,p999,p100\n";
1375+
let r = csv_file.write(row.as_bytes());
13921376
assert!(r.is_ok());
13931377
}
13941378

1379+
let parts: Vec<&str> = matched
1380+
.split("init::vmops: Latency percentiles: ")
1381+
.collect();
1382+
assert!(parts.len() >= 2);
1383+
let r = csv_file.write(format!("{},", env!("GIT_HASH")).as_bytes());
1384+
assert!(r.is_ok());
1385+
let r = csv_file.write(parts[1].as_bytes());
1386+
assert!(r.is_ok());
1387+
let r = csv_file.write("\n".as_bytes());
1388+
assert!(r.is_ok());
1389+
13951390
output += p.exp_eof()?.as_str();
13961391
p.process.exit()
13971392
};

usr/init/Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,14 @@ name = "init"
1010
path = "src/init.rs"
1111

1212
[dependencies]
13-
spin = { version = "0.4.8", default_features = false }
13+
spin = { version = "0.5.2", default_features = false }
1414
cstr_core = { git = "https://github.com/gz/cstr_core.git", default-features = false }
1515
log = "0.4"
1616
lineup = { path = "../../lib/lineup" }
1717
rawtime = { path = "../../lib/rawtime" }
1818
x86 = { path = "../../lib/x86" }
1919
vibrio = { path = "../../lib/vibrio" }
20+
libm = "0.2.1"
2021

2122
[features]
2223
rumprt = ["vibrio/rumprt"]

0 commit comments

Comments
 (0)