On this Page:

Scope


RDK PROC ANALYZER is a tool that helps in analyzing the CPU and memory utilization of the processes that run on top of RDK framework. It helps us in detecting the memory leaks, cpu and memory performance regressions. This tool is implemented as a service  and is also highly configurable( Parameters like period , time interval and processes to be monitored can be configured).

RDK PROC ANALYZER supported in RDK-B and RDK-V environment . This is page focus more on RDK-B specific . 


Enable cpuprocanalyzer in Rpi build


Rpi default build target doesn't include cpurprocanalyzer tool. To include it in the build, make sure below changes are present

Check the recipe has correct path to fetch the repo : meta-rdk/recipes-common/sys_mon_tools/cpuprocanalyzer_git.bb

Currently cpurprocanalyzer repo is available only in rdk-next branch, not in CMF release. So make sure CMF_GIT_BRANCH points to rdk-next.

Otherwise change the SRC_URI as below

diff --git a/recipes-common/sys_mon_tools/cpuprocanalyzer_git.bb b/recipes-common/sys_mon_tools/cpuprocanalyzer_git.bb
index 5d62ab1..fdea9ab 100644
--- a/recipes-common/sys_mon_tools/cpuprocanalyzer_git.bb
+++ b/recipes-common/sys_mon_tools/cpuprocanalyzer_git.bb
@@ -3,7 +3,8 @@ LICENSE = "Apache-2.0"
 LIC_FILES_CHKSUM = "file://LICENSE;md5=175792518e4ac015ab6696d16c4f607e"

 SRCREV = "${AUTOREV}"
-SRC_URI = "${CMF_GIT_ROOT}/rdk/components/generic/cpuprocanalyzer;protocol=${CMF_GIT_PROTOCOL};branch=${CMF_GIT_BRANCH};name=cpuprocanalyzer"
+#SRC_URI = "${CMF_GIT_ROOT}/rdk/components/generic/cpuprocanalyzer;protocol=${CMF_GIT_PROTOCOL};branch=${CMF_GIT_BRANCH};name=cpuprocanalyzer"
+SRC_URI = "${CMF_GIT_ROOT}/rdk/components/generic/cpuprocanalyzer;protocol=${CMF_GIT_PROTOCOL};branch=rdk-next;name=cpuprocanalyzer"
 S = "${WORKDIR}/git"  


Make sure the recipe is not masked in build.

Remove or comment out the BBMASK in  meta-cmf-raspberrypi/conf/include/rdk-bbmasks-rdkb-platform.inc

diff --git a/conf/include/rdk-bbmasks-rdkb-platform.inc b/conf/include/rdk-bbmasks-rdkb-platform.inc
index 9fbd7b2..c0bdaf1 100644
--- a/conf/include/rdk-bbmasks-rdkb-platform.inc
+++ b/conf/include/rdk-bbmasks-rdkb-platform.inc
@@ -3,7 +3,6 @@ BBMASK .= "|meta-rdk/recipes-support/base64"
 BBMASK .= "|meta-rdk/recipes-common/rdkversion/"
 BBMASK .= "|meta-cmf/recipes-common/rdkversion/"

-BBMASK .= "|meta-rdk/recipes-common/sys_mon_tools/cpuprocanalyzer_git.bb"
 BBMASK .= "|meta-cmf/recipes-common/sys_mon_tools/cpuprocanalyzer_git.bbappend"


Add and enable DISTRO FEATURE in platform specific machine conf file - meta-cmf-raspberrypi/recipes-core/packagegroups/packagegroup-rdk-ccsp-broadband.bbappend

--- a/recipes-core/packagegroups/packagegroup-rdk-ccsp-broadband.bbappend
+++ b/recipes-core/packagegroups/packagegroup-rdk-ccsp-broadband.bbappend
@@ -6,6 +6,7 @@ RDEPENDS_packagegroup-rdk-ccsp-broadband_append = "\
     libseshat \
     notify-comp \
     start-parodus \
+    cpuprocanalyzer \
     \
 "


Add below build specific flags for broadband platform, in a bbappend file  - meta-cmf-raspberrypi/meta-rdk-broadband/recipes-rdkb/sys_mon_tools/cpuprocanalyzer_git.bbappend


EXTRA_OECONF_append = " ${@bb.utils.contains('DISTRO_FEATURES', 'PROCANALYZER_BROADBAND', ' --enable-procanalyzer-broadband', '', d)}"
DEPENDS += "telemetry json-c"

CFLAGS_append = " -DPROCANALYZER_BROADBAND"


With above changes, the Rpi build will have cpuprocanalyzer in device - /usr/bin/cpuprocanalyzer

For Rpi build instruction, follow - RDK-B (Raspberry Pi) Build and Setup Manual - Router Profile#BuildInstructionsandFlashingProcedure


TR181 to configure


Dmcli's to configure Procanalyzer:

1. dmcli eRT setv Device.SelfHeal.CPUProcAnalyzer.SleepInterval uint 60
        - Interval of time in seconds, for which the tool records the information. DEFAULT VALUE : 60secs

2. dmcli eRT setv Device.SelfHeal.CPUProcAnalyzer.TimeToRun uint 600
        - Amount of time, in seconds, the tool runs. DEFAULT VALUE : 600secs

3. dmcli eRT setv Device.SelfHeal.CPUProcAnalyzer.MemoryLimit uint 1536
        - To set the maximum memory limit(in KB) for the proc analyzer, since some platform has memory constraints. DEFAULT VALUE : 1.5MB

4. dmcli eRT setv Device.SelfHeal.CPUProcAnalyzer.MonitorAllProcess bool 0
        - This flag is set in order to monitor all the processes running in the device. DEFAULT VALUE : 0
                Monitor All process = 1 → indicates the tool to monitor all the processes.
                Monitor All process = 0 → indicates NOT TO monitor all the processes.

5. dmcli eRT setv Device.SelfHeal.CPUProcAnalyzer.DynamicProcess bool 0
        - This is a flag to disable and enable the capturing of dynamic processes, like some scripts or something that runs for a short span.
           DEFAULT VALUE : 0
                DynamicProcess = 1 -> enable monitoring dynamic process
                DynamicProcess = 0 -> disable monitoring dynamic process

6. dmcli eRT setv Device.SelfHeal.CPUProcAnalyzer.ProcessList string CcspLMLite,CcspPandMSsp
        - List of Processes that needs to be monitored. If the list of processes is not configured, then only the system level data will get captured.

7. dmcli eRT setv Device.SelfHeal.CPUProcAnalyzer.ProcessStatsToMonitor string cpu,memory,fd,thread
        - List of resources that needs to monitored on process level. This also provides flexibility in configuring whatever is required. Any combination is allowed.
           Example : If this is set to cpu,fd - then only the cpu usage of the process and the number of File descriptors will get captured.
           DEFAULT VALUE : cpu,memory,fd,thread
                  cpu          -   cpu usage of a process
                  memory  -   memory consumed by a process
                  fd            -   Number of file descriptors opened for a process
                  thread     -   Number of threads created under a process
    
8. dmcli eRT setv Device.SelfHeal.CPUProcAnalyzer.SystemStatsToMonitor string cpu,memory,fd,loadavg,cliconnected
        - List of resources that needs to monitored on the system level. This also provides flexibility in configuring whatever is needed. Any combination is allowed.
           Example : If this is set to cpu,loadavg - then only the cpu usage of the system and the load average of the system will get captured.
           DEFAULT VALUE : cpu,memory,fd,loadavg,cliconnected
                 cpu                 -   cpu usage of the device
                 memory          -  memory consumed by the device
                 fd                    -  Number of file descriptors opened for the entire system
                 loadavg          -  Load average of the system
                 cliconnected   -  Total number of clients connected to the device

9. dmcli eRT setv Device.SelfHeal.CPUProcAnalyzer.TelemetryOnly bool 0
        - Enabling this flag will upload the data captured with a telemetry marker. Data will not be stored in the device. .data file will be empty.


This settings will generate configuration file in Rpi 

root@RaspberryPi-Gateway:~# cat /nvram/procanalyzerconfig.ini
FEATURE.CPUPROCANALYZER.SleepInterval = 60
FEATURE.CPUPROCANALYZER.DynamicProcess = 0
FEATURE.CPUPROCANALYZER.MonitorAllProcess = 0
FEATURE.CPUPROCANALYZER.MemoryLimit = 1536
FEATURE.CPUPROCANALYZER.SystemStatsToMonitor = cpu,memory,fd,loadavg,cliconnected
FEATURE.CPUPROCANALYZER.ProcessStatsToMonitor = cpu,memory,fd,thread
FEATURE.CPUPROCANALYZER.TelemetryOnly = 0
FEATURE.CPUPROCANALYZER.TimeToRun = 600
root@RaspberryPi-Gateway:~#

Start ProcAnalyzer & View Report


To start cpuprocanalyzer, enable the tr181 with below command

dmcli eRT setv Device.SelfHeal.CPUProcAnalyzer.Enable bool true

root@RaspberryPi-Gateway:~# pidof cpuprocanalyzer
1926
root@RaspberryPi-Gateway:~#


Report will be generated in below path in Rpi


root@RaspberryPi-Gateway:~# ls /tmp/cpuprocanalyzer/
1046_CcspPandMSsp  deviceinfo.data    dynamic            loadandmem.data    selectedps.list
root@RaspberryPi-Gateway:~#
root@RaspberryPi-Gateway:~# tar cvzf /nvram/cpuproc_PandM.tgz /tmp/cpuprocanalyzer/*
tar: removing leading '/' from member names
tmp/cpuprocanalyzer/1046_CcspPandMSsp/
tmp/cpuprocanalyzer/1046_CcspPandMSsp/threads/
tmp/cpuprocanalyzer/1046_CcspPandMSsp/threads/1579_CcspPandMSsp.data
tmp/cpuprocanalyzer/1046_CcspPandMSsp/threads/1578_CcspPandMSsp.data
tmp/cpuprocanalyzer/1046_CcspPandMSsp/threads/1514_CcspPandMSsp.data
tmp/cpuprocanalyzer/1046_CcspPandMSsp/threads/1510_CcspPandMSsp.data
tmp/cpuprocanalyzer/1046_CcspPandMSsp/threads/1508_CcspPandMSsp.data
tmp/cpuprocanalyzer/1046_CcspPandMSsp/threads/1507_CcspPandMSsp.data
tmp/cpuprocanalyzer/1046_CcspPandMSsp/threads/1503_CcspPandMSsp.data
tmp/cpuprocanalyzer/1046_CcspPandMSsp/threads/1259_CcspPandMSsp.data
tmp/cpuprocanalyzer/1046_CcspPandMSsp/threads/1194_CcspPandMSsp.data
tmp/cpuprocanalyzer/1046_CcspPandMSsp/threads/1049_CcspPandMSsp.data
tmp/cpuprocanalyzer/1046_CcspPandMSsp/threads/1048_CcspPandMSsp.data
tmp/cpuprocanalyzer/1046_CcspPandMSsp/threads.list
tmp/cpuprocanalyzer/1046_CcspPandMSsp/1046_CcspPandMSsp.data
tmp/cpuprocanalyzer/deviceinfo.data
tmp/cpuprocanalyzer/dynamic/
tmp/cpuprocanalyzer/loadandmem.data
tmp/cpuprocanalyzer/selectedps.list
root@RaspberryPi-Gateway:~#
  • No labels