MCPcopy Create free account
hub / github.com/TorqueGameEngines/Torque3D / hashPop

Method hashPop

Engine/source/platform/profiler.cpp:387–456  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

385}
386
387void Profiler::hashPop(ProfilerRootData *expected)
388{
389#ifdef TORQUE_MULTITHREAD
390 // Ignore non-main-thread profiler activity.
391 if( !ThreadManager::isMainThread() )
392 return;
393#endif
394
395 mStackDepth--;
396 PROFILER_DEBUG_POP_NODE();
397 AssertFatal(mStackDepth >= 0, "Stack underflow in profiler. You may have mismatched PROFILE_START and PROFILE_ENDs");
398 if(mEnabled)
399 {
400 if(mCurrentProfilerData->mSubDepth)
401 {
402 mCurrentProfilerData->mSubDepth--;
403 return;
404 }
405
406 if(expected)
407 {
408 AssertISV(expected == mCurrentProfilerData->mRoot, "Profiler::hashPop - didn't get expected ProfilerRoot!");
409 }
410
411 F64 fElapsed = endHighResolutionTimer(mCurrentProfilerData->mStartTime);
412
413 mCurrentProfilerData->mTotalTime += fElapsed;
414 mCurrentProfilerData->mParent->mSubTime += fElapsed; // mark it in the parent as well...
415 mCurrentProfilerData->mRoot->mTotalTime += fElapsed;
416 if(mCurrentProfilerData->mParent->mRoot)
417 mCurrentProfilerData->mParent->mRoot->mSubTime += fElapsed; // mark it in the parent as well...
418
419 mCurrentProfilerData = mCurrentProfilerData->mParent;
420 }
421 if(mStackDepth == 0)
422 {
423 // apply the next enable...
424 if(mDumpToConsole || mDumpToFile)
425 {
426 dump();
427 startHighResolutionTimer(mCurrentProfilerData->mStartTime);
428 }
429 if(!mEnabled && mNextEnable)
430 startHighResolutionTimer(mCurrentProfilerData->mStartTime);
431
432#if defined(TORQUE_OS_WIN)
433 // The high performance counters under win32 are unreliable when running on multiple
434 // processors. When the profiler is enabled, we restrict Torque to a single processor.
435 if(mNextEnable != mEnabled)
436 {
437
438 if(mNextEnable)
439 {
440 Con::warnf("Warning: forcing the Torque profiler thread to run only on cpu 1.");
441 SetThreadAffinityMask(GetCurrentThread(), 1);
442 }
443 else
444 {

Callers 1

~ScopedProfilerMethod · 0.80

Calls 5

isMainThreadFunction · 0.85
endHighResolutionTimerFunction · 0.85
startHighResolutionTimerFunction · 0.85
dumpFunction · 0.50
warnfFunction · 0.50

Tested by

no test coverage detected