Fixed missing include on Linux, printf format string fix
boost/format.hpp was missing in the header
This commit is contained in:
parent
1130778d5e
commit
dd94b34a8d
@ -267,5 +267,26 @@ std::ostream& operator<<(std::ostream &os, const WindowMetrics& metrics)
|
||||
}
|
||||
|
||||
|
||||
TaskTimer::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::~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("%s", out.c_str());
|
||||
#ifdef __WXMSW__
|
||||
std::wstring stemp = std::wstring(out.begin(), out.end());
|
||||
OutputDebugString(stemp.c_str());
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -399,25 +399,9 @@ 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::string task_name);
|
||||
|
||||
~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
|
||||
}
|
||||
~TaskTimer();
|
||||
};
|
||||
|
||||
}}
|
||||
|
Loading…
Reference in New Issue
Block a user