-
Notifications
You must be signed in to change notification settings - Fork 82
Add Benchmark COM-RPC interfaces #492
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
Draft
smanes0213
wants to merge
2
commits into
master
Choose a base branch
from
development/Benchmark_QA
base: master
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.
+154
−1
Draft
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
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
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,71 @@ | ||
| #pragma once | ||
|
|
||
| #include "Module.h" | ||
|
|
||
| // @stubgen:include <com/IIteratorType.h> | ||
|
|
||
| namespace Thunder { | ||
| namespace QualityAssurance { | ||
|
|
||
| // @json 1.0.0 @text:legacy_lowercase | ||
| struct EXTERNAL IBenchmark : virtual public Core::IUnknown { | ||
| enum { ID = ID_BENCHMARK }; | ||
|
|
||
| ~IBenchmark() override = default; | ||
|
|
||
| struct RoundTripStats { | ||
| uint64_t minNs; | ||
| uint64_t avgNs; | ||
| uint64_t maxNs; | ||
| uint64_t stddevNs; | ||
| }; | ||
|
|
||
| struct MemoryStats { | ||
| uint64_t residentBefore; // RSS in bytes before benchmark | ||
| uint64_t residentAfter; // RSS in bytes after benchmark | ||
| uint64_t allocatedBefore; // Allocated in bytes before benchmark | ||
| uint64_t allocatedAfter; // Allocated in bytes after benchmark | ||
| }; | ||
|
|
||
|
|
||
| struct BenchmarkResult { | ||
| string apiName; | ||
| uint32_t iterations; | ||
|
|
||
| RoundTripStats roundTrip; | ||
| MemoryStats memory; | ||
|
|
||
| bool passed; // true if within configured thresholds | ||
| string failureReason; // empty if passed, describes which threshold was exceeded | ||
| }; | ||
|
|
||
| typedef RPC::IIteratorType<BenchmarkResult, ID_BENCHMARK_RESULT_ITERATOR> IBenchmarkResultIterator; | ||
|
|
||
| // @brief Run the benchmark | ||
| // @param iterations: Denotes the number of iterations the benchmark should run | ||
| // @param success: True if the benchmark completed successfully | ||
| virtual Core::hresult Trigger(const uint32_t iterations, bool& success /* @out */) = 0; | ||
|
|
||
| virtual Core::hresult CollectData(IBenchmarkResultIterator*& report /* @out */) const = 0; | ||
|
|
||
| // @brief Set pass/fail thresholds for benchmark results | ||
| // @param maxLatencyDeviationPct: Maximum allowed % deviation in avg latency compared to first-run baseline (0 = no latency check) | ||
| // @param maxMemoryGrowthBytes: Maximum allowed RSS growth in bytes per method (0 = no memory check) | ||
| // @param success: True if thresholds were set | ||
| virtual Core::hresult SetThreshold(const float maxLatencyDeviationPct, const uint64_t maxMemoryGrowthBytes, bool& success /* @out */) = 0; | ||
|
|
||
| // @event | ||
| struct EXTERNAL INotification : virtual public Core::IUnknown { | ||
| enum { ID = ID_BENCHMARK_NOTIFICATION }; | ||
|
|
||
| ~INotification() override = default; | ||
|
|
||
| virtual void PerformanceCheckCompleted() = 0; | ||
| }; | ||
|
|
||
| virtual Core::hresult Register(const IBenchmark::INotification* sink) = 0; | ||
| virtual Core::hresult Unregister(const IBenchmark::INotification* sink) = 0; | ||
| }; | ||
|
|
||
| } | ||
| } | ||
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,76 @@ | ||
| #pragma once | ||
| #include "Module.h" | ||
|
|
||
| // @stubgen:include <com/IIteratorType.h> | ||
|
|
||
| namespace Thunder { | ||
| namespace QualityAssurance { | ||
|
|
||
|
|
||
| struct SampleData | ||
| { | ||
| uint32_t id; | ||
| uint32_t value; | ||
| string name; | ||
| }; | ||
|
|
||
| struct EXTERNAL IBenchmarkPayload : virtual public Core::IUnknown | ||
| { | ||
| enum { ID = ID_BENCHMARK_PAYLOAD }; | ||
|
|
||
| enum PayloadType : uint8_t | ||
| { | ||
| PAYLOAD_UNKNOWN, | ||
| PAYLOAD_SMALL, | ||
| PAYLOAD_MEDIUM, | ||
| PAYLOAD_LARGE | ||
| }; | ||
|
|
||
| typedef RPC::IIteratorType<PayloadType, ID_PAYLOADTYPE_ITERATOR> IPayloadTypeIterator; | ||
|
|
||
| virtual uint32_t GetPayloadTypes(IPayloadTypeIterator*& types /* @out */) const = 0; | ||
|
|
||
| virtual uint32_t SendUint16(const uint16_t value) = 0; | ||
|
|
||
| virtual uint32_t SendUint32(const uint32_t value) = 0; | ||
|
|
||
| virtual uint32_t SendUint64(const uint64_t value) = 0; | ||
|
|
||
| virtual uint32_t SendBool(const bool value) = 0; | ||
|
|
||
| virtual uint32_t SendFloat(const float value) = 0; | ||
|
|
||
| virtual uint32_t SendDouble(const double value) = 0; | ||
|
|
||
| virtual uint32_t SendString(const string& value) = 0; | ||
|
|
||
| virtual uint32_t SendSampleData(const SampleData& data) = 0; | ||
|
|
||
| virtual uint32_t SendWithNoParameters() = 0; | ||
|
|
||
| virtual uint32_t SendBuffer(const uint16_t bufferSize, const uint8_t buffer[] /* @length:bufferSize @in */) = 0; | ||
|
|
||
| virtual uint32_t SendReceiveUint16(const uint16_t input, uint16_t &output /* @out */) const = 0; | ||
|
|
||
| virtual uint32_t SendReceiveUint32(const uint32_t input, uint32_t &output /* @out */) const = 0; | ||
|
|
||
| virtual uint32_t SendReceiveUint64(const uint64_t input, uint64_t &output /* @out */) const = 0; | ||
|
|
||
| virtual uint32_t SendReceiveBool(const bool input, bool &output /* @out */) const = 0; | ||
|
|
||
| virtual uint32_t SendReceiveFloat(const float input, float &output /* @out */) const = 0; | ||
|
|
||
| virtual uint32_t SendReceiveDouble(const double input, double &output /* @out */) const = 0; | ||
|
|
||
| virtual uint32_t SendReceiveString(const string &input, string &output /* @out */) const = 0; | ||
|
|
||
| virtual uint32_t SendReceiveSampleData(const SampleData &input, SampleData &output /* @out */) const = 0; | ||
|
|
||
| virtual uint32_t SendReceiveBuffer(uint16_t& bufferSize /* @inout */, uint8_t buffer[] /* @length:bufferSize @inout */) const = 0; | ||
|
|
||
| virtual uint32_t Add(const uint32_t a, const uint32_t b, uint32_t &result /* @out */) const = 0; | ||
|
smanes0213 marked this conversation as resolved.
|
||
|
|
||
| ~IBenchmarkPayload() override = default; | ||
| }; | ||
| } | ||
| } | ||
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
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.
Uh oh!
There was an error while loading. Please reload this page.