You copied the Doc URL to your clipboard.

Hardware Counters

Attention: This feature requires a DS-5 license to use.
Attention: Hardware counters are only supported for Mali driver versions r26p0 (Midgard) and r14p0 (Bifrost) onwards.
Attention: Hardware counters visualisation is only supported for tracing a single process at a time. Running two processes in parallel will result in combining both processes into the same visualisation (attributed to the first process in MGD). MGD will discard counter data after the first process has terminated or disconnected. To run the same process more than once, you must disconnect and re-connect to the device between runs.

MGD now supports collecting and visualising per-frame hardware counters provided by the Mali driver.

Configuring the driver on Android

Attention: You will need root access to your device to enable hardware counters.

We recommend using the automated configuration uploader. The configuration uploader can be launched by clicking the button (requires a DS-5 license to enable).

You must specify a process to trace in order to enable the counters. MGD can automatically generate the process name for any of the installed APK packages on the device. If you are running a native application, you can manually enter the process name instead.

Please note that you will need to re-upload the configuration file after rebooting the device.

You can manually configure the driver in a similar manner to the Linux case below. You will need to create a directory at /data/data/com.mali.testjava. Upload the .mali_config file to that location and set the user permissions to 777.

You will have to manually upload a configuration file to the device. On Linux, the Mali driver will search for the configuration file in the working directory at the moment that you launch the application. To enable all hardware counters, create a file called .mali_config with the following contents:
MALI_HWC_DUMP_JM_MAP=0xFFFFFFFFFFFFFFFF
MALI_HWC_DUMP_MMU_L2C_MAP=0xFFFFFFFFFFFFFFFF
MALI_HWC_DUMP_SC_MAP=0xFFFFFFFFFFFFFFFF
MALI_HWC_DUMP_TILER_MAP=0xFFFFFFFFFFFFFFFF
MALI_TIMELINE_UDS_LOSSLESS_MODE=1

# This will enable counters for any process
MALI_HWC_DUMP_PER_EVENT=1

To only enable counters for a single application, preface the MALI_HWC_DUMP_PER_EVENT=1 with a process name, e.g. MyProcessName:MALI_HWC_DUMP_PER_EVENT=1

Visualising the counter data

The next time you launch the application while connected to MGD, data will appear in the Counters Graph view.

By default, MGD will display up to 30 frames of data, based on the frame that is selected in the trace. You can remove the filter by right-clicking on the Counters Graph view. You can also customise the filters by frame number or value (or both, e.g. the top 10% of GPU active frames after frame 30).

You can also sort the counters by frame index or counter value from the context menu. You can invert the sort direction by clicking on the currently selected sort option (lowest -> highest is the default).

Currently, only a subset of collected counter data can be visualised.

Attention: Rendering the graph repeatedly during a live trace is very computationally expensive and will slow down MGD. You may want to hide or close the view during a large live trace and run an analysis at the end. Enabling a frame filter will reduce the workload by limiting the number of nodes to render.
Attention: If you disconnect the interceptor from a process before it completes, the driver will start emitting messages like [HWCF] Frame data buffer full - recording is too slow. This is the expected driver behaviour when closing the driver connection while a process is running, and does not indicate an error in the driver. The message should stop after the process is terminated.
Was this page helpful? Yes No