How to monitor CPU and GPU frequency and utilization?

Which Khadas SBC do you use?

Khadas Vim3 Pro

Which system do you use? Android, Ubuntu, OOWOW or others?

Ubuntu Linux Khadas 4.9.241

Which version of system do you use? Khadas official images, self built images, or others?

Khadas official images

Please describe your issue below:

Does anyone know how to monitor the CPU cores and GPU frequency and utilization of Khadas Vim3 pro board?

CPU Frequency: cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_cur_freq

GPU Frequency:

  • Kernel 4.9 and 5.15:
    cat /sys/class/mpgpu/cur_freq

  • mainline linux:
    cat /sys/bus/platform/devices/ffe40000.gpu/devfreq/ffe40000.gpu/cur_freq

1 Like

Thanks! This is where we get the static frequency at some points, right? Do you know any tools or commands used to monitor the dynamic status of CPU and GPU core frequency or utilization?

Hello @Yujie_Zhang

There are no utilities to specifically monitor them, you have direct access to all the stats you need via the provided sysfs attributes.

you may use htop but it only shows the load, and not cpu frequency stats by default.


Thanks for your reply. When I run a program only using the GPU in the board, the content of /sys/class/mpgpu/utilization is always 0. Do you know the reason? And is there any other method to monitor the GPU utilization?

@Yujie_Zhang the 4.9 kernel image has no driver for the GPU to support running desktop gl applications. It’s Mali fbdev driver which has different graphic acceleration capabilities.

For desktop graphics acceleration we suggest waiting and migrating to the new 5.15 kernel image, it has all the drivers for smoother desktop, with same capabilities as 4.9 kernel.


@Electr1 I did not use desktop gl applications. I actually used the OpenCL library to invoke GPU for inference and wanted to measure the power of the board.

Yes on Ubuntu OpenCL driver is mapped to the NPU compute unit.

Platform Name: Vivante OpenCL Platform
Device Name: Vivante OpenCL Device VIPNano-QI.7120.0000

We are looking into this to map it to the GPU properly.

So, you mean that I actually used NPU for acceleration instead of GPU? But the acceleration code used in ARM-CL is for GPU, right?

The output of the command “clinfo” is attached.

  Platform Name                                   ARM Platform
Number of devices                                 1
  Device Name                                     Mali-G52
  Device Vendor                                   ARM
  Device Vendor ID                                0x72120000
  Device Version                                  OpenCL 2.0 git.c8adbf9.122c9daed32dbba4b3056f41a2f23c58
  Driver Version                                  2.0
  Device OpenCL C Version                         OpenCL C 2.0 git.c8adbf9.122c9daed32dbba4b3056f41a2f23c58
  Device Type                                     GPU
  Device Profile                                  FULL_PROFILE
  Device Available                                Yes
  Compiler Available                              Yes
  Linker Available                                Yes
  Max compute units                               2
  Max clock frequency                             750MHz
  Device Partition                                (core)
    Max number of sub-devices                     0
    Supported partition types                     None
    Supported affinity domains                    (n/a)
  Max work item dimensions                        3
  Max work item sizes                             384x384x384
  Max work group size                             384
  Preferred work group size multiple              8

@Electr1 Hello, if I want to check the GPU utilization from the file /sys/bus/platform/devices/ffe40000.gpu/devfreq/ffe40000.gpu/, do you know where I could get the mainline linux OS images?

You can check here: - Index of /.images/vim3/

Images will have 6.x as the kernel version tag for mainline.

Hello @Yujie_Zhang
I was able to reproduce your issue, latest 5.15 kernel has introduced the changes to fix this issue and
it’s observable to see usage of GPU.

khadas@Khadas:~$ clpeak --compute-sp

Platform: ARM Platform
  Device: Mali-G52 r0p0
    Driver version  : 3.0 (Linux ARM64)
    Compute units   : 2
    Clock frequency : 5 MHz

    Single-precision compute (GFLOPS)
      float   : 76.56
      float2  : 76.45
      float4  : ^C
cat: /sys/class/mpgpu/mpgpucmd: Input/output error
scale_mode: 1
util_cl: 100  0
util_gl: 0
utilization: 99
cur_freq: 800
domain_stat: 3
gpu_err: 0
max_freq: 4
min_freq: 0


@Yujie_Zhang can you follow this guide ?[]=opencl#check-opencl-capabilities-and-details

@Electr1 Thanks for your reply. I will try the guide provided. By the way, do you know where to find the linux 5.15 OS images. I can only see the linux 4.9 and 6.1 ubuntu OS images in the download website.

Please check here:

@Electr1 Thanks very much!

Hello, @Electr1, could you tell me, is there percents of utilization in this file? Max value I can see in this file is 20.

@Ivan_Zhukov what test/program did you run to achieve 20 percentage of utilisation?

@Electr1 It was several you-tube 4k videos launched simultaneously, but this value wasn’t constant, it was like several peaks, the average value is about 5-10.

@Ivan_Zhukov mpgpu attribute mainly focus on usage of the GPU compute resources. your task is more oriented to usage of Mixed CPU and GPU graphics/shaders rather than compute, hence you are seeing lower utilization.