Skip to content

Conversation

@marcmo
Copy link
Contributor

@marcmo marcmo commented Jan 20, 2025

originates from CR #124398

@marcin-wierzbicki
Copy link
Contributor

I fixed minor issue with printing percentages:

-        "Load test: CPU idle: %d.%d %% (load) (LOAD_COUNTER_LIMIT: 0x%x)\n",
+        "Load test: CPU idle: %d.%02d %% (load) (LOAD_COUNTER_LIMIT: 0x%x)\n",


BenchmarkSystem::BenchmarkSystem(
::async::ContextType const context,
::lifecycle::ILifecycleManager& lifecycleManager,
Copy link
Contributor

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)
Copy link
Contributor

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)
Copy link
Contributor

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
Copy link
Contributor

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
Copy link
Contributor

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
Copy link
Contributor

@hbragge-acn hbragge-acn May 6, 2025

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?

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,
Copy link
Contributor

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

@marcin-wierzbicki marcin-wierzbicki force-pushed the cr-124398 branch 2 times, most recently from ec827d2 to 1b7f114 Compare May 7, 2025 13:40
@marcin-wierzbicki
Copy link
Contributor

@hbragge-acn : addressed review comments

Copy link
Contributor

@hbragge-acn hbragge-acn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good

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]>
@marcin-wierzbicki
Copy link
Contributor

fixed code formatting

@rolandreichweinbmw rolandreichweinbmw marked this pull request as draft October 21, 2025 08:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants