System information
This example shows how to get system information (memory usage, cpu usage and temperature) from the board.Demo
Example script outputCommand Line
1Ddr used / total - 0.13 / 414.80 MiB
2 Cmx used / total - 2.24 / 2.50 MiB
3 LeonCss heap used / total - 4.17 / 46.41 MiB
4 LeonMss heap used / total - 2.87 / 27.58 MiB
5 Chip temperature - average: 38.59, css: 39.81, mss: 37.71, upa: 38.65, dss: 38.18
6 Cpu usage - Leon CSS: 7.08%, Leon MSS: 1.48 %
7 ----------------------------------------
8 Ddr used / total - 0.13 / 414.80 MiB
9 Cmx used / total - 2.24 / 2.50 MiB
10 LeonCss heap used / total - 4.17 / 46.41 MiB
11 LeonMss heap used / total - 2.87 / 27.58 MiB
12 Chip temperature - average: 38.59, css: 39.58, mss: 37.94, upa: 38.18, dss: 38.65
13 Cpu usage - Leon CSS: 1.55%, Leon MSS: 0.30 %
14 ----------------------------------------
15 Ddr used / total - 0.13 / 414.80 MiB
16 Cmx used / total - 2.24 / 2.50 MiB
17 LeonCss heap used / total - 4.17 / 46.41 MiB
18 LeonMss heap used / total - 2.87 / 27.58 MiB
19 Chip temperature - average: 38.94, css: 40.04, mss: 38.18, upa: 39.35, dss: 38.18
20 Cpu usage - Leon CSS: 0.56%, Leon MSS: 0.06 %
21 ----------------------------------------
22 Ddr used / total - 0.13 / 414.80 MiB
23 Cmx used / total - 2.24 / 2.50 MiB
24 LeonCss heap used / total - 4.17 / 46.41 MiB
25 LeonMss heap used / total - 2.87 / 27.58 MiB
26 Chip temperature - average: 39.46, css: 40.28, mss: 38.88, upa: 39.81, dss: 38.88
27 Cpu usage - Leon CSS: 0.51%, Leon MSS: 0.06 %
28 ----------------------------------------
upa
represents the temperature of the SHAVE blockdss
represents the temperature of the DDR subsystem
Setup
Please run the install script to download all required dependencies. Please note that this script must be ran from git context, so you have to download the depthai-python repository first and then run the scriptCommand Line
1git clone https://github.com/luxonis/depthai-python.git
2cd depthai-python/examples
3python3 install_requirements.py
Source code
Python
C++
Python
PythonGitHub
1#!/usr/bin/env python3
2
3import cv2
4import depthai as dai
5
6def printSystemInformation(info):
7 m = 1024 * 1024 # MiB
8 print(f"Ddr used / total - {info.ddrMemoryUsage.used / m:.2f} / {info.ddrMemoryUsage.total / m:.2f} MiB")
9 print(f"Cmx used / total - {info.cmxMemoryUsage.used / m:.2f} / {info.cmxMemoryUsage.total / m:.2f} MiB")
10 print(f"LeonCss heap used / total - {info.leonCssMemoryUsage.used / m:.2f} / {info.leonCssMemoryUsage.total / m:.2f} MiB")
11 print(f"LeonMss heap used / total - {info.leonMssMemoryUsage.used / m:.2f} / {info.leonMssMemoryUsage.total / m:.2f} MiB")
12 t = info.chipTemperature
13 print(f"Chip temperature - average: {t.average:.2f}, css: {t.css:.2f}, mss: {t.mss:.2f}, upa: {t.upa:.2f}, dss: {t.dss:.2f}")
14 print(f"Cpu usage - Leon CSS: {info.leonCssCpuUsage.average * 100:.2f}%, Leon MSS: {info.leonMssCpuUsage.average * 100:.2f} %")
15 print("----------------------------------------")
16
17# Create pipeline
18pipeline = dai.Pipeline()
19
20# Define source and output
21sysLog = pipeline.create(dai.node.SystemLogger)
22linkOut = pipeline.create(dai.node.XLinkOut)
23
24linkOut.setStreamName("sysinfo")
25
26# Properties
27sysLog.setRate(1) # 1 Hz
28
29# Linking
30sysLog.out.link(linkOut.input)
31
32# Connect to device and start pipeline
33with dai.Device(pipeline) as device:
34
35 # Output queue will be used to get the system info
36 qSysInfo = device.getOutputQueue(name="sysinfo", maxSize=4, blocking=False)
37
38 while True:
39 sysInfo = qSysInfo.get() # Blocking call, will wait until a new data has arrived
40 printSystemInformation(sysInfo)
Pipeline
Need assistance?
Head over to Discussion Forum for technical support or any other questions you might have.