DepthAI v2 has been superseded by DepthAI v3. You are viewing legacy documentation.
DepthAI Tutorials
DepthAI API References

ON THIS PAGE

  • Demo
  • Setup
  • Source code
  • Pipeline

System information

This example shows how to get system information (memory usage, cpu usage and temperature) from the board.

Demo

Example script output
Command 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 block
  • dss 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 script
Command Line
1git clone https://github.com/luxonis/depthai-python.git
2cd depthai-python/examples
3python3 install_requirements.py
For additional information, please follow the installation guide.

Source code

Python

Python
GitHub
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)

C++

1#include <iostream>
2
3// Includes common necessary includes for development using depthai library
4#include "depthai/depthai.hpp"
5void printSystemInformation(dai::SystemInformation info) {
6    printf("Ddr used / total - %.2f / %.2f MiB\n", info.ddrMemoryUsage.used / (1024.0f * 1024.0f), info.ddrMemoryUsage.total / (1024.0f * 1024.0f));
7    printf("Cmx used / total - %.2f / %.2f MiB\n", info.cmxMemoryUsage.used / (1024.0f * 1024.0f), info.cmxMemoryUsage.total / (1024.0f * 1024.0f));
8    printf("LeonCss heap used / total - %.2f / %.2f MiB\n",
9           info.leonCssMemoryUsage.used / (1024.0f * 1024.0f),
10           info.leonCssMemoryUsage.total / (1024.0f * 1024.0f));
11    printf("LeonMss heap used / total - %.2f / %.2f MiB\n",
12           info.leonMssMemoryUsage.used / (1024.0f * 1024.0f),
13           info.leonMssMemoryUsage.total / (1024.0f * 1024.0f));
14    const auto& t = info.chipTemperature;
15    printf("Chip temperature - average: %.2f, css: %.2f, mss: %.2f, upa: %.2f, dss: %.2f\n", t.average, t.css, t.mss, t.upa, t.dss);
16    printf("Cpu usage - Leon CSS: %.2f %%, Leon MSS: %.2f %%\n", info.leonCssCpuUsage.average * 100, info.leonMssCpuUsage.average * 100);
17    printf("----------------------------------------\n");
18}
19
20int main() {
21    // Create pipeline
22    dai::Pipeline pipeline;
23
24    // Define source and output
25    auto sysLog = pipeline.create<dai::node::SystemLogger>();
26    auto xout = pipeline.create<dai::node::XLinkOut>();
27
28    xout->setStreamName("sysinfo");
29
30    // Properties
31    sysLog->setRate(1.0f);  // 1 hz updates
32
33    // Linking
34    sysLog->out.link(xout->input);
35
36    // Connect to device and start pipeline
37    dai::Device device(pipeline);
38
39    // Output queue will be used to get the system info
40    auto qSysInfo = device.getOutputQueue("sysinfo", 4, false);
41
42    while(true) {
43        auto sysInfo = qSysInfo->get<dai::SystemInformation>();
44        printSystemInformation(*sysInfo);
45    }
46    return 0;
47}

Pipeline

Need assistance?

Head over to Discussion Forum for technical support or any other questions you might have.