1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-29 15:23:05 +04:00

core(logger): dump timestamp information with message

This commit is contained in:
Alexander Alekhin
2021-11-20 15:34:23 +00:00
parent 93b6e80cd7
commit 61f1ee2d2d
4 changed files with 74 additions and 18 deletions
+4 -13
View File
@@ -63,15 +63,6 @@ namespace details {
#pragma warning(disable:4065) // switch statement contains 'default' but no 'case' labels
#endif
static int64 g_zero_timestamp = 0;
static int64 getTimestamp()
{
int64 t = getTickCount();
static double tick_to_ns = 1e9 / getTickFrequency();
return (int64)((t - g_zero_timestamp) * tick_to_ns);
}
static bool getParameterTraceEnable()
{
static bool param_traceEnable = utils::getConfigurationParameterBool("OPENCV_TRACE", false);
@@ -485,7 +476,7 @@ Region::Region(const LocationStaticStorage& location) :
}
}
int64 beginTimestamp = getTimestamp();
int64 beginTimestamp = getTimestampNS();
int currentDepth = ctx.getCurrentDepth() + 1;
switch (location.flags & REGION_FLAG_IMPL_MASK)
@@ -635,7 +626,7 @@ void Region::destroy()
}
}
int64 endTimestamp = getTimestamp();
int64 endTimestamp = getTimestampNS();
int64 duration = endTimestamp - ctx.stackTopBeginTimestamp();
bool active = isActive();
@@ -844,7 +835,7 @@ static bool isInitialized = false;
TraceManager::TraceManager()
{
g_zero_timestamp = cv::getTickCount();
(void)cv::getTimestampNS();
isInitialized = true;
CV_LOG("TraceManager ctor: " << (void*)this);
@@ -990,7 +981,7 @@ void parallelForFinalize(const Region& rootRegion)
{
TraceManagerThreadLocal& ctx = getTraceManager().tls.getRef();
int64 endTimestamp = getTimestamp();
int64 endTimestamp = getTimestampNS();
int64 duration = endTimestamp - ctx.stackTopBeginTimestamp();
CV_LOG_PARALLEL(NULL, "parallel_for duration: " << duration << " " << &rootRegion);