mirror of
https://github.com/opencv/opencv.git
synced 2026-07-29 15:23:05 +04:00
--perf_instrument parameter now has int type and 0, 1, 2 modes (1 - simple trees, 2 - expanded trees for functions with same name but different calling address);
Maximum depth limit var was added to the instrumentation structure; Trace names output console output fix: improper tree formatting could happen; Output in case of error was added; Custom regions improvements; Improved timing and weight calculation for parallel regions; New TC (threads counter) value to indicate how many different threads accessed particular node; parallel_for, warnings fixes and ReturnAddress code from Alexander Alekhin;
This commit is contained in:
@@ -144,7 +144,33 @@ namespace cv
|
||||
namespace
|
||||
{
|
||||
#ifdef CV_PARALLEL_FRAMEWORK
|
||||
class ParallelLoopBodyWrapper
|
||||
#ifdef ENABLE_INSTRUMENTATION
|
||||
static void SyncNodes(cv::instr::InstrNode *pNode)
|
||||
{
|
||||
std::vector<cv::instr::NodeDataTls*> data;
|
||||
pNode->m_payload.m_tls.gather(data);
|
||||
|
||||
uint64 ticksMax = 0;
|
||||
int threads = 0;
|
||||
for(size_t i = 0; i < data.size(); i++)
|
||||
{
|
||||
if(data[i] && data[i]->m_ticksTotal)
|
||||
{
|
||||
ticksMax = MAX(ticksMax, data[i]->m_ticksTotal);
|
||||
pNode->m_payload.m_ticksTotal -= data[i]->m_ticksTotal;
|
||||
data[i]->m_ticksTotal = 0;
|
||||
threads++;
|
||||
}
|
||||
}
|
||||
pNode->m_payload.m_ticksTotal += ticksMax;
|
||||
pNode->m_payload.m_threads = MAX(pNode->m_payload.m_threads, threads);
|
||||
|
||||
for(size_t i = 0; i < pNode->m_childs.size(); i++)
|
||||
SyncNodes(pNode->m_childs[i]);
|
||||
}
|
||||
#endif
|
||||
|
||||
class ParallelLoopBodyWrapper : public cv::ParallelLoopBody
|
||||
{
|
||||
public:
|
||||
ParallelLoopBodyWrapper(const cv::ParallelLoopBody& _body, const cv::Range& _r, double _nstripes)
|
||||
@@ -159,6 +185,13 @@ namespace
|
||||
pThreadRoot = cv::instr::getInstrumentTLSStruct().pCurrentNode;
|
||||
#endif
|
||||
}
|
||||
#ifdef ENABLE_INSTRUMENTATION
|
||||
~ParallelLoopBodyWrapper()
|
||||
{
|
||||
for(size_t i = 0; i < pThreadRoot->m_childs.size(); i++)
|
||||
SyncNodes(pThreadRoot->m_childs[i]);
|
||||
}
|
||||
#endif
|
||||
void operator()(const cv::Range& sr) const
|
||||
{
|
||||
#ifdef ENABLE_INSTRUMENTATION
|
||||
@@ -167,6 +200,7 @@ namespace
|
||||
pInstrTLS->pCurrentNode = pThreadRoot; // Initialize TLS node for thread
|
||||
}
|
||||
#endif
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
cv::Range r;
|
||||
r.start = (int)(wholeRange.start +
|
||||
@@ -267,7 +301,9 @@ static SchedPtr pplScheduler;
|
||||
|
||||
void cv::parallel_for_(const cv::Range& range, const cv::ParallelLoopBody& body, double nstripes)
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
CV_INSTRUMENT_REGION_MT_FORK()
|
||||
if (range.empty())
|
||||
return;
|
||||
|
||||
#ifdef CV_PARALLEL_FRAMEWORK
|
||||
|
||||
@@ -326,7 +362,7 @@ void cv::parallel_for_(const cv::Range& range, const cv::ParallelLoopBody& body,
|
||||
|
||||
#elif defined HAVE_PTHREADS_PF
|
||||
|
||||
parallel_for_pthreads(range, body, nstripes);
|
||||
parallel_for_pthreads(pbody.stripeRange(), pbody, pbody.stripeRange().size());
|
||||
|
||||
#else
|
||||
|
||||
|
||||
Reference in New Issue
Block a user