Energy consumption calculation for Xavier SoC from Tegrastats

I found that the tegrastats access a couple of files to generate power info and other statistics. I went to tegrastats documentation but could not find the answer to the following questions.

My first question is:
How frequently these files are updated by the system?

The second question is:
Is there any system API of some sort to read the content of the file instead of opening and reading the file?

the third question is:
Let’s say I want to calculate energy consumption by the system. The way I am doing it now: I am recording the content of the corresponding power file every 10 ms and add all the power measurement. Now I have Milliwatt-10ms unit. If I convert that to KW-HR then I get the actual energy consumption for the said period. Is this approach ok?

Hi mmonil,

Reading these sysfs nodes are the recommended way to obtain the data.

It is recommended to set the sample interval to 1 second or longer. Note that reading internal nodes utilizes internal CPU resources. Thus, accessing the nodes too frequently will incur excessive amount of power consumption due to this reading task, which will skew your measurements. Since you want to calculate the total module power by summing each rail, which requires reading each rail node, this is worth noting.

For more information please refer to Chapter 5 of the Jetson AGX Xavier Thermal Design Guide:

Thank you for your answer.

Another observation I have is about GPU power.
When I run tegrastats using a 1 min interval, I find that it shows some power to GPU sometimes even though I am not running anything.

CPU always has some power consumption value which is understandable as it is running OS processes. But why would GPU show power at some random time?

For example:
Tegrastat while Running nothing:

GPU utilization zero but GPU is reporting some power consumption. (The DL processor and vision processor never show this behavior)

RAM 3600/15699MB (lfb 923x4MB) CPU [1%@1190,0%@1190,0%@1190,0%@1190,1%@1190,0%@1190,0%@1190,0%@1190] EMC_FREQ 0% GR3D_FREQ 0% AO@39.5C GPU@40C Tboard@40C Tdiode@41.75C AUX@40C CPU@40.5C thermal@40.3C PMIC@100C -----GPU 155/8------ CPU 465/465 SOC 931/784 CV 0/0 VDDRQ 0/0 SYS5V 1574/1421

What is the reason for that, how can I address this random overhead while trying to measure energy consumption caused by an application that I am running?