Commit b92f4d9
Perf framework: align with .NET Azure.Test.Perf (#7201)
* Perf framework: align with .NET Azure.Test.Perf (Option A parity)
Brings the C++ perf framework (sdk/core/perf) and Storage Blob perf tests
to format / contract parity with the .NET Azure.Test.Perf reference, which
the cross-language perf-automation pipeline keys off.
Framework (sdk/core/perf)
-------------------------
* New per-op latency collector (latency_stats.{hpp,cpp}) emitting the .NET
8-percentile distribution: 50 / 75 / 90 / 99 / 99.9 / 99.99 / 99.999 /
100 with the exact `=== Latency Distribution ===` header and
`{pct,7:N3}% {ms,8:N2}ms` row format.
* New CPU + memory sampler (process_stats.{hpp,cpp}); the throughput
`Completed N operations ... (Y ops/s, Z s/op, P% CPU)` line now
includes inline CPU like .NET while preserving the existing `(... ops/s`
substring that downstream Cpp.cs regex relies on.
* New result_output.{hpp,cpp}:
- `--results-file` writes `[{ "Time": <ms>, "Size": <bytes> }, ...]`
matching .NET OperationResult schema (PascalCase, Size = -1 when test
has no SizeOptions).
- `--statistics` / `--job-statistics` wraps a `BenchmarkOutput`
envelope between `#StartJobStatistics` and `#EndJobStatistics`
with Metadata before Measurements (key order matches .NET).
- Timestamp emitted at 100-nanosecond (7-digit) resolution like
.NET DateTime.ToString("O").
* New versions.{hpp,cpp} printing a `=== Versions ===` block as the
last thing emitted by the run (matches .NET ordering).
* New options: `--status-interval`, `--results-file`, `--sync`
(all present in .NET PerfOptions).
* New non-breaking CLI aliases matching .NET names:
- `--job-statistics` (bare switch) alongside existing `--statistics <0|1>`
- `--no-cleanup` (bare switch) alongside existing `--noclean <0|1>`
* GTest coverage for latency, process_stats, circular_stream, and
result_output (9 tests, all passing).
Storage Blob perf tests (sdk/storage/azure-storage-blobs/test/perf)
-------------------------------------------------------------------
* New blob-test flags aligning the C++ UploadBlob / DownloadBlob / ListBlob
scenarios with the .NET / Go test surface:
- `--upload-method` (buffer | stream | single)
- `--download-method` (buffer | stream)
- `--block-size`, `--concurrency`, `--num-blobs`, `--page-size`
* Memory-budget guard (memory_budget.hpp) prevents OOM in buffer-mode
tests at multi-GiB payloads.
Verification
------------
Built MinSizeRel on Windows / VS 2026 with vcpkg x64-windows-static
(curl, openssl, gtest). All 9 unit tests pass. A live perf run against
the `euap` storage account using AzureCliCredential produced output
that diffs byte-clean against an equivalent .NET Azure.Storage.Blobs.Perf
run for every contract emitted by this change (latency distribution
header / rows, throughput line shape including `% CPU`,
BenchmarkOutput JSON shape and key order, timestamp precision,
Versions-block ordering, results-file schema).
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Perf framework: drop versions.hpp / versions.cpp
The `=== Versions ===` block didn't actually mirror .NET's
PerfProgram.PrintAssemblyVersions: it printed compiler / __cplusplus
strings rather than runtime + Azure assembly versions, no caller ever
populated the `injectedVersions` extension point, and the data the
perf-automation pipeline consumes (the per-test `VCPKG_*_VERSION`
lines and the throughput / latency / BenchmarkOutput contracts) is
unaffected. The module produced output that no parser reads and that
isn't faithful to the framework it claims parity with, so drop it.
Also revert the azure-storage-blobs CHANGELOG entry from the previous
commit: the perf harness is internal and isn't customer-facing.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Storage Blobs perf: drop memory_budget.hpp
The guard threw a friendly std::runtime_error when `--size x --parallel`
would exceed 80%% of system memory, instead of letting buffer-mode
allocations OOM-kill the process. Assuming perf runs target hosts with
enough memory for the configured size, this is dead defensive code: drop
the header and the two `CheckMemoryBudget` calls in
upload_blob_test.hpp / download_blob_test.hpp. Oversized buffer-mode
runs now fail with std::bad_alloc / OS OOM as they would natively.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Perf: fix stack-overflow risk and stale CPU baseline after sampler reset
Addresses two Copilot review comments on PR #7201 that are real bugs:
1. download_blob_test.hpp: the streaming-download per-op loop declared
`uint8_t buffer[1024*1024]` on the stack. On Windows the default
thread stack is 1 MiB, so a single call already overflows; high
`--parallel` makes it worse. Replace with a function-local
`static thread_local std::vector<uint8_t>`: each worker thread
allocates the 1 MiB drain buffer once on the heap and reuses it
across operations.
2. process_stats.cpp: `ProcessStatsSampler::Reset()` updated members
under the mutex but the sampler thread's `Run()` had already cached
`previousCpuSeconds` / `previousTime` in locals, so the first
sample after reset computed cpuDelta / wall against the pre-reset
baseline and reported a wrong CPU%. Reset now stops and restarts the
thread, which forces `Run()` to re-read the fresh baselines.
Verified: 9/9 perf unit tests still pass.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Perf: fix CI validations (ASCII, clang-format, cspell)
- Replace em-dashes with -- in two comments
- Add 'perfstress' to cspell dictionary (used in BenchmarkDotNet-compatible
metric name to match .NET Azure.Test.Perf output)
- Apply clang-format to perf framework files
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Address review feedback: drop --sync, --job-statistics alias, and CPU/memory sampler
Per @jalauzon-msft review on PR #7201:
- Remove --sync (parsed-and-ignored option had no behavior). PerfAutomation
is updated separately to set NoSync=true for the Cpp language so it never
appends --sync to test arguments.
- Remove the --job-statistics bare-switch alias; keep --statistics <0|1>
which is what perf-automation actually invokes.
- Remove the CPU/memory sampler (ProcessStatsSampler) and the associated
' Memory(MiB)' / '% CPU' columns; perf-automation tracks the process
itself, so per-run sampling in C++ added complexity without value.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* perf: accept --sync as a no-op flag for cross-language CLI compatibility
PerfAutomation appends '--sync' to test runs for sync-only languages. C++ has
no async variant, but the driver still passes --sync, so the perf binary must
accept it. Register --sync as a bare switch that is parsed and intentionally
ignored, with no corresponding Sync field on GlobalTestOptions (so it doesn't
show up in the JSON options dump or anywhere else).
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Revert perf-tests.yml additions to avoid confusion
The new --upload-method/--download-method/--block-size/--concurrency/--page-size
flags are available on the binaries but should be tuned per host, not baked
into the CI matrix. Keep perf-tests.yml at the pre-PR baseline.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
---------
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>1 parent 8b9372c commit b92f4d9
17 files changed
Lines changed: 1007 additions & 63 deletions
File tree
- .vscode
- sdk
- core/perf
- inc/azure
- perf
- src
- test
- src
- storage/azure-storage-blobs/test/perf/inc/azure/storage/blobs/test
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
226 | 226 | | |
227 | 227 | | |
228 | 228 | | |
| 229 | + | |
229 | 230 | | |
230 | 231 | | |
231 | 232 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
21 | 22 | | |
22 | 23 | | |
23 | 24 | | |
| 25 | + | |
24 | 26 | | |
25 | 27 | | |
26 | 28 | | |
| |||
30 | 32 | | |
31 | 33 | | |
32 | 34 | | |
| 35 | + | |
33 | 36 | | |
34 | 37 | | |
35 | 38 | | |
| 39 | + | |
36 | 40 | | |
37 | 41 | | |
38 | 42 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| 15 | + | |
15 | 16 | | |
16 | 17 | | |
| 18 | + | |
| 19 | + | |
17 | 20 | | |
18 | 21 | | |
19 | 22 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
108 | 108 | | |
109 | 109 | | |
110 | 110 | | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
111 | 127 | | |
112 | 128 | | |
113 | 129 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
78 | 78 | | |
79 | 79 | | |
80 | 80 | | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
81 | 86 | | |
82 | 87 | | |
83 | 88 | | |
| |||
103 | 108 | | |
104 | 109 | | |
105 | 110 | | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
106 | 119 | | |
107 | 120 | | |
108 | 121 | | |
0 commit comments