{"id":38498463,"url":"https://github.com/rdkcentral/rdkperf","last_synced_at":"2026-01-17T05:57:15.531Z","repository":{"id":42046717,"uuid":"446400891","full_name":"rdkcentral/rdkperf","owner":"rdkcentral","description":"Lightweight profiling tool for real time performance metrics reporting","archived":false,"fork":false,"pushed_at":"2026-01-02T19:23:45.000Z","size":137,"stargazers_count":5,"open_issues_count":2,"forks_count":4,"subscribers_count":2,"default_branch":"main","last_synced_at":"2026-01-09T08:03:57.735Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rdkcentral.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"COPYING","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":"NOTICE","maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2022-01-10T11:46:44.000Z","updated_at":"2025-09-25T17:48:59.000Z","dependencies_parsed_at":"2025-01-30T14:24:40.112Z","dependency_job_id":"7cc816ac-a94f-492b-8007-7cef96e7a77b","html_url":"https://github.com/rdkcentral/rdkperf","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/rdkcentral/rdkperf","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rdkcentral%2Frdkperf","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rdkcentral%2Frdkperf/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rdkcentral%2Frdkperf/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rdkcentral%2Frdkperf/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rdkcentral","download_url":"https://codeload.github.com/rdkcentral/rdkperf/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rdkcentral%2Frdkperf/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28501351,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-17T04:31:57.058Z","status":"ssl_error","status_checked_at":"2026-01-17T04:31:45.816Z","response_time":85,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-01-17T05:57:14.743Z","updated_at":"2026-01-17T05:57:15.526Z","avatar_url":"https://github.com/rdkcentral.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n\n# **RDKPerf**\n\n## Overview\n\nRDKPerf is a lightweight profiling tool for real time performance metrics reporting.  It allows for easy instrumentation of functions or specific library calls with minimal disruption to the original code flow.  \n\nMetrics reports can be initiated directly from the code or can happen automatically at controlled intervals.  The reporting data will contain a call stack of all instrumented functions so it is possible to see how different code modules are used in conjunction with each other.\n\n\n## License\n[![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Instructions\n\nAdding metrics gathering for a function is as easy as instantiating a RDKPerf object on the stack.   When it is created a timestamp is logged within the object.  When the object is destructed the elapsed time is recoded in a table.\n\nThere are two different constructors.  The simplest form just contains the name of the operation that you want to time.  This is generally the module function name, but can represent a subsection of code, or a specific library call.\n\n    RDKPerf(const char* szName);\n\nThe second form adds a threshold value in microseconds.  If the threshold is reached then a call stack from this point down will be instantly logged.\n\n    RDKPerf(const char* szName, uint32_t nThresholdInUS);\n\nIn C modules start and stop function are provided to abstract the constructor/destructor functionality.\n\n\n    RDKPerfHandle RDKPerfStart(const char* szName);\n    void RDKPerfStop(RDKPerfHandle hPerf);\n    void RDKPerfSetThreshold(RDKPerfHandle hPerf, uint32_t nThresholdInUS);\n\n### Instrumenting module functions\n\nIn C++\n\n    void MyFunction()\n    {\n        RDKPerf perf(__FUNCTION__);\n        \n        for(int nIdx = 0; nIdx \u003c 2; nIdx++) {\n            DoTask(nIdx);\n        }\n    }\n\nIn C\n\n    void MyFunction()\n    {\n        RDKPerfHandle hPerf = RDKPerfStart(__FUNCTION__);\n        \n        for(int nIdx = 0; nIdx \u003c 2; nIdx++) {\n            DoTask(nIdx);\n        }\n\n        RDKPerfStop(hPerf);\n    }\n\n### Instrumenting a section of code or library call.\n\nIn C++\n\n    RDKPerf* decrypt_perf = new RDKPerf(\"session_decrypt\");\n    result = session_decrypt(session, encryptedData, totalEncrypted, mappedIV, mappedIVSize, \n                             mappedKeyID, mappedKeyIDSize, initWithLast15, caps_str, caps_len);\n    delete decrypt_perf;\n\nIn C\n\n    RDKPerfHandle hPerf = RDKPerfStart(\"session_decrypt\");\n    result = session_decrypt(session, encryptedData, totalEncrypted, mappedIV, mappedIVSize, \n                             mappedKeyID, mappedKeyIDSize, initWithLast15, caps_str, caps_len);\n    RDKPerfStop(hPerf);\n\n\n## How to build\n\nAdd the header file to any module that needs instrumentation.\n\n     #include \"rdk_perf.h\"\n\nLink to the library\n\n    LD_FLAGS += -L$(PERF_LIBRARY_LOCATION) -lrdkperf -lperftool\n\n## Logged data\n\nData will be generated with a call to ReportData().  \n\nThere are two variants for this function one to report all data for a given process, and one to report all data for a given thread.\n\n    void RDKPerf_ReportProcess(pid_t pID);\n    void RDKPerf_ReportThread(pthread_t tID);\n\n\n\nThere is also a background timer that calls ReportProcess at ever increasing intervals until it reaches steady state at 10 minute gaps.\n\nHere is an example of collected data. \n\n    ReportData(346) : Found 2 threads in this process 36FF named \u003c/usr/bin/WPEWebProcess\u003e\n    ReportData(197) : Printing report on 990FE270 thread named appsrc3:src\n    ReportData(551) : | root_node (Count, Max, Min, Avg) Total 0, 0.000, 1000000.000, 0.000 Interval 0, 0.000, 1000000.000, 0.000\n    ReportData(551) : --| transform_from_cleardata (Count, Max, Min, Avg) Total 350, 22.577, 1.493, 2.545 Interval 0, 0.000, 1000000.000, 0.000\n    ReportData(551) : --| get_context (Count, Max, Min, Avg) Total 1, 0.362, 0.362, 0.362 Interval 0, 0.000, 1000000.000, 0.000\n    ReportData(551) : --| transform_caps (Count, Max, Min, Avg) Total 9, 0.269, 0.073, 0.134 Interval 0, 0.000, 1000000.000, 0.000\n    ReportData(551) : --| session_decrypt_ex_video (Count, Max, Min, Avg) Total 914, 30.841, 7.232, 9.353 Interval 122, 14.978, 7.255, 9.157\n    ReportData(551) : ----| decrypt_subsample (Count, Max, Min, Avg) Total 914, 20.951, 4.122, 5.504 Interval 122, 11.511, 4.122, 5.337\n    ReportData(551) : ----| transform_subsample (Count, Max, Min, Avg) Total 914, 11.179, 2.831, 3.771 Interval 122, 10.232, 2.942, 3.743\n    ReportData(551) : ------| svp_transform (Count, Max, Min, Avg) Total 914, 11.167, 2.819, 3.751 Interval 122, 10.219, 2.933, 3.727\n    ReportData(551) : --------| Buffer_CopyByIndex (Count, Max, Min, Avg) Total 914, 3.584, 0.644, 0.874 Interval 122, 2.559, 0.674, 0.848\n    ReportData(551) : --------| Buffer_Free (Count, Max, Min, Avg) Total 914, 2.757, 0.597, 0.771 Interval 122, 2.757, 0.607, 0.772\n    ReportData(551) : --------| alloc_token (Count, Max, Min, Avg) Total 914, 0.244, 0.005, 0.012 Interval 122, 0.021, 0.005, 0.011\n    ReportData(551) : --------| buffer_from_token (Count, Max, Min, Avg) Total 914, 0.022, 0.001, 0.002 Interval 122, 0.004, 0.001, 0.002\n    ReportData(551) : ----| token_size (Count, Max, Min, Avg) Total 914, 0.050, 0.001, 0.003 Interval 121, 0.004, 0.001, 0.002\n    ReportData(197) : Printing report on AF738010 thread named WPEWebProcess\n    ReportData(551) : | root_node (Count, Max, Min, Avg) Total 0, 0.000, 1000000.000, 0.000 Interval 0, 0.000, 1000000.000, 0.000\n    ReportData(551) : --| free_context (Count, Max, Min, Avg) Total 2, 33.302, 0.050, 16.676 Interval 2, 33.302, 0.050, 16.676\n    ReportData(551) : --| get_context (Count, Max, Min, Avg) Total 1, 0.267, 0.267, 0.267 Interval 0, 0.000, 1000000.000, 0.000\n    TimerCallback(71) : Next performance log in 100 seconds\n\nThe data identifies the names of the process and threads contained and indicates the name of the instrumented code, it's level in the call stack and some aggregated data about that function.\n\n    ReportData(551) : --| session_decrypt_ex_video (Count, Max, Min, Avg) Total 914, 30.841, 7.232, 9.353 Interval 122, 14.978, 7.255, 9.157\n\nIn this example *session_decrypt_ex_video* is one level below the root node (meaning that this is the top level of instrumentation) and over the life time of the process it has been called 914 times with an average elapsed time of 9.353 milliseconds (max of 30.841 ms and min of 7.232 ms).\n\nWe can also observe the same data broken out since the last time this data was logged\n\n    Interval 122, 14.978, 7.255, 9.157\n\nIn this case the function was called 122 times with an overall average elapsed time of 9.157ms.\n\nBelow that function call *transform_subsample* is two levels below the root node, one level below *session_decrypt_ex_video*.   \n\n    ReportData(551) : ----| transform_subsample (Count, Max, Min, Avg) Total 914, 11.179, 2.831, 3.771 Interval 122, 10.232, 2.942, 3.743\n\nIt also is called at the same cadence of it's parent (914 times) but only accounts for on average 3.771ms of the overall 9.353ms elapsed time.\n\nIt is important to note here is that this does not mean that *session_decrypt_ex_video* called *transform_subsample* directly, only that *transform_subsample* is the next instrumented element in the call stack, there may be several levels of un-instrumented code between these functions.\n\nIf there are no new calls to a specific thread over the reporting interval then it is removed from the table.\n\nAnd lastly \n\n    TimerCallback(71) : Next performance log in 100 seconds\n\nIndicates that the next round of performance data will be logged in 100 seconds\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frdkcentral%2Frdkperf","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frdkcentral%2Frdkperf","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frdkcentral%2Frdkperf/lists"}