# DSP performance analysis Qualcomm Profiler can be used to gather information like the resource usage, load distribution across available hardware threads, and various other profiling metrics useful in measuring performance, debugging performance related issues, and identifying possible optimizations. Qualcomm Profiler CLI can be used to do DSP performance analysis (see [Command Line Interface (CLI)](https://docs.qualcomm.com/doc/80-54323-2/topic/command-line-interface.html#command-line-interface)). NSP profiling data can be collected in two modes: ## NSP profiling - Live profiling - Binary mode: Binary files can be postprocessed in the Qualcomm Profiler UI and users can configure the profiling data mode using the [Generate Config](https://docs.qualcomm.com/doc/80-54323-2/topic/command-line-interface.html#generate-config). NSP profiling supports the following configuration options. | Option | Value | Description | | --- | --- | --- | | `DCVSOption` | 0 | Disables DCVS for the profiling duration. | | | 1 | Enables DCVS for the profiling duration. | | `LpmlaProfFlag` | 0 | Disable profiling for LPMLA (eNPU) hardware. | | | 1 | Enable profiling for LPMLA (eNPU) hardware. | | `MetricQueryFlag` | 0 | Collects a binary file with raw data in binary format. | | | 1 | Collects data in parsed metric format. | | `debugLevel` | 0 | In Default mode, fixed set of 8 PMU events. | | | 1 | In this mode, 4 PMU events are fixed and other 4 PMU are shuffled in round robin fashion from the predefined array. | | | 2 | In this mode all 8 PMUs are shuffled in round robin fashion from the predefined array. | | | 3 | Configures the PMUs based on user-selected metrics. User can pass list of metric from CLI (–metric-id-list). | | | 4 | Configures the PMU based on the user-provided PMU event list. The user can pass a list of PMU from CLI (–pmu-event-list) or GUI. PMU can be passed in both decimal and hex format. | | `Version` | 0 | Version control for interface and compatibility check. | | `QueryTimeMs` | 0-200 | Time in milliseconds to aggregate metrics over given query time. | | `FastrpcTimeline` | 0 | Disables FastRPC metrics. | | | 1 | Enables the option to collect the time spent by the FastRPC interface. Only supported on Linux Android. | | `ProfilingType` | 0 | Collects default profiling data. | | | 1 | Collects thread-level profiling data. | | | 2 | Collects both default and thread-level profiling data. | | `EnableRootPD` | 0 | Disables root PD in TLP profiling. | | | 1 | Enables rootPD in TLP profiling. | | `Qtimer` | True | Enable Qtimer timestamp. | TLP profiling is only supported in Binary mode. To enable TLP profiling, set `MetricQueryFlag` to 0 and `ProfilingType` to either 1 or 2. Fast RPC profiling is only supported in Binary mode. To enable Fast RPC profiling, set `MetricQueryFlag` to 0 and `FastrpcTimeline` to 1. ## NSP stats To get the DSP stats information, use the stats capabilities, for example, `profiler:nsp-dsp-stats`, `profiler:nsp1-dsp-stats`, `profiler:adsp-dsp-stats` . All stats services can be run together or independently. To update the configuration: 1. Generate a JSON configuration file using the [Generate Config](https://docs.qualcomm.com/doc/80-54323-2/topic/command-line-interface.html#generate-config) option. 2. Update and save the generated JSON file. 3. Pass the updated JSON file to the profiler using the [Trace Options](https://docs.qualcomm.com/doc/80-54323-2/topic/command-line-interface.html#trace-options) option. The following table lists the metric IDs for stats services. | StatsServices index | Services | Supported Hexagon version | Metric-ids | | --- | --- | --- | --- | | 0 | `GetStateInfoService` | v68 and later | 5888 - 5895 | | 1 | `GetInfoService` | v68 and later | 5896 - 5903 | | 2 | `GetProcessInfoService` | v68 and later | 5904, 5911 | | 3 | `GetThreadInfoService` | v68 and later | 5905 - 5907,5910 | | 4 | `GetPowerStateInfoService` | v68 and later | 5909 | | 5 | `GetIslandMemoryInfoService` | v79 and later | 5912 | ### GetStateInfoService Provides the current Q6 clock voting information and heap statistics for each static protection domain. To use this service, update the configuration as follows. | param\_index | Name | Value | | --- | --- | --- | | 0 | StatsServices | 0 | ### GetInfoService Provides hardware information, like max threads, chip information, and clocking information. To use this service, update the configuration as follows. | param\_index | name | value | | --- | --- | --- | | 0 | StatsServices | 1 | ### GetProcessInfoService Provides statistics for all active PDs on the DSP. To use this service, update the configuration as follows. | param\_index | name | value | | --- | --- | --- | | 0 | StatsServices | 2 | ### GetThreadInfoService Provides the software threads created, their priorities, the declared stack size, and the maximum stack size used at that instance for all PDs. To use this service, update the configuration as follows. | param\_index | name | value | | --- | --- | --- | | 0 | StatsServices | 3 | ### GetPowerStateInfoService Provides active time information for every core clock level of DSP from device boot up, Low Power Island mode, and Power Collapse mode time information. This feature is supported on ADSP, NSP, and SDSP. This feature also supports a reset option to clear the collected stats and start logging again. To use this service, update the configuration as follows. | param\_index | name | value | | --- | --- | --- | | 0 | StatsServices | 4 | ### GetIslandMemoryService This service provides island free memory information for every Island pool available. This feature is supported on ADSP, NSP, and CDSP1. This feature supports an Islandspec option: - 1: Enable all pools - 2: Enable TCM pool only To use this service, update the configuration as follows. | param\_index | name | value | | --- | --- | --- | | 0 | StatsServices | 5 | ### All statistics services To run all statistics services, update the configuration as follows. | param\_index | name | value | | --- | --- | --- | | 0 | StatsServices | 0, 1, 2, 3, 4, 5 | ## Sysmon migration SysmonApp is an older application which interacts with DSP subsystem via FastRPC and provides various users functionalities such as profiling, set/remove bus clock, get software thread info, and other functionalities. All the features of SysmonApp are supported in Qualcomm Profiler along with other system capabilities and functionalities. The following table shows feature parity. | Feature | SysmonApp | Qualcomm profiler | | --- | --- | --- | | profiler | Y | Y | | TLP profiling | Y | Y | | getLoad | Y | Y (Live metrics) | | getState | Y | Y | | getInfo | Y | Y | | pInfo | Y | Y | | tInfo | Y | Y | | getPowerStats | Y | Y | | clocks | Y | Y (profilerUtilityApp) | | benchmark | Y | Y (profilerUtilityApp) | | etmTrace | Y | Y (profilerUtilityApp) | | DCVS | Y | Y (profilerUtilityApp) | | bin parser | Y | Y (qpbin\_parser) | | Multiple DSP profiling | N | Y | | Multiple capabilities profiling | N | Y | | System capabilities (CPU, GPU, thermal, power profiling) | N | Y | | On-Host CLI profiling | N | Y | | API support | N | Y | | On-Host GUI application with charts, graph | N | Y | | Roofline analysis | N | Y | | NSP Stats profiling with Default profiling | N | Y | | Live metric support | N | Y | | Perfetto trace format support | N | Y(Not supported for stats) | ### Qualcomm Profiler equivalent commands | Feature | Subsystem | SysMonApp command | Qualcomm Profiler commands | | --- | --- | --- | --- | | Profiling | NSP | `sysMonApp profiler --q6 cdsp --duration 10` |
adb push C:\ProgramData\Qualcomm\QualcommProfiler\config\common-config_nsp_debug_level_0_dcvs_1_fastrpctimeline_1.json/data/
qprof --profile --capabilities-list profiler:nsp-dsp-metrics --profile-time 10 --trace-options/data/common-config_nsp_debug_level_0_dcvs_1_fastrpctimeline_1.json
adb push C:\ProgramData\Qualcomm\QualcommProfiler\config\common-config_nsp_debug_level_1_dcvs_1_fastrpctimeline_1.json/data
qprof --profile --capabilities-list profiler:nsp-dsp-metrics --profile-time 10 --trace-options/data/common-config_nsp_debug_level_1_dcvs_1_fastrpctimeline_1.json
adb push C:\ProgramData\Qualcomm\QualcommProfiler\config\common-config_nsp_debug_level_1_dcvs_0_fastrpctimeline_1.json/data
qprof --profile --capabilities-list profiler:nsp-dsp-metrics --profile-time 10 --trace-options/data/common-config_nsp_debug_level_1_dcvs_0_fastrpctimeline_1.json --sampling-rate 10
adb push C:\ProgramData\Qualcomm\QualcommProfiler\config\common-config_nsp_tlp.json/data
qprof --profile --capabilities-list profiler:nsp-dsp-metrics --profile-time 10 --trace-options/data/common-config_nsp_tlp.json --sampling-rate 10
adb push C:\ProgramData\Qualcomm\QualcommProfiler\config\common-config_nsp_prof_and_tlp.json/data
qprof --profile --capabilities-list profiler:nsp-dsp-metrics --profile-time 10 --sampling-rate 10 --trace-options/data/common-config_nsp_prof_and_tlp.json
qprof --profile --capabilities-list profiler:nsp-dsp-metrics --profile-time 10 --sampling-rate 10 --live
Get stats data: qprof --profile --capabilities-list profiler:nsp-dsp-stats --profile-time 1 --sampling-rate 10 --live
Parsing profile bin file:
adb pull <bin> <on_host_path>
sysmon_parser.exe <input_file> —outdir <folder_name>
Parsing tlp bin file:
adb pull <bin> <on_host_path>
sysmon_parser.exe --tlp
Parsing profile bin file:
adb pull <bin> <on_host_path>
C:\Program Files (x86)\Qualcomm\Shared\QualcommProfiler\API\host-windows-64\bin\qpbin_parser.exe" <input_file> --outdir <output_folder>
Parsing TLP bin file:
adb pull <bin> <on_host_path>
C:\Program Files (x86)\Qualcomm\Shared\QualcommProfiler\API\host-windows-64\bin\qpbin_parser.exe" --tlp <input_file> --outdir <output_folder>
adb push common-config_nsp-dsp-stats-dcvs-vote-1.json/data
qprof --profile --capabilities-list profiler:nsp-dsp-stats --live --profile-time 1 --trace-options/data/common-config_nsp-dsp-stats-dcvs-vote-1.json
adb push common-config_nsp-dsp-stats-pinfo.json/data
qprof --profile --capabilities-list profiler:nsp-dsp-stats --live --profile-time 1 --trace-options/data/common-config_nsp-dsp-stats-pinfo.json
adb push common-config_nsp-dsp-stats-tinfo.json/data
qprof --profile --capabilities-list profiler:nsp-dsp-stats --live --profile-time 1 --trace-options/data/common-config_nsp-dsp-stats-tinfo.json
adb push common-config_nsp-dsp-stats-getPowerStats.json/data
qprof --profile --capabilities-list profiler:nsp-dsp-stats --live --profile-time 1 --trace-options/data/common-config_nsp-dsp-stats-getPowerStats.json
profilerUtilityApp --dsp --clocks set --coreClock 1000 --busClock 1000 --ahbClock 1000 --q6 nsp0
To view set clock: qprof --profile --capabilities-list profiler:nsp-dsp-stats --live --profile-time 1
profilerUtilityApp --dsp --clocks remove --q6 nsp0
To view clock: qprof --profile --capabilities-list profiler:nsp-dsp-stats --live --profile-time 1
profilerUtilityApp --dsp --clocks limit --coreClock 400 --q6 nsp0
To view clock value: qprof --profile --capabilities-list profiler:nsp-dsp-stats --live --profile-time 1
adb push C:\ProgramData\Qualcomm\QualcommProfiler\config\common-config_adsp_debug_level_0_dcvs_1_fastrpctimeline_1.json/data/
qprof --profile --capabilities-list profiler:adsp-dsp-metrics --profile-time 10 --trace-options/data/common-config_adsp_debug_level_0_dcvs_1_fastrpctimeline_1.json
adb push C:\ProgramData\Qualcomm\QualcommProfiler\config\common-config_adsp_debug_level_1_dcvs_1_fastrpctimeline_1.json/data
qprof --profile --capabilities-list profiler:adsp-dsp-metrics --profile-time 10 --trace-options /data/common-config_adsp_debug_level_1_dcvs_1_fastrpctimeline_1.json
adb push C:\ProgramData\Qualcomm\QualcommProfiler\config\common-config_adsp_debug_level_1_dcvs_0_fastrpctimeline_1.json/data
qprof --profile --capabilities-list profiler:adsp-dsp-metrics --profile-time 10 --trace-options/data/common-config_adsp_debug_level_1_dcvs_0_fastrpctimeline_1.json --sampling-rate 10
adb push C:\ProgramData\Qualcomm\QualcommProfiler\config\common-config_adsp_tlp.json/data
qprof --profile --capabilities-list profiler:adsp-dsp-metrics --profile-time 10 --trace-options/data/common-config_adsp_tlp.json --sampling-rate 10
adb push C:\ProgramData\Qualcomm\QualcommProfiler\config\common-config_adsp_prof_and_tlp.json/data
qprof --profile --capabilities-list profiler:adsp-dsp-metrics --profile-time 10 --sampling-rate 10 --trace-options/data/common-config_adsp_prof_and_tlp.json
adb push C:\ProgramData\Qualcomm\QualcommProfiler\config\common-config_adsp_prof_and_tlp_dcvs_1.json/data
qprof --profile --capabilities-list profiler:adsp-dsp-metrics --profile-time 10 --sampling-rate 10 --trace-options /data/common-config_adsp_prof_and_tlp_dcvs_1.json
Parsing profile bin file:
adb pull <bin> <on_host_path>
sysmon_parser.exe <input_file> —outdir <folder_name>
Parsing tlp bin file:
adb pull <bin> <on_host_path>sysmon_parser.exe –tlp
Parsing profile bin file:
adb pull <bin> <on_host_path>
C:\Program Files (x86)\Qualcomm\Shared\QualcommProfiler\API\host-windows-64\bin\qpbin_parser.exe" <input_file> --outdir <output_folder>
Parsing TLP bin file:
adb pull <bin> <on_host_path>
C:\Program Files (x86)\Qualcomm\Shared\QualcommProfiler\API\host-windows-64\bin\qpbin_parser.exe" --tlp <input_file> --outdir <output_folder>
adb push common-config_adsp-dsp-stats-dcvs-vote-1.json/data
qprof --profile --capabilities-list profiler:adsp-dsp-stats --live --profile-time 1 --trace-options/data/common-config_nsp-dsp-stats-dcvs-vote-1.json
adb push common-config_adsp-dsp-stats-pinfo.json/data
qprof --profile --capabilities-list profiler:adsp-dsp-stats --live --profile-time 1 --trace-options/data/common-config_adsp-dsp-stats-pinfo.json
adb push common-config_adsp-dsp-stats-tinfo.json/data
qprof --profile --capabilities-list profiler:adsp-dsp-stats --live --profile-time 1 --trace-options/data/common-config_adsp-dsp-stats-tinfo.json
adb push common-config-adsp-dsp-stats-tinfo.json/data
qprof --profile --capabilities-list profiler:adsp-dsp-stats --live --profile-time 1 --trace-options/data/common-config-adsp-dsp-stats-tinfo.json
adb push common-config_adsp-dsp-stats-getPowerStats.json/data
qprof --profile --capabilities-list profiler:adsp-dsp-stats --live --profile-time 1 --trace-options/data/common-config_adsp-dsp-stats-getPowerStats.json
profilerUtilityApp --dsp --clocks set --coreClock 1000 --busClock 1000 --ahbClock 1000 --q6 adsp
To view set clock: qprof --profile --capabilities-list profiler:adsp-dsp-stats --live --profile-time 1
profilerUtilityApp --dsp --clocks remove --q6 adsp
To view clock: qprof --profile --capabilities-list profiler:adsp-dsp-stats --live --profile-time 1
profilerUtilityApp --dsp --clocks limit --coreClock 400 --q6 adsp
To view clock value: qprof --profile --capabilities-list profiler:adsp-dsp-stats --live --profile-time 1