Inference Time Statistics

Torq exposes cumulative NPU inference time through a Linux sysfs entry created by the kernel driver. This allows user-space tools to sample NPU activity and compute a simple utilization percentage over a fixed time window.

Sysfs Path

On Torq-enabled Astra targets, the driver creates the statistics group under:

/sys/class/misc/torq/statistics/

The currently exposed counter is:

/sys/class/misc/torq/statistics/torq_inference_time

torq_inference_time

This file contains the cumulative time spent executing NPU inference since the last reset. The value is a 64-bit integer expressed in microseconds.

Example:

# cat /sys/class/misc/torq/statistics/torq_inference_time
32233264

Clearing the Counter

Writing to torq_inference_time resets the accumulated value to 0.

Example:

# cat /sys/class/misc/torq/statistics/torq_inference_time
32233264
# echo 0 > /sys/class/misc/torq/statistics/torq_inference_time
# cat /sys/class/misc/torq/statistics/torq_inference_time
0

Calculating NPU Load

Because the counter is cumulative, NPU load is typically measured over a fixed observation window:

  1. Reset the counter.

  2. Wait for a known time window.

  3. Read the accumulated inference time.

  4. Convert it to a percentage of the observation window.

For a 1 second window, compute NPU load as:

npu_load_percent = (inference_time_us * 100) / 1000000

Example shell workflow:

STAT_FILE=/sys/class/misc/torq/statistics/torq_inference_time
WINDOW_US=1000000

echo 0 > "$STAT_FILE"
usleep "$WINDOW_US"
inference_time_us=$(cat "$STAT_FILE")
npu_load=$((inference_time_us * 100 / WINDOW_US))
echo "Average NPU usage: ${npu_load}%"

Notes

  • This counter reports cumulative NPU execution time, not end-to-end host latency.

  • To obtain a meaningful utilization percentage, the counter must be reset before each measurement window.

  • Access to sysfs statistics may require elevated privileges depending on the target system configuration.

  • If the statistics group is not present, verify that the target is running a driver version that includes the merged sysfs statistics support.