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

Implementations instrumentation framework for OpenCV performance system;

This commit is contained in:
Pavel Vlasov
2016-08-15 17:12:45 +03:00
parent cd943cc60d
commit a462d76a95
10 changed files with 790 additions and 32 deletions
+17
View File
@@ -149,13 +149,25 @@ namespace
public:
ParallelLoopBodyWrapper(const cv::ParallelLoopBody& _body, const cv::Range& _r, double _nstripes)
{
body = &_body;
wholeRange = _r;
double len = wholeRange.end - wholeRange.start;
nstripes = cvRound(_nstripes <= 0 ? len : MIN(MAX(_nstripes, 1.), len));
#ifdef ENABLE_INSTRUMENTATION
pThreadRoot = cv::instr::getInstrumentTLSStruct().pCurrentNode;
#endif
}
void operator()(const cv::Range& sr) const
{
#ifdef ENABLE_INSTRUMENTATION
{
cv::instr::InstrTLSStruct *pInstrTLS = &cv::instr::getInstrumentTLSStruct();
pInstrTLS->pCurrentNode = pThreadRoot; // Initialize TLS node for thread
}
#endif
cv::Range r;
r.start = (int)(wholeRange.start +
((uint64)sr.start*(wholeRange.end - wholeRange.start) + nstripes/2)/nstripes);
@@ -169,6 +181,9 @@ namespace
const cv::ParallelLoopBody* body;
cv::Range wholeRange;
int nstripes;
#ifdef ENABLE_INSTRUMENTATION
cv::instr::InstrNode *pThreadRoot;
#endif
};
#if defined HAVE_TBB
@@ -252,6 +267,8 @@ static SchedPtr pplScheduler;
void cv::parallel_for_(const cv::Range& range, const cv::ParallelLoopBody& body, double nstripes)
{
CV_INSTRUMENT_REGION()
#ifdef CV_PARALLEL_FRAMEWORK
if(numThreads != 0)