MCPcopy Create free account
hub / github.com/GarageGames/Torque2D / dump

Method dump

engine/source/debug/profiler.cc:497–590  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

495
496
497void Profiler::dump()
498{
499 bool enableSave = mEnabled;
500 mEnabled = false;
501 mStackDepth++;
502 // may have some profiled calls... gotta turn em off.
503
504 Vector<ProfilerRootData *> rootVector;
505 F64 totalTime = 0;
506 for(ProfilerRootData *walk = ProfilerRootData::sRootList; walk; walk = walk->mNextRoot)
507 {
508 totalTime += walk->mTotalTime - walk->mSubTime;
509 rootVector.push_back(walk);
510 }
511//-Mat no sort, makes it easier to compare
512 dQsort((void *)rootVector.address(), rootVector.size(), sizeof(ProfilerRootData *), rootDataCompare);
513
514
515 if (mDumpToConsole == true)
516 {
517 Con::printf("Profiler Data Dump:");
518 Con::printf("Ordered by non-sub total time -");
519 Con::printf("%%NSTime %% Time Invoke # Name");
520 for(U32 i = 0; i < (U32)rootVector.size(); i++)
521 {
522 Con::printf("%7.3f %7.3f %8d %s",
523 100 * (rootVector[i]->mTotalTime - rootVector[i]->mSubTime) / totalTime,
524 100 * rootVector[i]->mTotalTime / totalTime,
525 rootVector[i]->mTotalInvokeCount,
526 rootVector[i]->mName);
527 rootVector[i]->mTotalInvokeCount = 0;
528 rootVector[i]->mTotalTime = 0;
529 rootVector[i]->mSubTime = 0;
530 }
531 Con::printf("");
532 Con::printf("Ordered by stack trace total time -");
533 Con::printf("%% Time %% NSTime Invoke # Name");
534
535 mCurrentProfilerData->mTotalTime = endHighResolutionTimer(mCurrentProfilerData->mStartTime);
536
537 char depthBuffer[MaxStackDepth * 2 + 1];
538 depthBuffer[0] = 0;
539 profilerDataDumpRecurse(mCurrentProfilerData, depthBuffer, 0, totalTime);
540 mEnabled = enableSave;
541 mStackDepth--;
542 }
543 else if (mDumpToFile == true && mDumpFileName[0] != '\0')
544 {
545 FileStream fws;
546 bool success = fws.open(mDumpFileName, FileStream::Write);
547 AssertFatal(success, "Nuts! Cannot write profile dump to specified file!");
548 char buffer[1024];
549
550 dStrcpy(buffer, "Profiler Data Dump:\n");
551 fws.write(dStrlen(buffer), buffer);
552 dStrcpy(buffer, "Ordered by non-sub total time -\n");
553 fws.write(dStrlen(buffer), buffer);
554 dStrcpy(buffer, "%%NSTime %% Time Invoke # Name\n");

Callers

nothing calls this directly

Calls 14

printfFunction · 0.85
endHighResolutionTimerFunction · 0.85
profilerDataDumpRecurseFunction · 0.85
dQsortFunction · 0.50
dStrcpyFunction · 0.50
dStrlenFunction · 0.50
dSprintfFunction · 0.50
push_backMethod · 0.45
addressMethod · 0.45
sizeMethod · 0.45
openMethod · 0.45

Tested by

no test coverage detected