Loading src/toolbox/regionlock.cpp +16 −2 Original line number Diff line number Diff line Loading @@ -65,6 +65,11 @@ std::string GetSceneTypeStr(const scene_type &sceneType) lock_handle SceneLocks::checkAndLock(CustomLock* newLock) { #ifdef MITOGEN_DEBUG_MULTITHREADING // get start time const report_clock::time_point startTime = report_clock::now(); #endif bool lockAcquired = false; std::unique_lock<std::mutex> listSearchLock(listSearchLock_st); Loading Loading @@ -125,8 +130,17 @@ lock_handle SceneLocks::checkAndLock(CustomLock* newLock) // *** Lock acquired *** listOfCustomLocks.push_back(newLock); lockAcquired = true; #ifdef MITOGEN_DEBUG_MULTITHREADING newLock->printLockInfo(); // get current time const report_clock::time_point currentTime = report_clock::now(); // get elapsed time const report_clock::duration timeToAcquireLock = currentTime - startTime; const std::chrono::milliseconds timeToAcquireLock_ms = std::chrono::duration_cast<std::chrono::milliseconds>(timeToAcquireLock); newLock->printLockInfo(timeToAcquireLock_ms); #endif #ifdef GTGEN_WITH_LOCKVISUALIZATION // save visualization Loading src/toolbox/regionlock.h +21 −33 Original line number Diff line number Diff line Loading @@ -101,7 +101,14 @@ public: size_t getToTimePoint() const { return toTimePoint; } virtual void printLockInfo() const = 0; // wrapper for printLockInfo void printLockInfo() const { const std::chrono::milliseconds timeToAcquireLock(0); printLockInfo(timeToAcquireLock); } virtual void printLockInfo(const std::chrono::milliseconds timeToAcquireLock) const = 0; protected: Loading Loading @@ -132,21 +139,13 @@ public: lock_type getLockType() const { return timePoint_lock; } void printLockInfo() const { if (fromTimePoint == toTimePoint) void printLockInfo(const std::chrono::milliseconds timeToAcquireLock) const { REPORT("TIME lock, timePoint " << fromTimePoint REPORT("TIME lock" << ", waiting time: " << timeToAcquireLock.count() << "ms" << ", timePoint: " << fromTimePoint << "-" << toTimePoint << ", sceneType: " << GetSceneTypeStr(sceneType)); } else { REPORT("TIME lock, timePoint " << fromTimePoint << "-" << toTimePoint << ", sceneType: " << GetSceneTypeStr(sceneType)); } } }; Loading Loading @@ -199,27 +198,16 @@ public: size_t getCellID() const { return cellID; } void printLockInfo() const { if (fromTimePoint == toTimePoint) void printLockInfo(const std::chrono::milliseconds timeToAcquireLock) const { REPORT("SPHERE lock" << ", timePoint " << fromTimePoint << ", waiting time: " << timeToAcquireLock.count() << "ms" << ", timePoint: " << fromTimePoint << "-" << toTimePoint << ", sceneType: " << GetSceneTypeStr(sceneType) << ", centre: [" << sphereCentre.x << ", " << sphereCentre.y << ", " << sphereCentre.z << "], radius: " << sphereRadius); } else { REPORT("SPHERE lock" << ", timePoint " << fromTimePoint << "-" << toTimePoint << ", sceneType: " << GetSceneTypeStr(sceneType) << ", centre: [" << sphereCentre.x << ", " << sphereCentre.y << ", " << sphereCentre.z << "], radius: " << sphereRadius); } } private: Loading Loading
src/toolbox/regionlock.cpp +16 −2 Original line number Diff line number Diff line Loading @@ -65,6 +65,11 @@ std::string GetSceneTypeStr(const scene_type &sceneType) lock_handle SceneLocks::checkAndLock(CustomLock* newLock) { #ifdef MITOGEN_DEBUG_MULTITHREADING // get start time const report_clock::time_point startTime = report_clock::now(); #endif bool lockAcquired = false; std::unique_lock<std::mutex> listSearchLock(listSearchLock_st); Loading Loading @@ -125,8 +130,17 @@ lock_handle SceneLocks::checkAndLock(CustomLock* newLock) // *** Lock acquired *** listOfCustomLocks.push_back(newLock); lockAcquired = true; #ifdef MITOGEN_DEBUG_MULTITHREADING newLock->printLockInfo(); // get current time const report_clock::time_point currentTime = report_clock::now(); // get elapsed time const report_clock::duration timeToAcquireLock = currentTime - startTime; const std::chrono::milliseconds timeToAcquireLock_ms = std::chrono::duration_cast<std::chrono::milliseconds>(timeToAcquireLock); newLock->printLockInfo(timeToAcquireLock_ms); #endif #ifdef GTGEN_WITH_LOCKVISUALIZATION // save visualization Loading
src/toolbox/regionlock.h +21 −33 Original line number Diff line number Diff line Loading @@ -101,7 +101,14 @@ public: size_t getToTimePoint() const { return toTimePoint; } virtual void printLockInfo() const = 0; // wrapper for printLockInfo void printLockInfo() const { const std::chrono::milliseconds timeToAcquireLock(0); printLockInfo(timeToAcquireLock); } virtual void printLockInfo(const std::chrono::milliseconds timeToAcquireLock) const = 0; protected: Loading Loading @@ -132,21 +139,13 @@ public: lock_type getLockType() const { return timePoint_lock; } void printLockInfo() const { if (fromTimePoint == toTimePoint) void printLockInfo(const std::chrono::milliseconds timeToAcquireLock) const { REPORT("TIME lock, timePoint " << fromTimePoint REPORT("TIME lock" << ", waiting time: " << timeToAcquireLock.count() << "ms" << ", timePoint: " << fromTimePoint << "-" << toTimePoint << ", sceneType: " << GetSceneTypeStr(sceneType)); } else { REPORT("TIME lock, timePoint " << fromTimePoint << "-" << toTimePoint << ", sceneType: " << GetSceneTypeStr(sceneType)); } } }; Loading Loading @@ -199,27 +198,16 @@ public: size_t getCellID() const { return cellID; } void printLockInfo() const { if (fromTimePoint == toTimePoint) void printLockInfo(const std::chrono::milliseconds timeToAcquireLock) const { REPORT("SPHERE lock" << ", timePoint " << fromTimePoint << ", waiting time: " << timeToAcquireLock.count() << "ms" << ", timePoint: " << fromTimePoint << "-" << toTimePoint << ", sceneType: " << GetSceneTypeStr(sceneType) << ", centre: [" << sphereCentre.x << ", " << sphereCentre.y << ", " << sphereCentre.z << "], radius: " << sphereRadius); } else { REPORT("SPHERE lock" << ", timePoint " << fromTimePoint << "-" << toTimePoint << ", sceneType: " << GetSceneTypeStr(sceneType) << ", centre: [" << sphereCentre.x << ", " << sphereCentre.y << ", " << sphereCentre.z << "], radius: " << sphereRadius); } } private: Loading