diff --git a/modules/v4d/include/opencv2/v4d/v4d.hpp b/modules/v4d/include/opencv2/v4d/v4d.hpp index af0398213..ba785dab1 100644 --- a/modules/v4d/include/opencv2/v4d/v4d.hpp +++ b/modules/v4d/include/opencv2/v4d/v4d.hpp @@ -15,7 +15,7 @@ #include "sink.hpp" #include "util.hpp" #include "nvg.hpp" -#include "detail/backend.hpp" +#include "detail/transaction.hpp" #include "detail/threadpool.hpp" #include "detail/gl.hpp" #include "detail/framebuffercontext.hpp" @@ -282,9 +282,11 @@ public: } if (!(n->tx_->hasCondition()) && isEnabled) { - n->tx_->getContext()->execute([=]() { + n->tx_->getContext()->execute([n]() { // cout << "run: " << std::this_thread::get_id() << " " << n->name_ << ": " << isEnabled << endl; - n->tx_->perform(); + TimeTracker::getInstance()->execute(n->name_, [n](){ + n->tx_->perform(); + }); }); } } diff --git a/modules/v4d/src/detail/imguicontext.cpp b/modules/v4d/src/detail/imguicontext.cpp index 44852e320..c1568767b 100644 --- a/modules/v4d/src/detail/imguicontext.cpp +++ b/modules/v4d/src/detail/imguicontext.cpp @@ -76,7 +76,16 @@ void ImGuiContextImpl::render(bool showFPS) { ImGui::Text("%.3f ms/frame (%.1f FPS)", (1000.0f / Global::fps()) , Global::fps()); ImGui::End(); ImGui::PopStyleColor(1); - + std::stringstream ss; + TimeTracker::getInstance()->print(ss); + std::string line; + ImGui::PushStyleColor(ImGuiCol_WindowBg, ImVec4(0.0f, 0.0f, 0.0f, 0.5f)); + ImGui::Begin("Time Tracking"); + while(getline(ss, line)) { + ImGui::Text("%s", line.c_str()); + } + ImGui::End(); + ImGui::PopStyleColor(1); } if (renderCallback_) renderCallback_(context_); diff --git a/modules/v4d/src/v4d.cpp b/modules/v4d/src/v4d.cpp index 934d960e1..a80f1fa13 100644 --- a/modules/v4d/src/v4d.cpp +++ b/modules/v4d/src/v4d.cpp @@ -160,15 +160,11 @@ size_t V4D::numGlCtx() { } void V4D::copyTo(cv::UMat& m) { - TimeTracker::getInstance()->execute("copyTo", [this, &m](){ - fbCtx()->copyTo(m); - }); + fbCtx()->copyTo(m); } void V4D::copyFrom(const cv::UMat& m) { - TimeTracker::getInstance()->execute("copyTo", [this, &m](){ - fbCtx()->copyFrom(m); - }); + fbCtx()->copyFrom(m); } void V4D::setSource(cv::Ptr src) {