How to create log files and change Jetson's power using python (Jetson AGX Xavier)

We know that allocating Jettson’s log files (especially in csv format) and changing power modes in the Jettson can be done using the Jettson’s GUI.
We would like to do automation and allocate these log files and change the Jettson’s power modes using python. Is that possible and if so, how it can be done?
We’ll appreciate your help.
Thank you

hello giltech,

  1. what logs you meant, is it kernel logs, or system level logs?
    is there any specific use-case? actually, excel support to open/load text files, you don’t need to output as csv format.

  2. that’s simple command-line to toggle power modes. for example, $ sudo /usr/sbin/nvpmodel -m <x>

Thank you for your answer.

  1. The logs i meant are the Jetsson’s parameters like memory usage/gpu load/gpu temp/etc. These logs are equivalent to tagrastats command which you can type and see these values.

In the Jettson’s GUI you can choose wether to record these logs as txt file or csv format. The adventage of the csv format is that these values are already parsed (values arranged in table and easy to manipulate) while in txt file you need to extract the values manually. That is why we prefare the csv format.

Our main goal is to calculate mean and plot grpahs for specific Jettson’s parameters (as i mentioned before) in a given time interval.

  1. Yes, we know power modes can be changed in linux CLI, the question is if its possible to change the power modes from python file.

hello giltech,

  1. you may running tegrastats utility by adding --logfile option to output logs as single text file.
    this by default parse the usage within 1-sec, you may control --interval options to specify the interval between log prints.

  2. why don’t you calling the same in python.

Thank you.

Is there a way to output the logs as csv format? as i mentioned before, the csv format makes manipulation of the values much easier compared to the text file.

hello giltech,

you may simply process the data with tr options, and saving the file as csv format.
here’s an example,
//to convert spaces as a comma
$ cat tegrastats.txt | tr -s ' ' ',' > tmp.txt

//to convert "%@" as a comma
$ cat tmp.txt | tr -s "%@" ',' > output.csv

try opening output.csv to review the results, and you may add more process by your own.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.