Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/prusa3d/PrusaSlicer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/slic3r/GUI/GUI_Utils.hpp')
-rw-r--r--src/slic3r/GUI/GUI_Utils.hpp28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/slic3r/GUI/GUI_Utils.hpp b/src/slic3r/GUI/GUI_Utils.hpp
index 1c88de570..ea2f0e782 100644
--- a/src/slic3r/GUI/GUI_Utils.hpp
+++ b/src/slic3r/GUI/GUI_Utils.hpp
@@ -18,6 +18,8 @@
#include <wx/debug.h>
#include <wx/settings.h>
+#include <chrono>
+
#include "Event.hpp"
class wxCheckBox;
@@ -396,6 +398,32 @@ inline int hex_digit_to_int(const char c)
}
#endif // ENABLE_GCODE_VIEWER
+class TaskTimer
+{
+ std::chrono::milliseconds start_timer;
+ std::string task_name;
+public:
+ TaskTimer(std::string task_name):
+ task_name(task_name.empty() ? "task" : task_name)
+ {
+ start_timer = std::chrono::duration_cast<std::chrono::milliseconds>(
+ std::chrono::system_clock::now().time_since_epoch());
+ }
+
+ ~TaskTimer()
+ {
+ std::chrono::milliseconds stop_timer = std::chrono::duration_cast<std::chrono::milliseconds>(
+ std::chrono::system_clock::now().time_since_epoch());
+ auto process_duration = std::chrono::milliseconds(stop_timer - start_timer).count();
+ std::string out = (boost::format("\n!!! %1% duration = %2% ms \n\n") % task_name % process_duration).str();
+ printf(out.c_str());
+#ifdef __WXMSW__
+ std::wstring stemp = std::wstring(out.begin(), out.end());
+ OutputDebugString(stemp.c_str());
+#endif
+ }
+};
+
}}
#endif