# Debug Source: [https://docs.qualcomm.com/doc/80-70014-19/topic/debug.html](https://docs.qualcomm.com/doc/80-70014-19/topic/debug.html) For performance profiling of the applications, you can use Snapdragon Profiler and kernel commands. The procedures to collect information for profiling and debugging using the kernel commands, and also how to collect logs are described here. Note: Use the commands described here carefully, as these commands may impact the power consumption of the device. ## Weston/Wayland logs Source: [https://docs.qualcomm.com/doc/80-70014-19/topic/debug.html](https://docs.qualcomm.com/doc/80-70014-19/topic/debug.html) To capture the Weston/Wayland debug logs, run the following command before launching the Weston or any application: export WAYLAND_DEBUG=server/clientCopy to clipboard ## Kernel/KGSL Source: [https://docs.qualcomm.com/doc/80-70014-19/topic/debug.html](https://docs.qualcomm.com/doc/80-70014-19/topic/debug.html) Before debugging the kernel or KGSL, open the SSH terminal using the device IP address and run the following commands: setenforce 0Copy to clipboard mount -o remount rw /Copy to clipboard ### Set CPU to performance mode To set the CPU to performance mode, do the following: 1. Set all CPU cores by replacing `cpux` with `cpu0`, `cpu1`, and so on. echo 1 > /sys/devices/system/cpu/[cpux]/onlineCopy to clipboard cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governorsCopy to clipboard Sample output: ondemand userspace performance schedutilCopy to clipboard 2. Run the command: echo performance > /sys/devices/system/cpu/[cpux]/cpufreq/scaling_governorCopy to clipboard 3. Validate the trial settings: cat /sys/devices/system/cpu/[cpux]/online (cpux : cpu0,cpu1 …)Copy to clipboard cat /sys/devices/system/cpu/[cpux]/cpufreq/scaling_governor(cpux : cpu0, cpu1 …)Copy to clipboard ### Set GPU frequency 1. For the power level, check the `available_frequencies` sys node. cat /sys/class/kgsl/kgsl-3d0/devfreq/available_frequenciesCopy to clipboard Sample output: 812000000 700000000 608000000 550000000 450000000 315000000Copy to clipboard From the sample output, GPU power levels are interpreted as following: | **Frequency** | 812000000 | 700000000 | 608000000 | 550000000 | 450000000 | 315000000 | | --- | --- | --- | --- | --- | --- | --- | | **Power level** | 0 | 1 | 2 | 3 | 4 | 5 | 2. Increment the GPU power level by one and perform the GPU power-level test by substituting `` with 0, 1, 2, 3, 4, and so on, in the following commands: echo > /sys/class/kgsl/kgsl-3d0/min_pwrlevelCopy to clipboard echo > /sys/class/kgsl/kgsl-3d0/max_pwrlevelCopy to clipboard Note: The Adreno GPU frequency for QCS5430 is fixed at 315 MHz. For QCS5430, the power levels mentioned here are not supported and the output of the `available_frequencies` command will be 315000000. ### Set GPU to performance mode Note: For QCS5430, the performance mode is not supported as the frequency of the Adreno GPU is fixed at 315 MHz. - To set the GPU to performance mode, run the following commands. These commands force the GPU to always run at the maximum frequency. echo 0 > /sys/class/kgsl/kgsl-3d0/min_pwrlevelCopy to clipboard echo 0 > /sys/class/kgsl/kgsl-3d0/max_pwrlevelCopy to clipboard - Run the following command to ensure that the GPU does not enter the low-power state even if the device is idle for 10000000 ms. echo 10000000 > /sys/class/kgsl/kgsl-3d0/idle_timerCopy to clipboard - To set the GPU to performance mode while ensuring that the GPU does not enter the low-power state, run the following commands: echo 0 > /sys/class/kgsl/kgsl-3d0/min_pwrlevelCopy to clipboard echo 0 > /sys/class/kgsl/kgsl-3d0/max_pwrlevelCopy to clipboard echo 10000000 > /sys/class/kgsl/kgsl-3d0/idle_timerCopy to clipboard ### Check other KGSL settings - To enable the KGSL clock, run the following command: echo 1 > /sys/class/kgsl/kgsl-3d0/force_clk_onCopy to clipboard - To enable the KGSL rail, run the following command: echo 1 > /sys/class/kgsl/kgsl-3d0/force_rail_onCopy to clipboard - To enable the KGSL bus, run the following command: echo 1 > /sys/class/kgsl/kgsl-3d0/force_bus_onCopy to clipboard ## OpenGL ES applications Source: [https://docs.qualcomm.com/doc/80-70014-19/topic/debug.html](https://docs.qualcomm.com/doc/80-70014-19/topic/debug.html) You can use the Snapdragon Profiler to capture snapshot and real-time traces of OpenGL ES applications. For more information on the Snapdragon Profiler, see [Snapdragon Profiler](https://docs.qualcomm.com/doc/80-70014-19/topic/graphics_developer_tools.html#graphics_developer_tools__section_mwq_r4x_31c). ## OpenCL applications Source: [https://docs.qualcomm.com/doc/80-70014-19/topic/debug.html](https://docs.qualcomm.com/doc/80-70014-19/topic/debug.html) You can use the Snapdragon Profiler to capture snapshot and real-time traces of OpenCL applications. For more information on the Snapdragon Profiler, see [Snapdragon Profiler](https://docs.qualcomm.com/doc/80-70014-19/topic/graphics_developer_tools.html#graphics_developer_tools__section_mwq_r4x_31c). For performance profiling of OpenCL applications based on events, along with the Snapdragon Profiler you can also see the Performance profiling section in the [Qualcomm® Snapdragon™ Mobile Platform OpenCL General Programming and Optimization Guide](https://developer.qualcomm.com/qfile/33472/80-nb295-11_a.pdf%29). Note: Some sections in the [Qualcomm® Snapdragon™ Mobile Platform OpenCL General Programming and Optimization Guide](https://developer.qualcomm.com/qfile/33472/80-nb295-11_a.pdf%29) are applicable only for Android platforms and not applicable to the Qualcomm Linux platforms. However, some of the profiling options are purely based on the OpenCL API and are therefore supported on the Qualcomm Linux devices. For example, the `clGetEventProfilingInfo` API. ## Vulkan applications Source: [https://docs.qualcomm.com/doc/80-70014-19/topic/debug.html](https://docs.qualcomm.com/doc/80-70014-19/topic/debug.html) ### Before you begin ### About this task You can use the Snapdragon Profiler to capture snapshot and real-time traces of Vulkan applications. For more information on the Snapdragon Profiler, see [Snapdragon Profiler](https://docs.qualcomm.com/doc/80-70014-19/topic/graphics_developer_tools.html#graphics_developer_tools__section_mwq_r4x_31c). Along with the Snapdragon Profiler, you can also use validation layers to debug Vulkan applications. To debug a Vulkan application using the validation layers, do the following: ### Procedure 1. Set the source environment. source /environment-setup-armv8-2a-qcom-linuxCopy to clipboard 2. Download the validation layers and run the following commands: git clone https://github.com/KhronosGroup/Vulkan-ValidationLayersCopy to clipboard cmake -S . -B build -D UPDATE_DEPS=ON -D BUILD_WSI_XLIB_SUPPORT=OFF -D BUILD_TESTS=OFF -D CMAKE_BUILD_TYPE=Release -D BUILD_WSI_XCB_SUPPORT=OFF -D BUILD_WSI_WAYLAND_SUPPORT=ONCopy to clipboard cmake --build build --config DebugCopy to clipboard scp -r build/layers/libVkLayer_khronos_validation.so root@[IP-address-of-device]:/tmp/local/debug/vulkan/Copy to clipboard scp -r build/layers/VkLayer_khronos_validation.json root@[IP-address-of-device]:/tmp/local/debug/vulkan/Copy to clipboard export VK_LAYER_PATH=/tmp/local/debug/vulkan:$VK_LAYER_PATHCopy to clipboard Note: If /tmp/local/debug/vulkan path is not available, create similar path. 3. To force the layer to be enabled for Vulkan applications, set the `VK_INSTANCE_LAYERS` environment variable. export VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validationCopy to clipboard 4. Edit or append the following settings in the layers/vk\_layer\_settings.txt file and push to the device. khronos_validation.debug_action = VK_DBG_LAYER_ACTION_LOG_MSGCopy to clipboard khronos_validation.report_flags = error,warn,perfCopy to clipboard khronos_validation.file = trueCopy to clipboard khronos_validation.log_filename = vk_validatedump.txtCopy to clipboard scp -r vk_layer_settings.txt root@[IP-address-of-device]:/tmp/local/debug/vulkan/Copy to clipboard 5. To dump the log, add the path of the validation layers. export VK_LAYER_SETTINGS_PATH=/tmp/local/debug/vulkan/vk_layer_settings.txtCopy to clipboard Dumps are generated in the same directory where the Vulkan application binary was pushed. Note: To avoid data flush in the tmp folder, you can consider pushing the Vulkan application binary to any other suitable path. If you are changing the path, ensure that after the reboot, the path is correctly set in the environment variables. Last Published: Jul 12, 2024 [Previous Topic Tools](https://docs.qualcomm.com/bundle/publicresource/80-70014-19/topics/graphics_developer_tools.md) [Next Topic References](https://docs.qualcomm.com/bundle/publicresource/80-70014-19/topics/references.md)