diff --git a/include/openpose/core/wCvMatToOpInput.hpp b/include/openpose/core/wCvMatToOpInput.hpp index afcb58b3..a815af60 100644 --- a/include/openpose/core/wCvMatToOpInput.hpp +++ b/include/openpose/core/wCvMatToOpInput.hpp @@ -64,7 +64,7 @@ namespace op tDatum.inputNetData = spCvMatToOpInput->format(tDatum.cvInputData); // Profiling speed Profiler::timerEnd(profilerKey); - Profiler::printAveragedTimeMsOnIterationX(profilerKey, __LINE__, __FUNCTION__, __FILE__, 1000); + Profiler::printAveragedTimeMsOnIterationX(profilerKey, __LINE__, __FUNCTION__, __FILE__, Profiler::DEFAULT_X); // Debugging log dLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); } diff --git a/include/openpose/core/wCvMatToOpOutput.hpp b/include/openpose/core/wCvMatToOpOutput.hpp index 19918419..9aadbb96 100644 --- a/include/openpose/core/wCvMatToOpOutput.hpp +++ b/include/openpose/core/wCvMatToOpOutput.hpp @@ -66,7 +66,7 @@ namespace op std::tie(tDatum.scaleInputToOutput, tDatum.outputData) = spCvMatToOpOutput->format(tDatum.cvInputData); // Profiling speed Profiler::timerEnd(profilerKey); - Profiler::printAveragedTimeMsOnIterationX(profilerKey, __LINE__, __FUNCTION__, __FILE__, 1000); + Profiler::printAveragedTimeMsOnIterationX(profilerKey, __LINE__, __FUNCTION__, __FILE__, Profiler::DEFAULT_X); // Debugging log dLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); } diff --git a/include/openpose/core/wKeyPointScaler.hpp b/include/openpose/core/wKeyPointScaler.hpp index 3d8e65a1..f5afa7ab 100644 --- a/include/openpose/core/wKeyPointScaler.hpp +++ b/include/openpose/core/wKeyPointScaler.hpp @@ -63,7 +63,7 @@ namespace op } // Profiling speed Profiler::timerEnd(profilerKey); - Profiler::printAveragedTimeMsOnIterationX(profilerKey, __LINE__, __FUNCTION__, __FILE__, 1000); + Profiler::printAveragedTimeMsOnIterationX(profilerKey, __LINE__, __FUNCTION__, __FILE__, Profiler::DEFAULT_X); // Debugging log dLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); } diff --git a/include/openpose/core/wOpOutputToCvMat.hpp b/include/openpose/core/wOpOutputToCvMat.hpp index 18c9de48..d91e20f0 100644 --- a/include/openpose/core/wOpOutputToCvMat.hpp +++ b/include/openpose/core/wOpOutputToCvMat.hpp @@ -64,7 +64,7 @@ namespace op tDatum.cvOutputData = spOpOutputToCvMat->formatToCvMat(tDatum.outputData); // Profiling speed Profiler::timerEnd(profilerKey); - Profiler::printAveragedTimeMsOnIterationX(profilerKey, __LINE__, __FUNCTION__, __FILE__, 1000); + Profiler::printAveragedTimeMsOnIterationX(profilerKey, __LINE__, __FUNCTION__, __FILE__, Profiler::DEFAULT_X); // Debugging log dLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); } diff --git a/include/openpose/experimental/face/wFaceExtractor.hpp b/include/openpose/experimental/face/wFaceExtractor.hpp index dd6c8373..dc3a8afc 100644 --- a/include/openpose/experimental/face/wFaceExtractor.hpp +++ b/include/openpose/experimental/face/wFaceExtractor.hpp @@ -71,7 +71,7 @@ namespace op } // Profiling speed Profiler::timerEnd(profilerKey); - Profiler::printAveragedTimeMsOnIterationX(profilerKey, __LINE__, __FUNCTION__, __FILE__, 1000); + Profiler::printAveragedTimeMsOnIterationX(profilerKey, __LINE__, __FUNCTION__, __FILE__, Profiler::DEFAULT_X); // Debugging log dLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); } diff --git a/include/openpose/experimental/face/wFaceRenderer.hpp b/include/openpose/experimental/face/wFaceRenderer.hpp index 9d75ffd2..a871843a 100644 --- a/include/openpose/experimental/face/wFaceRenderer.hpp +++ b/include/openpose/experimental/face/wFaceRenderer.hpp @@ -68,7 +68,7 @@ namespace op spFaceRenderer->renderFace(tDatum.outputData, tDatum.faceKeyPoints); // Profiling speed Profiler::timerEnd(profilerKey); - Profiler::printAveragedTimeMsOnIterationX(profilerKey, __LINE__, __FUNCTION__, __FILE__, 1000); + Profiler::printAveragedTimeMsOnIterationX(profilerKey, __LINE__, __FUNCTION__, __FILE__, Profiler::DEFAULT_X); // Debugging log dLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); } diff --git a/include/openpose/experimental/filestream/wPoseJsonCocoSaver.hpp b/include/openpose/experimental/filestream/wPoseJsonCocoSaver.hpp index 73508ff5..f1ecdc72 100644 --- a/include/openpose/experimental/filestream/wPoseJsonCocoSaver.hpp +++ b/include/openpose/experimental/filestream/wPoseJsonCocoSaver.hpp @@ -81,7 +81,7 @@ namespace op spPoseJsonCocoSaver->record(tDatum.poseKeyPoints, imageId); // Profiling speed Profiler::timerEnd(profilerKey); - Profiler::printAveragedTimeMsOnIterationX(profilerKey, __LINE__, __FUNCTION__, __FILE__, 1000); + Profiler::printAveragedTimeMsOnIterationX(profilerKey, __LINE__, __FUNCTION__, __FILE__, Profiler::DEFAULT_X); } else { diff --git a/include/openpose/experimental/hand/wHandExtractor.hpp b/include/openpose/experimental/hand/wHandExtractor.hpp index ee6e54e5..0dc07f93 100644 --- a/include/openpose/experimental/hand/wHandExtractor.hpp +++ b/include/openpose/experimental/hand/wHandExtractor.hpp @@ -71,7 +71,7 @@ namespace op } // Profiling speed Profiler::timerEnd(profilerKey); - Profiler::printAveragedTimeMsOnIterationX(profilerKey, __LINE__, __FUNCTION__, __FILE__, 1000); + Profiler::printAveragedTimeMsOnIterationX(profilerKey, __LINE__, __FUNCTION__, __FILE__, Profiler::DEFAULT_X); // Debugging log dLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); } diff --git a/include/openpose/experimental/hand/wHandRenderer.hpp b/include/openpose/experimental/hand/wHandRenderer.hpp index 7ff7ddc6..7931dede 100644 --- a/include/openpose/experimental/hand/wHandRenderer.hpp +++ b/include/openpose/experimental/hand/wHandRenderer.hpp @@ -68,7 +68,7 @@ namespace op spHandRenderer->renderHands(tDatum.outputData, tDatum.handKeyPoints); // Profiling speed Profiler::timerEnd(profilerKey); - Profiler::printAveragedTimeMsOnIterationX(profilerKey, __LINE__, __FUNCTION__, __FILE__, 1000); + Profiler::printAveragedTimeMsOnIterationX(profilerKey, __LINE__, __FUNCTION__, __FILE__, Profiler::DEFAULT_X); // Debugging log dLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); } diff --git a/include/openpose/filestream/wHeatMapSaver.hpp b/include/openpose/filestream/wHeatMapSaver.hpp index 845533d9..80f15272 100644 --- a/include/openpose/filestream/wHeatMapSaver.hpp +++ b/include/openpose/filestream/wHeatMapSaver.hpp @@ -70,7 +70,7 @@ namespace op spHeatMapSaver->saveHeatMaps(poseHeatMaps, fileName); // Profiling speed Profiler::timerEnd(profilerKey); - Profiler::printAveragedTimeMsOnIterationX(profilerKey, __LINE__, __FUNCTION__, __FILE__, 1000); + Profiler::printAveragedTimeMsOnIterationX(profilerKey, __LINE__, __FUNCTION__, __FILE__, Profiler::DEFAULT_X); // Debugging log dLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); } diff --git a/include/openpose/filestream/wImageSaver.hpp b/include/openpose/filestream/wImageSaver.hpp index f38f037b..f4365659 100644 --- a/include/openpose/filestream/wImageSaver.hpp +++ b/include/openpose/filestream/wImageSaver.hpp @@ -70,7 +70,7 @@ namespace op spImageSaver->saveImages(cvOutputDatas, fileName); // Profiling speed Profiler::timerEnd(profilerKey); - Profiler::printAveragedTimeMsOnIterationX(profilerKey, __LINE__, __FUNCTION__, __FILE__, 1000); + Profiler::printAveragedTimeMsOnIterationX(profilerKey, __LINE__, __FUNCTION__, __FILE__, Profiler::DEFAULT_X); // Debugging log dLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); } diff --git a/include/openpose/filestream/wPoseJsonSaver.hpp b/include/openpose/filestream/wPoseJsonSaver.hpp index 0c3e76c8..c430d3e7 100644 --- a/include/openpose/filestream/wPoseJsonSaver.hpp +++ b/include/openpose/filestream/wPoseJsonSaver.hpp @@ -68,7 +68,7 @@ namespace op spPoseJsonSaver->savePoseKeyPoints(poseKeyPointsVector, fileName); // Profiling speed Profiler::timerEnd(profilerKey); - Profiler::printAveragedTimeMsOnIterationX(profilerKey, __LINE__, __FUNCTION__, __FILE__, 1000); + Profiler::printAveragedTimeMsOnIterationX(profilerKey, __LINE__, __FUNCTION__, __FILE__, Profiler::DEFAULT_X); // Debugging log dLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); } diff --git a/include/openpose/filestream/wPoseSaver.hpp b/include/openpose/filestream/wPoseSaver.hpp index e1e375e0..6f445cd3 100644 --- a/include/openpose/filestream/wPoseSaver.hpp +++ b/include/openpose/filestream/wPoseSaver.hpp @@ -69,7 +69,7 @@ namespace op spPoseSaver->savePoseKeyPoints(poseKeyPointsVector, fileName); // Profiling speed Profiler::timerEnd(profilerKey); - Profiler::printAveragedTimeMsOnIterationX(profilerKey, __LINE__, __FUNCTION__, __FILE__, 1000); + Profiler::printAveragedTimeMsOnIterationX(profilerKey, __LINE__, __FUNCTION__, __FILE__, Profiler::DEFAULT_X); // Debugging log dLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); } diff --git a/include/openpose/filestream/wVideoSaver.hpp b/include/openpose/filestream/wVideoSaver.hpp index 56985ace..42689616 100644 --- a/include/openpose/filestream/wVideoSaver.hpp +++ b/include/openpose/filestream/wVideoSaver.hpp @@ -69,7 +69,7 @@ namespace op spVideoSaver->write(cvOutputDatas); // Profiling speed Profiler::timerEnd(profilerKey); - Profiler::printAveragedTimeMsOnIterationX(profilerKey, __LINE__, __FUNCTION__, __FILE__, 1000); + Profiler::printAveragedTimeMsOnIterationX(profilerKey, __LINE__, __FUNCTION__, __FILE__, Profiler::DEFAULT_X); // Debugging log dLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); } diff --git a/include/openpose/gui/wGui.hpp b/include/openpose/gui/wGui.hpp index 0d5cf2da..ba64e26a 100644 --- a/include/openpose/gui/wGui.hpp +++ b/include/openpose/gui/wGui.hpp @@ -71,7 +71,7 @@ namespace op if (!tDatumsNoPtr.empty()) { Profiler::timerEnd(profilerKey); - Profiler::printAveragedTimeMsOnIterationX(profilerKey, __LINE__, __FUNCTION__, __FILE__, 1000); + Profiler::printAveragedTimeMsOnIterationX(profilerKey, __LINE__, __FUNCTION__, __FILE__, Profiler::DEFAULT_X); } // Debugging log dLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); diff --git a/include/openpose/gui/wGuiInfoAdder.hpp b/include/openpose/gui/wGuiInfoAdder.hpp index 44b2f2b5..13f2a36c 100644 --- a/include/openpose/gui/wGuiInfoAdder.hpp +++ b/include/openpose/gui/wGuiInfoAdder.hpp @@ -61,7 +61,7 @@ namespace op spGuiInfoAdder->addInfo(tDatum.cvOutputData, tDatum.poseKeyPoints, tDatum.id, tDatum.elementRendered.second); // Profiling speed Profiler::timerEnd(profilerKey); - Profiler::printAveragedTimeMsOnIterationX(profilerKey, __LINE__, __FUNCTION__, __FILE__, 1000); + Profiler::printAveragedTimeMsOnIterationX(profilerKey, __LINE__, __FUNCTION__, __FILE__, Profiler::DEFAULT_X); // Debugging log dLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); } diff --git a/include/openpose/pose/wPoseExtractor.hpp b/include/openpose/pose/wPoseExtractor.hpp index f32d6b7b..c1e0aad2 100644 --- a/include/openpose/pose/wPoseExtractor.hpp +++ b/include/openpose/pose/wPoseExtractor.hpp @@ -68,7 +68,7 @@ namespace op } // Profiling speed Profiler::timerEnd(profilerKey); - Profiler::printAveragedTimeMsOnIterationX(profilerKey, __LINE__, __FUNCTION__, __FILE__, 1000); + Profiler::printAveragedTimeMsOnIterationX(profilerKey, __LINE__, __FUNCTION__, __FILE__, Profiler::DEFAULT_X); // Debugging log dLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); } diff --git a/include/openpose/pose/wPoseRenderer.hpp b/include/openpose/pose/wPoseRenderer.hpp index f95336e9..13aea92e 100644 --- a/include/openpose/pose/wPoseRenderer.hpp +++ b/include/openpose/pose/wPoseRenderer.hpp @@ -63,7 +63,7 @@ namespace op tDatum.elementRendered = spPoseRenderer->renderPose(tDatum.outputData, tDatum.poseKeyPoints, tDatum.scaleNetToOutput); // Profiling speed Profiler::timerEnd(profilerKey); - Profiler::printAveragedTimeMsOnIterationX(profilerKey, __LINE__, __FUNCTION__, __FILE__, 1000); + Profiler::printAveragedTimeMsOnIterationX(profilerKey, __LINE__, __FUNCTION__, __FILE__, Profiler::DEFAULT_X); // Debugging log dLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); } diff --git a/include/openpose/producer/wDatumProducer.hpp b/include/openpose/producer/wDatumProducer.hpp index 9d2b529b..43f34731 100644 --- a/include/openpose/producer/wDatumProducer.hpp +++ b/include/openpose/producer/wDatumProducer.hpp @@ -64,7 +64,7 @@ namespace op this->stop(); // Profiling speed Profiler::timerEnd(profilerKey); - Profiler::printAveragedTimeMsOnIterationX(profilerKey, __LINE__, __FUNCTION__, __FILE__, 1000); + Profiler::printAveragedTimeMsOnIterationX(profilerKey, __LINE__, __FUNCTION__, __FILE__, Profiler::DEFAULT_X); // Debugging log dLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); // Return TDatums diff --git a/include/openpose/thread/wQueueOrderer.hpp b/include/openpose/thread/wQueueOrderer.hpp index 8f1ad36f..317695e0 100644 --- a/include/openpose/thread/wQueueOrderer.hpp +++ b/include/openpose/thread/wQueueOrderer.hpp @@ -108,7 +108,7 @@ namespace op { // Profiling speed Profiler::timerEnd(profilerKey); - Profiler::printAveragedTimeMsOnIterationX(profilerKey, __LINE__, __FUNCTION__, __FILE__, 1000); + Profiler::printAveragedTimeMsOnIterationX(profilerKey, __LINE__, __FUNCTION__, __FILE__, Profiler::DEFAULT_X); // Debugging log dLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); } diff --git a/include/openpose/utilities/profiler.hpp b/include/openpose/utilities/profiler.hpp index 02746da6..0d44a941 100644 --- a/include/openpose/utilities/profiler.hpp +++ b/include/openpose/utilities/profiler.hpp @@ -13,20 +13,22 @@ // const auto profilerKey = Profiler::timerInit(__LINE__, __FUNCTION__, __FILE__); // // functions to do... // Profiler::timerEnd(profilerKey); - // Profiler::printAveragedTimeMsOnIterationX(profilerKey, __LINE__, __FUNCTION__, __FILE__, 1000); + // Profiler::printAveragedTimeMsOnIterationX(profilerKey, __LINE__, __FUNCTION__, __FILE__, Profiler::DEFAULT_X); namespace op { class Profiler { public: + static const unsigned long long DEFAULT_X; + static const std::string timerInit(const int line, const std::string& function, const std::string& file); static void timerEnd(const std::string& key); - static void printAveragedTimeMsOnIterationX(const std::string& key, const int line, const std::string& function, const std::string& file, const unsigned long long x); + static void printAveragedTimeMsOnIterationX(const std::string& key, const int line, const std::string& function, const std::string& file, const unsigned long long x = DEFAULT_X); - static void printAveragedTimeMsEveryXIterations(const std::string& key, const int line, const std::string& function, const std::string& file, const unsigned long long x); + static void printAveragedTimeMsEveryXIterations(const std::string& key, const int line, const std::string& function, const std::string& file, const unsigned long long x = DEFAULT_X); static void profileGpuMemory(const int line, const std::string& function, const std::string& file); }; diff --git a/src/openpose/utilities/profiler.cpp b/src/openpose/utilities/profiler.cpp index 47e8a371..3852fbfd 100644 --- a/src/openpose/utilities/profiler.cpp +++ b/src/openpose/utilities/profiler.cpp @@ -11,7 +11,10 @@ namespace op { + const unsigned long long Profiler::DEFAULT_X = 1000; + #ifdef PROFILER_ENABLED + std::map> sProfilerTuple{ std::map>() };