-
Notifications
You must be signed in to change notification settings - Fork 51
Add BenchmarkSystem that implements benchmarking #52
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
base: main
Are you sure you want to change the base?
Conversation
c4857f0 to
e6648b5
Compare
|
I fixed minor issue with printing percentages: |
e6648b5 to
5291159
Compare
|
|
||
| BenchmarkSystem::BenchmarkSystem( | ||
| ::async::ContextType const context, | ||
| ::lifecycle::ILifecycleManager& lifecycleManager, |
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.
Unused parameter
| #include <mcu/mcu.h> | ||
| #include <runtime/StatisticsContainer.h> | ||
|
|
||
| #define GET_HW_COUNTER() (DWT->CYCCNT) |
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.
I guess this is defined as a macro just to clarify that "CYCCNT" is a HW counter? It would be more common to not have a macro, but maybe just a comment above the first usage telling what it is. This habit originates from Misra that discourages using function-like macros.
| src/main.cpp) | ||
|
|
||
| if (BUILD_BENCHMARK) | ||
| target_sources(app.referenceApp PRIVATE src/systems/BenchmarkSystem.cpp) |
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.
Should we maybe add a check here that prevents the benchmarking build on Posix? This might be slightly out of place, but currently it will fail due to a compiler error which is also not good. So you could just add:
if (BUILD_TARGET_PLATFORM STREQUAL "POSIX") message(FATAL_ERROR "Benchmarking not supported on POSIX") endif ()
| @@ -0,0 +1,10 @@ | |||
| // Copyright 2024 Accenture. | |||
|
|
|||
| #ifndef GUARD_A2388DF9_4B35_42D5_8B75_DFC18C21C372 | |||
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.
We should use "#pragma once" now
| ::estd::typed_mem<::systems::DemoSystem> demoSystem; | ||
| #else | ||
| ::estd::typed_mem<::systems::BenchmarkSystem> benchmarkSystem; | ||
| #endif |
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.
Please do some regrouping to keep this clearer, eg:
#ifdef BENCHMARK
::estd::typed_mem<::systems::BenchmarkSystem> benchmarkSystem;
#else
::estd::typed_mem<::systems::RuntimeSystem> runtimeSystem;
::estd::typed_mem<::systems::DemoSystem> demoSystem;
#endif
::estd::typed_mem<::systems::SysAdminSystem> sysAdminSystem;
::estd::typed_mem<::systems::SafetySystem> safetySystem;
|
|
||
| void enterTask(size_t const taskIdx) | ||
| { | ||
| #ifdef BENCHMARK |
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.
Ifdefs make the code less testable so I think we should use them sparingly in the common code under libs/bsw. Since this file isn't even 200 lines long, maybe you could just create a copy like RuntimeMonitorSimple.h instead of modifying the original?
doc/learning/benchmark/index.rst
Outdated
| The reference app can be built to run benchmark tests. There is a BenchmarkSystem class that | ||
| implements the following tests: | ||
|
|
||
| * interrupt latency test - to measure the time between raising the interrupt line and entering the ISR, |
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.
Bullet point lists don't need commas at the end of entries
ec827d2 to
1b7f114
Compare
|
@hbragge-acn : addressed review comments |
hbragge-acn
left a comment
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.
Looks good
1b7f114 to
9c1e347
Compare
Added these benchmark tests: - interrupt latency test, - task switch latency test, - task switch after timeout latency test, - load benchmark test. Signed-off-by: Marcin Wierzbicki <[email protected]>
9c1e347 to
aad8478
Compare
|
fixed code formatting |
originates from CR #124398