1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-30 15:53:03 +04:00

core(trace/itt): avoid calling __itt_thread_set_name() by default

- don't override current application thread names
- set name for own threads only
This commit is contained in:
Alexander Alekhin
2019-12-07 21:41:15 +00:00
parent 629d47fcd8
commit 816f82682b
2 changed files with 16 additions and 1 deletions
+11 -1
View File
@@ -1888,6 +1888,15 @@ BOOL WINAPI DllMain(HINSTANCE, DWORD fdwReason, LPVOID lpReserved)
namespace {
#ifdef OPENCV_WITH_ITT
bool overrideThreadName()
{
static bool param = utils::getConfigurationParameterBool("OPENCV_TRACE_ITT_SET_THREAD_NAME", false);
return param;
}
#endif
static int g_threadNum = 0;
class ThreadID {
public:
@@ -1896,7 +1905,8 @@ public:
id(CV_XADD(&g_threadNum, 1))
{
#ifdef OPENCV_WITH_ITT
__itt_thread_set_name(cv::format("OpenCVThread-%03d", id).c_str());
if (overrideThreadName())
__itt_thread_set_name(cv::format("OpenCVThread-%03d", id).c_str());
#endif
}
};