Video encode / decode performance monitoring

I noticed with tegrastats that it only provides a clock speed for the NVENC and NVDEC engines, unlike other things like the VIC where it also provides a percentage utilisation. See for example this snippet, taken from when the encode and decode engines were both active:
NVENC 448 NVDEC 998 NVJPG1 729 VIC_FREQ 11%@115

I have found that if I read /sys/kernel/debug/vic/actmon_avg_norm and divide by 10, it matches the tegrastats value for VIC utilisation percentage, implying that actmon_avg_norm is a value between 0 and 1000. This seems to align with the host1x_actmon_avg_norm function:

*avg = (val * 1000) / (actmon->clks_per_sample * actmon->divider);

However, /sys/kernel/debug/nvdec/actmon_avg_normfrequently goes above 1000. The plot below shows /sys/kernel/debug/nvdec/actmon_avg_norm sampled every 20ms. The dots are individual measurements, and the line is a 5 second rolling mean.

The values for NVENC seem more reasonable.

The high-level question I have is:

  • is there a way to reliably monitor NVENC and NVDEC utilisation, in the same way that tegrastats reports for the VIC?
    And then:
  • Am I correct in saying that actmon_avg_norm should be an integer between 0 and 1000?
  • If so, what is the reason for the NVDEC values going above 1000? Can I trust these values at all?

There is no way to get loading of NVDEC and NVENC. By default there is dynamic frequency scaling(DFS) for the engines and frequency is changing dynamically. This can give less power consumption in single video encoding. If your use-case is multiple video encoding/decoding, we would suggest disable DFS to have maximum throughput. There is interface for disabling it in gstreamer and jetson_multimedia_api. You may check the documents and samples for further information,

Hi @DaneLLL But the VIC does that too, right? For disabling dynamic frequency scaling in the documents - I presume you are referring to the enable-max-performance / maxperf-enable arguments to the GStreamer plugins?

Besides, clock frequency and activity are reported separately in tegrastats for the VIC, and the relevant metrics are also present in the sysfs for the NVDEC and NVENC engines. The NVENC numbers seem to make sense (like the VIC), but the NVDEC still sometimes reports an actmon_avg_norm of beyond 1000 even when the clock is maxed out at 998.4MHz. What is it that means that the NVENC/DEC engines cannot be monitored but the VIC can?