RDKPerf introduced in Rialto Server#488
Conversation
|
Pull request must be merged with a description containing the required fields, Summary: If there is no jira releated to this change, please put 'Jira: NO-JIRA'. Description can be changed by editing the top comment on your pull request and making a new commit. |
There was a problem hiding this comment.
Pull request overview
Integrates rdk_perf instrumentation into the Rialto server startup path, and attempts to add the required perf libraries to the build so the server can be linked with the new dependency.
Changes:
- Add
rdk_perf.hinclude and instantiate anRDKPerfRAII object inRialtoServer’smain(). - Add
rdkperf/perftoollink dependencies to theRialtoCommonCMake target.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| media/server/service/source/main.cpp | Adds RDKPerf startup instrumentation in main(). |
| common/CMakeLists.txt | Adds perf libraries to RialtoCommon link interface. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| const char kSrcRev[] = SRCREV; | ||
| const char kTags[] = TAGS; | ||
|
|
||
| RDKPerf perf(__FUNCTION__); |
There was a problem hiding this comment.
RDKPerf perf(__FUNCTION__); is never referenced. With repo-wide -Wall -Werror enabled, this is likely to fail the build due to -Wunused-variable. If the object is meant to exist only for RAII timing, mark it [[maybe_unused]] (or otherwise explicitly suppress the unused-variable warning) so the build remains warning-free.
| RDKPerf perf(__FUNCTION__); | |
| [[maybe_unused]] RDKPerf perf(__FUNCTION__); |
| PUBLIC | ||
| rdkperf perftool |
There was a problem hiding this comment.
Linking rdkperf/perftool as PUBLIC dependencies of RialtoCommon makes every consumer (client, serverManager, tests, etc.) transitively require these external libraries, even though the new usage is only in the server's main.cpp. This can break builds/environments that don't ship these libs and also increases coupling; instead, link these dependencies only in the specific target(s) that use them (e.g., the server executable or a dedicated perf target), and add proper find_package/find_library/imported-target discovery so CMake fails early with a clear error when the dependency isn't available.
| PUBLIC | |
| rdkperf perftool |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated 7 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| // GstAppSrc does not replace segment, if it's the same as previous one. | ||
| // It causes problems with position reporing in amlogic devices, so we need to push | ||
| // two segments with different reset time value. | ||
| RDKPerf perf(__FUNCTION__); |
There was a problem hiding this comment.
perf is only created for RAII side-effects and is otherwise unused; with -Wall -Werror this is likely to trigger -Wunused-variable in some build configurations. Please mark it as intentionally unused (e.g. [[maybe_unused]] or a project macro) to avoid build failures.
| RDKPerf perf(__FUNCTION__); | |
| [[maybe_unused]] RDKPerf perf(__FUNCTION__); |
| STATIC | ||
|
|
||
| source/EventThread.cpp |
There was a problem hiding this comment.
Whitespace-only blank line introduced here (line contains spaces). Please remove trailing whitespace to avoid noisy diffs / potential lint failures.
| PUBLIC | ||
|
|
||
| interface |
There was a problem hiding this comment.
Whitespace-only blank line introduced here (line contains spaces). Please remove trailing whitespace to avoid noisy diffs / potential lint failures.
|
|
||
| appSessionServer->startService(); | ||
|
|
There was a problem hiding this comment.
There are whitespace-only lines introduced here (blank lines containing spaces / trailing whitespace). Please remove the trailing whitespace to avoid formatting/lint issues and noisy diffs.
| appSessionServer->startService(); | |
| appSessionServer->startService(); |
|
|
||
| void GstGenericPlayer::pushSampleIfRequired(GstElement *source, const std::string &typeStr) | ||
| { | ||
|
|
There was a problem hiding this comment.
Whitespace-only blank line introduced at the start of the function body. Please remove trailing whitespace to avoid noisy diffs / potential lint failures.
| #include "rdk_perf.h" | ||
|
|
There was a problem hiding this comment.
This adds a dependency on the external rdk_perf.h header, but the repo doesn't vendor it and the native dependency install script doesn't install rdkperf. To keep NATIVE_BUILD/CI builds working, please either (a) add proper dependency discovery + installation (and include dirs) for rdkperf, or (b) guard this include/instrumentation behind a build option and provide a stub implementation when rdkperf isn't available. Also consider using angle brackets for third-party headers (#include <rdk_perf.h>) to match other external includes in this file.
| #include "rdk_perf.h" | |
| #if defined(__has_include) | |
| #if __has_include(<rdk_perf.h>) | |
| #include <rdk_perf.h> | |
| #define RIALTO_HAS_RDK_PERF 1 | |
| #endif | |
| #endif | |
| #ifndef RIALTO_HAS_RDK_PERF | |
| class RDKPerf | |
| { | |
| public: | |
| explicit RDKPerf(const char *) {} | |
| }; | |
| #endif |
| #include "rdk_perf.h" | ||
|
|
There was a problem hiding this comment.
This introduces a dependency on external rdk_perf.h in the server gstplayer component, but the repo doesn't provide it and there’s no CMake discovery/guard for environments where rdkperf isn't present (e.g. native builds). Please add a build option / availability check (with a stub) or wire rdkperf in via find_package/pkg-config and include dirs. Also consider switching to #include <rdk_perf.h> to keep external header style consistent with other third-party includes (e.g. <gst/gst.h>).
| #include "rdk_perf.h" | |
| #if defined(__has_include) | |
| #if __has_include(<rdk_perf.h>) | |
| #include <rdk_perf.h> | |
| #define RIALTO_HAS_RDK_PERF 1 | |
| #else | |
| #define RIALTO_HAS_RDK_PERF 0 | |
| #endif | |
| #else | |
| #include <rdk_perf.h> | |
| #define RIALTO_HAS_RDK_PERF 1 | |
| #endif | |
| #if !RIALTO_HAS_RDK_PERF | |
| #ifndef RDK_PERF_EVENT_ON | |
| #define RDK_PERF_EVENT_ON(...) ((void)0) | |
| #endif | |
| #ifndef RDK_PERF_EVENT_OFF | |
| #define RDK_PERF_EVENT_OFF(...) ((void)0) | |
| #endif | |
| #ifndef RDK_PERF_START | |
| #define RDK_PERF_START(...) ((void)0) | |
| #endif | |
| #ifndef RDK_PERF_STOP | |
| #define RDK_PERF_STOP(...) ((void)0) | |
| #endif | |
| #ifndef RDK_PERF_START_TS | |
| #define RDK_PERF_START_TS(...) ((void)0) | |
| #endif | |
| #ifndef RDK_PERF_STOP_TS | |
| #define RDK_PERF_STOP_TS(...) ((void)0) | |
| #endif | |
| #endif |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 16 out of 16 changed files in this pull request and generated 5 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| // GstAppSrc does not replace segment, if it's the same as previous one. | ||
| // It causes problems with position reporing in amlogic devices, so we need to push | ||
| // two segments with different reset time value. | ||
| auto perf = m_rdkPerfWrapperFactory->createRdkPerfWrapper(__FUNCTION__); |
There was a problem hiding this comment.
perf is never used, and the repo builds with -Werror, so this will fail compilation due to -Wunused-variable. If the intent is RAII timing, mark it [[maybe_unused]] or explicitly cast to void while keeping it in scope.
| auto perf = m_rdkPerfWrapperFactory->createRdkPerfWrapper(__FUNCTION__); | |
| auto perf = m_rdkPerfWrapperFactory->createRdkPerfWrapper(__FUNCTION__); | |
| static_cast<void>(perf); |
| ${WPEFRAMEWORK_COM_INCLUDE_DIRS} | ||
| ${rdkperf_INCLUDE_DIRS} | ||
| ) |
There was a problem hiding this comment.
${rdkperf_INCLUDE_DIRS} is referenced here, but this CMakeLists doesn’t define it via pkg_check_modules(...)/find_package(...). This can leave the include path empty and make the build depend on rdk_perf headers being in a global include directory. Add proper rdkperf discovery and set the include dirs from that result.
| source/ThunderWrapper.cpp | ||
| source/RdkPerfWrapper.cpp | ||
| source/RdkPerfWrapperFactoryAccessor.cpp) |
There was a problem hiding this comment.
source/RdkPerfWrapperFactoryAccessor.cpp is added under WRAPPER_SOURCES, which is excluded for UnitTests/ComponentTests. This can leave IRdkPerfWrapperFactory::createFactory() undefined at link time in those builds. Move the factory accessor file into the unconditional add_library(RialtoWrappers ...) source list (keep only the concrete impl gated by WRAPPERS_ENABLED).
| void ReadShmDataAndAttachSamples::execute() const | ||
| { | ||
| RIALTO_SERVER_LOG_DEBUG("Executing ReadShmDataAndAttachSamples"); | ||
| auto perf = m_rdkPerfWrapperFactory->createRdkPerfWrapper(__FUNCTION__); |
There was a problem hiding this comment.
perf is never used, and the build uses -Werror, so this will fail compilation with -Wunused-variable. If this is RAII-only instrumentation, mark it [[maybe_unused]] or cast to void while keeping it alive for the intended scope.
| auto perf = m_rdkPerfWrapperFactory->createRdkPerfWrapper(__FUNCTION__); | |
| [[maybe_unused]] auto perf = m_rdkPerfWrapperFactory->createRdkPerfWrapper(__FUNCTION__); |
| #include "TypeConverters.h" | ||
| #include "Utils.h" | ||
| #include "WorkerThread.h" | ||
| #include "rdk_perf.h" |
There was a problem hiding this comment.
#include "rdk_perf.h" introduces a direct dependency on the external rdk_perf headers for the gstplayer target. This file doesn’t use any rdk_perf types/symbols (it uses the wrapper factory), so the include should be removed to avoid build failures when rdk_perf headers aren’t on this target’s include path (e.g., native/unit/component builds).
| #include "rdk_perf.h" |
|
Coverage statistics of your commit: |
|
stubs/rdk_perf/rdk_perf.h:25:5: style: Class 'RDKPerf' has a constructor with 1 argument that is not explicit. [noExplicitConstructor] |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 33 out of 33 changed files in this pull request and generated 9 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| context.currentPosition[GST_ELEMENT(&audioSrc)] = | ||
| SegmentData{kPosition, kResetTime, kAppliedRate, kStopPosition}; | ||
| }); | ||
| EXPECT_CALL(*m_rdkPerfWrapperFactoryMock, createRdkPerfWrapper(_)).WillOnce(Return(nullptr)); |
| set(WRAPPER_INCLUDES | ||
| ${OCdm_INCLUDE_DIRS} | ||
| ${WPEFRAMEWORK_CORE_INCLUDE_DIRS} | ||
| ${WPEFRAMEWORK_COM_INCLUDE_DIRS} | ||
| ${rdkperf_INCLUDE_DIRS} | ||
| ) | ||
|
|
||
| set(WRAPPER_LIBS | ||
| rdkgstreamerutils | ||
| ocdm::ocdm | ||
| WPEFrameworkCore::WPEFrameworkCore | ||
| WPEFrameworkCOM::WPEFrameworkCOM | ||
| rdkperf |
| ) | ||
|
|
||
| install ( | ||
| TARGETS rdkperf LIBRARY |
|
|
||
| void GenericTasksTestsBase::shouldCreatePerfWrapper() | ||
| { | ||
| EXPECT_CALL(*testContext->m_rdkPerfWrapperFactory, createRdkPerfWrapper(_)).WillOnce(Return(nullptr)); |
| SegmentData{kPosition, kResetTime, kAppliedRate, kStopPosition}); | ||
| context.streamInfo[firebolt::rialto::MediaSourceType::VIDEO].appSrc = GST_ELEMENT(&videoSrc); | ||
| }); | ||
| EXPECT_CALL(*m_rdkPerfWrapperFactoryMock, createRdkPerfWrapper(_)).WillOnce(Return(nullptr)); |
| SegmentData{kPosition, kDoNotResetTime, kAppliedRate, kStopPosition}); | ||
| context.streamInfo[firebolt::rialto::MediaSourceType::VIDEO].appSrc = GST_ELEMENT(&videoSrc); | ||
| }); | ||
| EXPECT_CALL(*m_rdkPerfWrapperFactoryMock, createRdkPerfWrapper(_)).WillOnce(Return(nullptr)); |
| SegmentData{kPosition, kDoNotResetTime, kAppliedRate, kUndefinedPosition}); | ||
| context.streamInfo[firebolt::rialto::MediaSourceType::VIDEO].appSrc = GST_ELEMENT(&videoSrc); | ||
| }); | ||
| EXPECT_CALL(*m_rdkPerfWrapperFactoryMock, createRdkPerfWrapper(_)).WillOnce(Return(nullptr)); |
| SegmentData{kPosition, kResetTime, kAppliedRate, kStopPosition}); | ||
| context.streamInfo[firebolt::rialto::MediaSourceType::AUDIO].appSrc = GST_ELEMENT(&audioSrc); | ||
| }); | ||
| EXPECT_CALL(*m_rdkPerfWrapperFactoryMock, createRdkPerfWrapper(_)).WillOnce(Return(nullptr)); |
| const char kSrcRev[] = SRCREV; | ||
| const char kTags[] = TAGS; | ||
|
|
||
| auto perf = firebolt::rialto::wrappers::IRdkPerfWrapperFactory::createFactory()->createRdkPerfWrapper(__FUNCTION__); |
|
Coverage statistics of your commit: |
Summary: RDKPerf introduced in Rialto Server
Type: Feature
Test Plan: UT/CT, Fullstack
Jira: RDKEMW-17139