jetsontools package
Subpackages
Module contents
Package for bounding boxes and their operations.
Submodules
- info
Tools for getting information about the Jetson device.
Classes
- Tegrastats
Runs tegrastats in a separate process and stores output in a file.
Functions
- get_info
Get information about the Jetson device.
- get_data
Parse the output of parse_tegrastats further to get specfic data.
- get_powerdraw
Parse the output of parse_tegrastats to get all energy information.
- filter_data
Filter the Tegrastats output by selections of timestamps.
- set_log_level
Set the log level for the jetsontools package.
- parse_tegrastats
Parse a file written by Tegrastats/tegrastats
- class jetsontools.Tegrastats(output: Path | str, interval: int = 1000, *, readall: bool | None = None)
Bases:
objectRuns tegrastats in a seperate process and stores output in a file.
- jetsontools.filter_data(data: list[dict[str, str]], timestamps: list[tuple[float, float]]) tuple[list[dict[str, str]], list[tuple[tuple[float, float], list[dict[str, str]]]]]
Filter data based on sets of timestamps.
The data given must have the Python timestamps included, i.e. have been generated by Tegrastats.
- Parameters:
- Returns:
The unique entries within all the timestamps and the entries within each timestamp set.
- Return type:
- Raises:
KeyError – If the timestamp data cannot be found
- jetsontools.get_data(data: list[dict[str, str]], names: list[str], parsefunc: Callable[[str], float | int]) dict[str, Metric]
Parse the output from parse_tegrastats to specific output.
- jetsontools.get_info(*, verbose: bool | None = None) JetsonInfo
Get information about the Jetson device.
- Parameters:
verbose (bool, optional) – If True, print additional information, by default None
- Returns:
The information about the Jetson device.
- Return type:
- Raises:
RuntimeError – If the subprocess stdout streams cannot be opened.
- jetsontools.get_powerdraw(data: list[dict[str, str]]) dict[str, Metric]
Parse the output from parse_tegrastats to give power draw values.
Computes two new metrics: VDD_TOTAL and VIN_TOTAL. Useful for profiling overall powerdraw of a Jetson system.
- jetsontools.parse_tegrastats(file: Path | str) list[dict[str, str]]
Parse a file written by Tegrastats or tegrastats.
This a general purpose parser which does not seperate entries or handle types. All values are still strings in original format.
The differences from raw entry/values are: 1. values such as (cached 0MB) become entires: CACHED: 0MB. However these pieces of data are part of a two-piece entry for the memory subsystems, so representation in fixed format (dict[str, str]) required a change. 2. temperature entries such as cpu@49.01C become: CPU_TEMP: 49.01C This change upholds that all data generated from tegrastats has uppercase keys and that cpu frequencies will not clash with cpu temperature.
Whether or not the file was written by the class Tegrastats or directly by tegrastats will be determined automatically. Output generated by Tegrastats (Python class) will have a timestamp field. The Python timestamp is present as ‘timestamp’.
Example entry (from Orin AGX 64GB):
{ ‘timestamp’: ‘1729630462.0975535’, # optional entry ‘DATE’: ‘10-22-2024’, ‘TIME’: ‘15:54:22’, ‘RAM’: ‘23336/62841MB’, ‘LFB’: ‘199x4MB’, ‘SWAP’: ‘0/31421MB’, ‘CACHED’: ‘0MB’, ‘CPU’: ‘[0%@2201,50%@2201,0%@2201,0%@2201,0%@2201,0%@2201,0%@2201,0%@2201,0%@2201,0%@2201,0%@2201,0%@2201]’, ‘GR3D_FREQ’: ‘0%’, ‘CPU_TEMP’: ‘48.812C’, ‘TBOARD_TEMP’: ‘38.5C’, ‘SOC2_TEMP’: ‘44.843C’, ‘TDIODE_TEMP’: ‘38.875C’, ‘SOC0_TEMP’: ‘46.156C’, ‘GPU_TEMP’: ‘43.687C’, ‘TJ_TEMP’: ‘48.812C’, ‘SOC1_TEMP’: ‘45.656C’, ‘VDD_GPU_SOC’: ‘5191mW/5190mW’, ‘VDD_CPU_CV’: ‘1996mW/2032mW’, ‘VIN_SYS_5V0’: ‘4528mW/4539mW’, ‘VDDQ_VDD2_1V8AO’: ‘401mW/411mW’ }
- jetsontools.set_log_level(level: str) None
Set the log level for the jetsontools package.
- Parameters:
level (str) – The log level to set. One of “DEBUG”, “INFO”, “WARNING”, “ERROR”, “CRITICAL”.
- Raises:
ValueError – If the level is not one of the allowed values.