Skip to content

Commit e08ee3f

Browse files
authored
Merge pull request qualcomm-linux#252 from smuppand/sysbench
Performance: Tiotest runner improvements + lib_performance numeric helpers
2 parents ec0bc09 + e5dd0ef commit e08ee3f

6 files changed

Lines changed: 1518 additions & 9 deletions

File tree

Runner/suites/Performance/Sysbench_Performance/run.sh

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -255,16 +255,18 @@ log_info "FILEIO dir=$FILEIO_DIR total=$FILEIO_TOTAL_SIZE blk=$FILEIO_BLOCK_SIZE
255255
perf_clock_sanity_warn 2>/dev/null || true
256256

257257
# ---------------- deps check ----------------
258-
deps_list="sysbench awk sed grep date mkfifo tee"
259258
if [ -n "${TASKSET_CPU_LIST:-}" ]; then
260-
deps_list="$deps_list taskset"
261-
fi
262-
263-
# Use single call (no loop)
264-
if ! check_dependencies "$deps_list"; then
265-
log_skip "$TESTNAME SKIP - missing one or more dependencies: $deps_list"
266-
echo "$TESTNAME SKIP" >"$RES_FILE"
267-
exit 0
259+
if ! check_dependencies sysbench awk sed grep date mkfifo tee taskset; then
260+
log_skip "$TESTNAME SKIP - missing one or more dependencies"
261+
echo "$TESTNAME SKIP" >"$RES_FILE"
262+
exit 0
263+
fi
264+
else
265+
if ! check_dependencies sysbench awk sed grep date mkfifo tee; then
266+
log_skip "$TESTNAME SKIP - missing one or more dependencies"
267+
echo "$TESTNAME SKIP" >"$RES_FILE"
268+
exit 0
269+
fi
268270
fi
269271

270272
set_performance_governor 2>/dev/null || true
Lines changed: 272 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,272 @@
1+
# Tiotest
2+
3+
Tiotest storage KPI runner for Yocto/LE images, aligned to qcom-linux-testkit performance suite conventions.
4+
5+
It runs the requested tiotest modes (sequential + random) for one or more thread counts, for N iterations:
6+
- `seqwr` Sequential Write
7+
- `seqrd` Sequential Read
8+
- `rndwr` Random Write
9+
- `rndrd` Random Read
10+
11+
Outputs:
12+
- Per-run logs: `OUT_DIR/tiotest_<mode>_t<threads>_iter<it>.log`
13+
- Metrics TSV: `OUT_DIR/tiotest_metrics.tsv`
14+
- Summary: `OUT_DIR/tiotest_summary.txt`
15+
- Result file: `./Tiotest.res` (OVERWRITTEN, not appended; LAVA-friendly)
16+
17+
> Note: The `tiotest -h` shown on RB3GEN2 (v0.3.3) does NOT include `--direct-io`.
18+
> Some internal forks may have extra flags; this runner follows your target help output and keeps everything non-hardcoded.
19+
20+
---
21+
22+
## Prerequisites
23+
24+
1. `tiotest` binary available on target (in PATH or pass `--tiotest-bin /path/to/tiotest`)
25+
2. A writable directory on the storage you want to benchmark (filesystem mode), OR a block device (raw mode).
26+
3. Recommended: keep system idle and (optionally) use performance governor for more stable KPIs.
27+
28+
Dependencies (checked by script):
29+
- `awk sed grep date tee`
30+
- `tiotest` (or the path you pass)
31+
32+
---
33+
34+
## Quick Start (filesystem mode)
35+
36+
Run on a disk-backed path (recommended, avoids tmpfs variance):
37+
38+
```sh
39+
cd Runner/suites/Performance/Tiotest
40+
41+
./run.sh \
42+
--out-dir ./tiotest_out \
43+
--iterations 3 \
44+
--threads-list "1 4" \
45+
--tiotest-bin tiotest \
46+
--use-raw 0 \
47+
--tiotest-dir /var/tmp/tiotest_fileio \
48+
--mode-list "seqwr seqrd rndwr rndrd" \
49+
--seq-block 524288 \
50+
--seq-file-mb 1024 \
51+
--rnd-block 4096 \
52+
--rnd-file-mb 1 \
53+
--rnd-ops 12500 \
54+
--hide-latency 1 \
55+
--drop-caches 0 \
56+
--set-perf-gov 1 \
57+
--require-non-tmpfs 1
58+
```
59+
60+
Result:
61+
- `Tiotest.res` contains **one line**: `Tiotest PASS|FAIL|SKIP`
62+
- Summary at `./tiotest_out/tiotest_summary.txt`
63+
64+
---
65+
66+
## Raw Device Mode (USE_RAW=1)
67+
68+
Raw mode uses tiotest `-R` and expects `--tiotest-dir` to be a **block device**:
69+
70+
```sh
71+
./run.sh \
72+
--out-dir ./tiotest_out_raw \
73+
--iterations 2 \
74+
--threads-list "1" \
75+
--tiotest-bin tiotest \
76+
--use-raw 1 \
77+
--tiotest-dir /dev/sda \
78+
--offset-mb 0 \
79+
--offset-first 0 \
80+
--mode-list "seqwr seqrd rndwr rndrd"
81+
```
82+
83+
Options:
84+
- `--offset-mb N` corresponds to `-o N` (offset between threads) when using `-R`
85+
- `--offset-first 1` corresponds to `-O` (apply offset to first thread as well)
86+
87+
> Caution: Raw mode can stress the device. Ensure you are using the correct target block device.
88+
89+
---
90+
91+
## Running Only a Subset of Modes
92+
93+
Example: sequential only
94+
95+
```sh
96+
./run.sh --mode-list "seqwr seqrd"
97+
```
98+
99+
Example: random only
100+
101+
```sh
102+
./run.sh --mode-list "rndwr rndrd"
103+
```
104+
105+
---
106+
107+
## Changing Block Size / File Size
108+
109+
Sequential 1MB block size (per thread 1GB):
110+
111+
```sh
112+
./run.sh --seq-block 1048576 --seq-file-mb 1024
113+
```
114+
115+
Random 4KB blocks, larger file per thread, more ops:
116+
117+
```sh
118+
./run.sh --rnd-block 4096 --rnd-file-mb 64 --rnd-ops 12500
119+
```
120+
121+
---
122+
123+
## Latency Output
124+
125+
Your tiotest supports:
126+
- `-L` hide latency output
127+
128+
Runner control:
129+
- `--hide-latency 1` => adds `-L`
130+
- `--hide-latency 0` => do not add `-L` (latency may be printed if tiotest emits it)
131+
132+
The runner also supports an optional strict check:
133+
- If latency is enabled (hide-latency != 1) and `perf_tiotest_latency_strict_check()` exists in `lib_performance.sh`,
134+
the run can FAIL if `% >2 sec` or `% >10 sec` becomes non-zero.
135+
136+
---
137+
138+
## Optional Baseline Gating
139+
140+
If you provide a baseline file, the runner can evaluate average KPIs vs baseline with allowed deviation.
141+
142+
- Baseline auto-detect: `./tiotest_baseline.conf` (same folder as `run.sh`)
143+
- Or pass: `--baseline /path/to/tiotest_baseline.conf`
144+
- Control deviation: `--delta 0.10` (10%)
145+
146+
Example:
147+
148+
```sh
149+
./run.sh \
150+
--baseline ./tiotest_baseline.conf \
151+
--delta 0.10
152+
```
153+
154+
If gating fails:
155+
- `.res` will be `Tiotest FAIL`
156+
- exit code `1` (LAVA will still collect logs, and your YAML uses `|| true` if desired)
157+
158+
---
159+
160+
## Output artifacts
161+
162+
All artifacts are written under `--out-dir`:
163+
164+
- `tiotest_summary.txt`: final human-readable summary (also printed to stdout)
165+
- `tiotest_metrics.tsv`: per-iteration machine-readable metrics
166+
- per-metric `.values` files (one value per iteration) used for averaging/gating
167+
- `tiotest_seq_t<threads>_iter<N>.log` and `tiotest_rnd_t<threads>_iter<N>.log`: raw tiotest logs per iteration
168+
169+
### tiotest_metrics.tsv format
170+
171+
`tiotest_metrics.tsv` always has **8 tab-separated columns**:
172+
173+
```
174+
mode threads mbps iops latavg_ms latmax_ms pct_gt2s pct_gt10s
175+
```
176+
177+
Example:
178+
179+
```
180+
rndrd 4 3127.443 800625 0.003 0.133 0.00000 0.00000
181+
```
182+
183+
## Baseline and gating
184+
185+
The runner can gate measured averages against a baseline file (default: `tiotest_baseline.conf`).
186+
187+
### Baseline file format
188+
189+
Key-value format compatible with `perf_baseline_get_value()`:
190+
191+
```
192+
# tiotest.<threads>.<metric>.baseline=...
193+
# tiotest.<threads>.<metric>.goal=...
194+
# tiotest.<threads>.<metric>.op=>=|<=|>|<|==
195+
196+
tiotest.1.seqwr_mbps.baseline=180
197+
tiotest.1.seqwr_mbps.goal=180
198+
tiotest.1.seqwr_mbps.op=>=
199+
200+
tiotest.1.seqrd_mbps.baseline=800
201+
tiotest.1.seqrd_mbps.goal=800
202+
tiotest.1.seqrd_mbps.op=>=
203+
204+
tiotest.1.rndwr_mbps.baseline=45
205+
tiotest.1.rndwr_mbps.goal=45
206+
tiotest.1.rndwr_mbps.op=>=
207+
208+
tiotest.1.rndwr_iops.baseline=11000
209+
tiotest.1.rndwr_iops.goal=11000
210+
tiotest.1.rndwr_iops.op=>=
211+
212+
tiotest.1.rndrd_mbps.baseline=50
213+
tiotest.1.rndrd_mbps.goal=50
214+
tiotest.1.rndrd_mbps.op=>=
215+
216+
tiotest.1.rndrd_iops.baseline=12000
217+
tiotest.1.rndrd_iops.goal=12000
218+
tiotest.1.rndrd_iops.op=>=
219+
220+
tiotest.4.seqwr_mbps.baseline=500
221+
tiotest.4.seqwr_mbps.goal=500
222+
tiotest.4.seqwr_mbps.op=>=
223+
224+
tiotest.4.seqrd_mbps.baseline=1200
225+
tiotest.4.seqrd_mbps.goal=1200
226+
tiotest.4.seqrd_mbps.op=>=
227+
228+
tiotest.4.rndwr_mbps.baseline=80
229+
tiotest.4.rndwr_mbps.goal=80
230+
tiotest.4.rndwr_mbps.op=>=
231+
232+
tiotest.4.rndwr_iops.baseline=30000
233+
tiotest.4.rndwr_iops.goal=30000
234+
tiotest.4.rndwr_iops.op=>=
235+
236+
tiotest.4.rndrd_mbps.baseline=90
237+
tiotest.4.rndrd_mbps.goal=90
238+
tiotest.4.rndrd_mbps.op=>=
239+
240+
tiotest.4.rndrd_iops.baseline=32000
241+
tiotest.4.rndrd_iops.goal=32000
242+
tiotest.4.rndrd_iops.op=>=
243+
```
244+
245+
### Goal and delta behavior
246+
247+
If `.goal` is missing, it can be derived from `.baseline` and `ALLOWED_DEVIATION` (delta) depending on the operator:
248+
249+
- `>=` / `>`: `goal = baseline * (1 - delta)`
250+
- `<=` / `<`: `goal = baseline * (1 + delta)`
251+
- `==`: `goal = baseline`
252+
253+
Gating output is logged and also appended to the summary. The summary prints `goal${op}${goal}` so you will see
254+
strings like `goal=>=90` or `goal>90` exactly.
255+
256+
## LAVA Usage
257+
258+
Use the test definition YAML: `Tiotest.yaml`
259+
260+
Typical steps:
261+
- `cd Runner/suites/Performance/Tiotest/`
262+
- Run `./run.sh ...`
263+
- Send `.res` with:
264+
`Runner/utils/send-to-lava.sh Tiotest.res`
265+
266+
---
267+
268+
## Tips for Stable KPI Numbers
269+
270+
- Use a disk-backed directory (e.g., `/var/tmp/...` or your storage mount), not tmpfs.
271+
- Keep device idle; run 2–3 iterations and compare variance.
272+
- Consider performance governor (`--set-perf-gov 1`) if supported on your platform.

0 commit comments

Comments
 (0)