system_information.cpp
Go to the documentation of this file.
1 #include <iostream>
2 
3 // Includes common necessary includes for development using depthai library
4 #include "depthai/depthai.hpp"
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 
20 int 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 }
main
int main()
Definition: system_information.cpp:20
dai::node::XLinkOut
XLinkOut node. Sends messages over XLink.
Definition: XLinkOut.hpp:14
printSystemInformation
void printSystemInformation(dai::SystemInformation info)
Definition: system_information.cpp:5
dai::Pipeline
Represents the pipeline, set of nodes and connections between them.
Definition: Pipeline.hpp:100
dai::logger::info
void info(const FormatString &fmt, Args &&...args)
Definition: Logging.hpp:78
dai::node::SystemLogger::setRate
void setRate(float hz)
Definition: SystemLogger.cpp:15
dai::node::SystemLogger
SystemLogger node. Send system information periodically.
Definition: SystemLogger.hpp:14
dai::Device::getOutputQueue
std::shared_ptr< DataOutputQueue > getOutputQueue(const std::string &name)
Definition: Device.cpp:86
depthai.hpp
dai::Pipeline::create
std::shared_ptr< N > create()
Definition: Pipeline.hpp:145
dai::SystemInformation
Definition: SystemInformation.hpp:14
dai::Device
Definition: Device.hpp:21


depthai
Author(s): Martin Peterlin
autogenerated on Sat Mar 22 2025 02:58:19