From be989b3b60619a13bb47b0b2a1024e378eaffd61 Mon Sep 17 00:00:00 2001 From: Rostislav Vasilikhin Date: Thu, 27 Sep 2018 22:39:06 +0300 Subject: [PATCH] Merge pull request #12637 from savuor:fix/instr_ipp_ocl Fixes for instrumentation of IPP and OCL (#12637) * fixed warning about re-declaring variable when both IPP and instrumentation are enabled * fixed segfault when no funName provided * compilation fixed when both OCL and instrumentation are enabled --- modules/core/include/opencv2/core/private.hpp | 6 +++--- modules/core/src/ocl.cpp | 2 +- modules/core/src/system.cpp | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/modules/core/include/opencv2/core/private.hpp b/modules/core/include/opencv2/core/private.hpp index 32ca987c45..ef09d254ca 100644 --- a/modules/core/include/opencv2/core/private.hpp +++ b/modules/core/include/opencv2/core/private.hpp @@ -713,12 +713,12 @@ CV_EXPORTS InstrNode* getCurrentNode(); if(::cv::instr::useInstrumentation()){\ ::cv::instr::IntrumentationRegion __instr__(#FUN, __FILE__, __LINE__, NULL, false, TYPE, IMPL);\ try{\ - auto status = ((FUN)(__VA_ARGS__));\ + auto instrStatus = ((FUN)(__VA_ARGS__));\ if(ERROR_COND){\ ::cv::instr::getCurrentNode()->m_payload.m_funError = true;\ CV_INSTRUMENT_MARK_META(IMPL, #FUN " - BadExit");\ }\ - return status;\ + return instrStatus;\ }catch(...){\ ::cv::instr::getCurrentNode()->m_payload.m_funError = true;\ CV_INSTRUMENT_MARK_META(IMPL, #FUN " - BadExit");\ @@ -759,7 +759,7 @@ CV_EXPORTS InstrNode* getCurrentNode(); // Wrapper region instrumentation macro #define CV_INSTRUMENT_REGION_IPP(); CV_INSTRUMENT_REGION_META(__FUNCTION__, false, ::cv::instr::TYPE_WRAPPER, ::cv::instr::IMPL_IPP) // Function instrumentation macro -#define CV_INSTRUMENT_FUN_IPP(FUN, ...) CV_INSTRUMENT_FUN_RT_META(::cv::instr::TYPE_FUN, ::cv::instr::IMPL_IPP, status < 0, FUN, __VA_ARGS__) +#define CV_INSTRUMENT_FUN_IPP(FUN, ...) CV_INSTRUMENT_FUN_RT_META(::cv::instr::TYPE_FUN, ::cv::instr::IMPL_IPP, instrStatus < 0, FUN, __VA_ARGS__) // Diagnostic markers #define CV_INSTRUMENT_MARK_IPP(NAME) CV_INSTRUMENT_MARK_META(::cv::instr::IMPL_IPP, NAME) diff --git a/modules/core/src/ocl.cpp b/modules/core/src/ocl.cpp index e5d047fc88..a73ddbb0bb 100644 --- a/modules/core/src/ocl.cpp +++ b/modules/core/src/ocl.cpp @@ -3091,7 +3091,7 @@ bool Kernel::run(int dims, size_t _globalsize[], size_t _localsize[], bool Kernel::Impl::run(int dims, size_t globalsize[], size_t localsize[], bool sync, int64* timeNS, const Queue& q) { - CV_INSTRUMENT_REGION_OPENCL_RUN(name.c_str();); + CV_INSTRUMENT_REGION_OPENCL_RUN(name.c_str()); if (!handle || isInProgress) return false; diff --git a/modules/core/src/system.cpp b/modules/core/src/system.cpp index 3616178cdb..f1de60fd9a 100644 --- a/modules/core/src/system.cpp +++ b/modules/core/src/system.cpp @@ -1836,7 +1836,7 @@ FLAGS getFlags() NodeData::NodeData(const char* funName, const char* fileName, int lineNum, void* retAddress, bool alwaysExpand, cv::instr::TYPE instrType, cv::instr::IMPL implType) { - m_funName = funName; + m_funName = funName ? cv::String(funName) : cv::String(); // std::string doesn't accept NULL m_instrType = instrType; m_implType = implType; m_fileName = fileName;