Skip to content

Commit 32bfa52

Browse files
committed
Merge remote-tracking branch 'origin/logging_improvements' into develop
2 parents e3b975b + cadde47 commit 32bfa52

File tree

5 files changed

+127
-72
lines changed

5 files changed

+127
-72
lines changed

src/DeviceBindings.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -482,13 +482,15 @@ void DeviceBindings::bind(pybind11::module& m, void* pCallstack){
482482
.def_readwrite("version", &Device::Config::version)
483483
.def_readwrite("board", &Device::Config::board)
484484
.def_readwrite("nonExclusiveMode", &Device::Config::nonExclusiveMode)
485+
.def_readwrite("outputLogLevel", &Device::Config::outputLogLevel)
486+
.def_readwrite("logLevel", &Device::Config::logLevel)
485487
;
486488

487489
// Bind CrashDump
488490
crashDump
489491
.def(py::init<>())
490492
.def("serializeToJson", &CrashDump::serializeToJson, DOC(dai, CrashDump, serializeToJson))
491-
493+
492494
.def_readwrite("crashReports", &CrashDump::crashReports, DOC(dai, CrashDump, crashReports))
493495
.def_readwrite("depthaiCommitHash", &CrashDump::depthaiCommitHash, DOC(dai, CrashDump, depthaiCommitHash))
494496
.def_readwrite("deviceId", &CrashDump::deviceId, DOC(dai, CrashDump, deviceId))
@@ -501,7 +503,7 @@ void DeviceBindings::bind(pybind11::module& m, void* pCallstack){
501503
.def_readwrite("crashedThreadId", &CrashDump::CrashReport::crashedThreadId, DOC(dai, CrashDump, CrashReport, crashedThreadId))
502504
.def_readwrite("threadCallstack", &CrashDump::CrashReport::threadCallstack, DOC(dai, CrashDump, CrashReport, threadCallstack))
503505
;
504-
506+
505507
errorSourceInfo
506508
.def(py::init<>())
507509
.def_readwrite("assertContext", &CrashDump::CrashReport::ErrorSourceInfo::assertContext, DOC(dai, CrashDump, CrashReport, ErrorSourceInfo, assertContext))
@@ -566,6 +568,7 @@ void DeviceBindings::bind(pybind11::module& m, void* pCallstack){
566568
.def_static("getEmbeddedDeviceBinary", py::overload_cast<DeviceBase::Config>(&DeviceBase::getEmbeddedDeviceBinary), py::arg("config"), DOC(dai, DeviceBase, getEmbeddedDeviceBinary, 2))
567569
.def_static("getDeviceByMxId", &DeviceBase::getDeviceByMxId, py::arg("mxId"), DOC(dai, DeviceBase, getDeviceByMxId))
568570
.def_static("getAllConnectedDevices", &DeviceBase::getAllConnectedDevices, DOC(dai, DeviceBase, getAllConnectedDevices))
571+
.def_static("getGlobalProfilingData", &DeviceBase::getGlobalProfilingData, DOC(dai, DeviceBase, getGlobalProfilingData))
569572

570573
// methods
571574
.def("getBootloaderVersion", &DeviceBase::getBootloaderVersion, DOC(dai, DeviceBase, getBootloaderVersion))
@@ -612,6 +615,7 @@ void DeviceBindings::bind(pybind11::module& m, void* pCallstack){
612615
.def("getUsbSpeed", [](DeviceBase& d) { py::gil_scoped_release release; return d.getUsbSpeed(); }, DOC(dai, DeviceBase, getUsbSpeed))
613616
.def("getDeviceInfo", [](DeviceBase& d) { py::gil_scoped_release release; return d.getDeviceInfo(); }, DOC(dai, DeviceBase, getDeviceInfo))
614617
.def("getMxId", [](DeviceBase& d) { py::gil_scoped_release release; return d.getMxId(); }, DOC(dai, DeviceBase, getMxId))
618+
.def("getProfilingData", [](DeviceBase& d) { py::gil_scoped_release release; return d.getProfilingData(); }, DOC(dai, DeviceBase, getProfilingData))
615619
.def("readCalibration", [](DeviceBase& d) { py::gil_scoped_release release; return d.readCalibration(); }, DOC(dai, DeviceBase, readCalibration))
616620
.def("flashCalibration", [](DeviceBase& d, CalibrationHandler calibrationDataHandler) { py::gil_scoped_release release; return d.flashCalibration(calibrationDataHandler); }, py::arg("calibrationDataHandler"), DOC(dai, DeviceBase, flashCalibration))
617621
.def("setXLinkChunkSize", [](DeviceBase& d, int s) { py::gil_scoped_release release; d.setXLinkChunkSize(s); }, py::arg("sizeBytes"), DOC(dai, DeviceBase, setXLinkChunkSize))

src/XLinkBindings.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ void XLinkBindings::bind(pybind11::module &m, void *pCallstack)
137137
.def_static("getFirstDevice", &XLinkConnection::getFirstDevice, py::arg("state") = X_LINK_ANY_STATE, py::arg("skipInvalidDevice") = true)
138138
.def_static("getDeviceByMxId", &XLinkConnection::getDeviceByMxId, py::arg("mxId"), py::arg("state") = X_LINK_ANY_STATE, py::arg("skipInvalidDevice") = true)
139139
.def_static("bootBootloader", &XLinkConnection::bootBootloader, py::arg("devInfo"))
140+
.def_static("getGlobalProfilingData", &XLinkConnection::getGlobalProfilingData, DOC(dai, XLinkConnection, getGlobalProfilingData))
140141
;
141142

142143
xLinkError

src/pipeline/CommonBindings.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
// depthai
2929
#include "depthai/common/CameraFeatures.hpp"
3030
#include "depthai/common/CameraExposureOffset.hpp"
31+
#include "depthai/utility/ProfilingData.hpp"
3132

3233
void CommonBindings::bind(pybind11::module& m, void* pCallstack){
3334

@@ -60,6 +61,7 @@ void CommonBindings::bind(pybind11::module& m, void* pCallstack){
6061
py::enum_<CameraExposureOffset> cameraExposureOffset(m, "CameraExposureOffset");
6162
py::enum_<Colormap> colormap(m, "Colormap", DOC(dai, Colormap));
6263
py::enum_<FrameEvent> frameEvent(m, "FrameEvent", DOC(dai, FrameEvent));
64+
py::class_<ProfilingData> profilingData(m, "ProfilingData", DOC(dai, ProfilingData));
6365

6466
///////////////////////////////////////////////////////////////////////
6567
///////////////////////////////////////////////////////////////////////
@@ -375,4 +377,9 @@ void CommonBindings::bind(pybind11::module& m, void* pCallstack){
375377
.value("READOUT_END", FrameEvent::READOUT_END)
376378
;
377379

380+
profilingData
381+
.def_readwrite("numBytesWritten", &ProfilingData::numBytesWritten, DOC(dai, ProfilingData, numBytesWritten))
382+
.def_readwrite("numBytesRead", &ProfilingData::numBytesRead, DOC(dai, ProfilingData, numBytesRead))
383+
;
384+
378385
}

src/pipeline/datatype/ImgFrameBindings.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ void bind_imgframe(pybind11::module& m, void* pCallstack){
234234
+ ", actual " + std::to_string(actualSize) + ". Maybe metadataOnly transfer was made?");
235235
} else if(actualSize > requiredSize) {
236236
// FIXME check build on Windows
237-
// spdlog::warn("ImgFrame has excess data: actual {}, expected {}", actualSize, requiredSize);
237+
// logger::warn("ImgFrame has excess data: actual {}, expected {}", actualSize, requiredSize);
238238
}
239239
if(img.getWidth() <= 0 || img.getHeight() <= 0){
240240
throw std::runtime_error("ImgFrame size invalid (width: " + std::to_string(img.getWidth()) + ", height: " + std::to_string(img.getHeight()) + ")");

0 commit comments

Comments
 (0)