-
Notifications
You must be signed in to change notification settings - Fork 27
Performance/Sysbench: baseline gating, MB/sec normalization, clock sanity + docs/YAML updates #244
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
smuppand
wants to merge
6
commits into
qualcomm-linux:main
Choose a base branch
from
smuppand:sysbench
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
7aa3348
perf(lib_performance): add sysbench helper APIs
smuppand 56afb85
perf(sysbench): add baseline KPI config
smuppand 475fd2b
functestlib: expand ensure_reasonable_clock for no-network systems
smuppand c862d2b
perf(sysbench): add Sysbench_Performance runner
smuppand d898109
docs(sysbench): add usage and KPI guidance
smuppand 3511269
lava(sysbench): add Sysbench_Performance job template
smuppand File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
227 changes: 227 additions & 0 deletions
227
Runner/suites/Performance/Sysbench_Performance/README_sysbench.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,227 @@ | ||
| # Sysbench_Performance | ||
|
|
||
| This suite runs a **repeatable Sysbench performance baseline** on Yocto/QLI targets in a CI-friendly way. | ||
|
|
||
| It runs the following test cases for one or more thread counts and for N iterations: | ||
|
|
||
| - **CPU** (`sysbench cpu`) | ||
| - **Memory bandwidth** (`sysbench memory`) | ||
| - **Threads** (`sysbench threads`) | ||
| - **Mutex** (`sysbench mutex`) | ||
| - **File I/O throughput** (`sysbench fileio`) — **seqwr / seqrd / rndwr / rndrd** | ||
|
|
||
| For each case it: | ||
| - prints sysbench output live to console (and saves per-iteration logs), | ||
| - records per-iteration KPIs into `*.values` files, | ||
| - prints a compact per-iteration KPI line (`ITER_SUMMARY`) to console, | ||
| - computes averages and writes `OUT_DIR/sysbench_summary.txt`, | ||
| - optionally appends per-iteration + avg rows to a CSV (only if `CSV_FILE` is provided), | ||
| - optionally enforces PASS/FAIL **baseline gating** (when a baseline file is provided or auto-detected). | ||
|
|
||
| --- | ||
|
|
||
| ## KPIs collected (and “better” direction) | ||
|
|
||
| | Case | KPI name (run.sh / baseline key) | Unit | Better | | ||
| |---|---|---:|---| | ||
| | CPU | `cpu_time_sec` | seconds | **lower** | | ||
| | Memory | `memory_mem_mbps` | MB/s | **higher** | | ||
| | Threads | `threads_time_sec` | seconds | **lower** | | ||
| | Mutex | `mutex_time_sec` | seconds | **lower** | | ||
| | File I/O seq write | `fileio_seqwr_mbps` | MB/s | **higher** | | ||
| | File I/O seq read | `fileio_seqrd_mbps` | MB/s | **higher** | | ||
| | File I/O rnd write | `fileio_rndwr_mbps` | MB/s | **higher** | | ||
| | File I/O rnd read | `fileio_rndrd_mbps` | MB/s | **higher** | | ||
|
|
||
| > Note: even if you think of reads as “GB/s”, the suite **stores and gates in MB/s** for consistency. | ||
| > If you have a baseline in GB/s, convert to MB/s (GB/s × 1024). | ||
|
|
||
| --- | ||
|
|
||
| ## Baseline gating (PASS/FAIL) | ||
|
|
||
| Baseline gating is enabled when either: | ||
| - `BASELINE_FILE` / `--baseline FILE` is set, **or** | ||
| - `./sysbench_baseline.conf` exists in the **same folder as `run.sh`** (auto-detected). | ||
|
|
||
| `ALLOWED_DEVIATION` / `--delta` controls tolerance: | ||
|
|
||
| - **Higher-is-better** metrics (MB/s): | ||
| **PASS** if `avg >= baseline * (1 - delta)` | ||
| (recommend **0.05** → “>= 95% of baseline”) | ||
| - **Lower-is-better** metrics (seconds): | ||
| **PASS** if `avg <= baseline * (1 + delta)` | ||
| (recommend **0.05** → “<= 105% of baseline”) | ||
|
|
||
| The console shows a per-metric GATE line and `sysbench_summary.txt` includes a `gate_*` section. | ||
|
|
||
| --- | ||
|
|
||
| ## Baseline file format (`sysbench_baseline.conf`) | ||
|
|
||
| Plain `key=value` format (comments allowed with `#`). Keys are per-thread-count: | ||
|
|
||
| ``` | ||
| # ---- Threads = 4 ---- | ||
| cpu_time_sec.t4=3.483 | ||
| memory_mem_mbps.t4=4120.000 | ||
| threads_time_sec.t4=3.703 | ||
| mutex_time_sec.t4=0.004 | ||
|
|
||
| fileio_seqwr_mbps.t4=0.400 | ||
| fileio_seqrd_mbps.t4=29.300 | ||
| fileio_rndwr_mbps.t4=0.610 | ||
| fileio_rndrd_mbps.t4=29.300 | ||
| ``` | ||
|
|
||
| Use `t1`, `t4`, `t8`, … matching your `THREADS_LIST`. | ||
|
|
||
| --- | ||
|
|
||
| ## Parameters (env vars / CLI) | ||
|
|
||
| The suite is controlled by environment variables (and equivalent CLI flags). Typical params: | ||
|
|
||
| ### Common | ||
| - `OUT_DIR` (default `./sysbench_out`) – where logs / values / summary go | ||
| - `ITERATIONS` (default `1`) | ||
| - `TIME` (default `30`) | ||
| - `RAND_SEED` (default `1234`) | ||
| - `THREADS_LIST` (default `"4"`) – space-separated list of thread counts | ||
| - `TASKSET_CPU_LIST` (default empty) – passed to `taskset -c`, e.g. `"6-7"` | ||
| - `BASELINE_FILE` (default empty; auto-detects `sysbench_baseline.conf` next to `run.sh`) | ||
| - `ALLOWED_DEVIATION` (default `0.10`; recommended `0.05`) | ||
| - `CSV_FILE` (default empty → **no CSV by default**) | ||
|
|
||
| ### CPU | ||
| - `CPU_MAX_PRIME` (default `20000`) | ||
|
|
||
| ### Threads | ||
| - `THREAD_LOCKS` (default `20`) | ||
| - `THREAD_YIELDS` (default empty → sysbench default) | ||
|
|
||
| ### Memory | ||
| - `MEMORY_OPER` (default `write`) – `read|write` | ||
| - `MEMORY_ACCESS_MODE` (default `rnd`) – `seq|rnd` | ||
| - `MEMORY_BLOCK_SIZE` (default `1M`) | ||
| - `MEMORY_TOTAL_SIZE` (default `100G`) | ||
|
|
||
| ### File I/O | ||
| File I/O uses sysbench `fileio` with a **prepare → run → cleanup** flow. | ||
|
|
||
| Recommended knobs (names match the suite params): | ||
| - `FILEIO_DIR` – directory where files are created (recommended: **tmpfs** like `/tmp`) | ||
| - `FILE_TOTAL_SIZE` – total size per file, e.g. `1G` | ||
| - `FILE_BLOCK_SIZE` – e.g. `4K`, `1M` | ||
| - `FILE_NUM` – number of files, e.g. `1`, `4` | ||
| - `FILE_IO_MODE` – e.g. `sync` (stable), `async` | ||
| - `FILE_FSYNC_FREQ` – optional, e.g. `0` (disable) or `1` (every op) | ||
|
|
||
| > Your `run.sh` may expose additional `FILE_*` knobs; keep them documented here as you add them. | ||
|
|
||
| --- | ||
|
|
||
| ## Safety warning for File I/O | ||
|
|
||
| `sysbench fileio` **creates files and performs reads/writes** in `FILEIO_DIR`. | ||
|
|
||
| To avoid accidental wear / regression noise: | ||
| - Prefer `FILEIO_DIR=/tmp/...` (tmpfs) for CI gating. | ||
| - If you must test real storage, point to a **dedicated mount** (not `/`), and keep sizes small. | ||
| - Do **NOT** point fileio at your root filesystem (`/`) unless you fully understand the impact. | ||
|
|
||
| --- | ||
|
|
||
| ## Outputs | ||
|
|
||
| In `OUT_DIR/` you will see: | ||
|
|
||
| - `*_iterN.log` — full sysbench stdout/stderr per test case + iteration | ||
| - `*.values` — one KPI value per iteration (for averaging) | ||
| - `sysbench_summary.txt` — averages + gating summary | ||
| - Optional CSV (only when `CSV_FILE` is set) | ||
|
|
||
| Result file: | ||
| - `./Sysbench_Performance.res` — `PASS` / `FAIL` / `SKIP` | ||
|
|
||
| --- | ||
|
|
||
| ## Examples (using our `run.sh`) | ||
|
|
||
| All examples are run from: | ||
|
|
||
| ``` | ||
| cd Runner/suites/Performance/Sysbench_Performance/ | ||
| ``` | ||
|
|
||
| ### 1) Full suite (CPU + memory + threads + mutex + fileio) | ||
| ``` | ||
| ./run.sh | ||
| ``` | ||
|
|
||
| ### 2) 3 iterations, pin to big cores, tighter gating (95% baseline) | ||
| (Uses `./sysbench_baseline.conf` automatically if present.) | ||
| ``` | ||
| ./run.sh --iterations 3 --threads-list "4" --taskset-cpu-list "6-7" --delta 0.05 | ||
| ``` | ||
|
|
||
| ### 3) Explicit baseline file path | ||
| ``` | ||
| ./run.sh --baseline ./sysbench_baseline.conf --delta 0.05 | ||
| ``` | ||
|
|
||
| ### 4) Enable CSV (NOT default) | ||
| ``` | ||
| ./run.sh --csv ./sysbench_out/sysbench.csv | ||
| ``` | ||
|
|
||
| ### 5) CPU time focus (reduce noise) | ||
| You can’t “run only CPU” without editing the script, but you can reduce runtime: | ||
| ``` | ||
| ./run.sh --iterations 1 --time 15 --cpu-max-prime 20000 --threads-list "4" | ||
| ``` | ||
| Then read: | ||
| - console `ITER_SUMMARY ... cpu_time_sec=...` | ||
| - `OUT_DIR/cpu_t4.values` | ||
| - CSV rows (if enabled) | ||
|
|
||
| ### 6) Memory bandwidth focus (use seq vs rnd) | ||
| ``` | ||
| MEMORY_ACCESS_MODE=seq ./run.sh --iterations 1 --threads-list "4" | ||
| MEMORY_ACCESS_MODE=rnd ./run.sh --iterations 1 --threads-list "4" | ||
| ``` | ||
|
|
||
| ### 7) File I/O on tmpfs (recommended for CI) | ||
| ``` | ||
| FILEIO_DIR=/tmp/sysbench_fileio ./run.sh --iterations 1 --threads-list "4" | ||
| ``` | ||
|
|
||
| ### 8) File I/O heavier workload (be careful) | ||
| ``` | ||
| FILEIO_DIR=/tmp/sysbench_fileio FILE_TOTAL_SIZE=1G FILE_BLOCK_SIZE=4K FILE_NUM=4 ./run.sh --iterations 1 --threads-list "4" | ||
| ``` | ||
|
|
||
| ### 9) Verifying seq/rnd IO KPIs | ||
| After the run, check: | ||
| - `sysbench_summary.txt` for: | ||
| - `fileio_seqwr_mbps`, `fileio_seqrd_mbps`, `fileio_rndwr_mbps`, `fileio_rndrd_mbps` | ||
| - per-iteration logs: | ||
| - `fileio_*_iter*.log` | ||
|
|
||
| --- | ||
|
|
||
| ## LAVA YAML integration | ||
|
|
||
| Your LAVA test definition should: | ||
| - `cd Runner/suites/Performance/Sysbench_Performance/` | ||
| - run `./run.sh` | ||
| - publish `Sysbench_Performance.res` via `send-to-lava.sh` | ||
|
|
||
| Keep `CSV_FILE` empty by default (to avoid extra artifacts) and enable only when you explicitly need CSV. | ||
|
|
||
| --- | ||
|
|
||
| ## License | ||
|
|
||
| Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. | ||
| SPDX-License-Identifier: BSD-3-Clause-Clear |
72 changes: 72 additions & 0 deletions
72
Runner/suites/Performance/Sysbench_Performance/Sysbench_Performance.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,72 @@ | ||
| metadata: | ||
| name: sysbench-performance | ||
| format: "Lava-Test Test Definition 1.0" | ||
| description: "Sysbench performance suite (CPU / memory / threads / mutex + fileio seqwr/seqrd/rndwr/rndrd) with per-iteration logs + summary averages + optional baseline gating." | ||
| os: | ||
| - linux | ||
| scope: | ||
| - performance | ||
| - functional | ||
|
|
||
| params: | ||
| OUT_DIR: "./logs_Sysbench_Performance" | ||
|
|
||
| # Iteration controls | ||
| ITERATIONS: "3" | ||
| TIME: "30" | ||
| RAND_SEED: "1234" | ||
| THREADS_LIST: "4" # space-separated list, e.g. "1 4 8 16" | ||
|
|
||
| # CPU | ||
| CPU_MAX_PRIME: "20000" | ||
|
|
||
| # Threads test | ||
| THREAD_LOCKS: "20" | ||
| THREAD_YIELDS: "" # optional override; empty uses sysbench default | ||
|
|
||
| # Memory test | ||
| MEMORY_OPER: "write" # read|write | ||
| MEMORY_ACCESS_MODE: "rnd" # seq|rnd | ||
| MEMORY_BLOCK_SIZE: "1M" | ||
| MEMORY_TOTAL_SIZE: "100G" # keep explicit for stability | ||
|
|
||
| # Mutex test | ||
| MUTEX_NUM: "" | ||
| MUTEX_LOCKS: "" | ||
| MUTEX_LOOPS: "" | ||
|
|
||
| # Core pinning (optional) | ||
| TASKSET_CPU_LIST: "" | ||
|
|
||
| # Baselines + thresholds (optional gating; empty => report-only) | ||
| # If empty, run.sh may auto-pick ./sysbench_baseline.conf from the test folder (if present) | ||
| BASELINE_FILE: "" | ||
| ALLOWED_DEVIATION: "0.10" # 0.05..0.10 typical | ||
|
|
||
| # Optional CSV append (NOT default). If empty, no CSV is written. | ||
| CSV_FILE: "" | ||
|
|
||
| VERBOSE: "0" # 1|0 | ||
|
|
||
| # ---------------- FileIO (storage-backed) ---------------- | ||
| # IMPORTANT: use storage-backed path (avoid tmpfs if you want stable IO numbers) | ||
| FILEIO_DIR: "/var/tmp/sysbench_fileio" | ||
|
|
||
| # Stable fileio parameters (must match run.sh variable names) | ||
| FILEIO_TOTAL_SIZE: "1G" | ||
| FILEIO_NUM: "64" # <-- FIXED (was FILEIO_NUM_FILES, but run.sh reads FILEIO_NUM) | ||
| FILEIO_BLOCK_SIZE: "4K" | ||
| FILEIO_IO_MODE: "sync" # sync|async | ||
| FILEIO_FSYNC_FREQ: "0" | ||
| FILEIO_EXTRA_FLAGS: "none" # use "none" to disable extra flags in run.sh | ||
|
|
||
| # NOTE: run.sh currently runs all 4 modes (seqwr seqrd rndwr rndrd) unconditionally. | ||
| # If you want FILEIO_MODE_LIST support, run.sh must be updated accordingly. | ||
| # FILEIO_MODE_LIST: "seqwr seqrd rndwr" | ||
|
|
||
| run: | ||
| steps: | ||
| - REPO_PATH=$PWD | ||
| - cd Runner/suites/Performance/Sysbench_Performance/ | ||
| - ./run.sh || true | ||
| - $REPO_PATH/Runner/utils/send-to-lava.sh Sysbench_Performance.res || true | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do you want to add parameters aswell.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
considered only adding minimal CI-stability params (ITERATIONS, THREADS_LIST, ALLOWED_DEVIATION) so runs are reproducible.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
./run.sh --ITERATIONS "$ITERATIONS" --TIME "$TIME" --RAND_SEED "$RAND_SEED" --THREADS_LIST "$THREADS_LIST" || true
Adding this way helps to parse the parameters till run.sh by giving inputs in yaml file