MCPcopy Create free account
hub / github.com/IppClub/Dora-SSR / update

Method update

Source/Basic/Director.cpp:732–950  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

730}
731
732void Director::ProfilerInfo::update(double deltaTime) {
733 if (skipOneFrame) {
734 skipOneFrame = false;
735 return;
736 }
737
738 frames++;
739 elapsedTime += deltaTime;
740
741 cpuTime += SharedApplication.getCPUTime();
742 gpuTime += SharedApplication.getGPUTime();
743
744 maxCppObjects = std::max(maxCppObjects, Object::getCount());
745 maxLuaObjects = std::max(maxLuaObjects, Object::getLuaRefCount());
746 maxCallbacks = std::max(maxCallbacks, Object::getLuaCallbackCount());
747
748 memPoolSize = std::max(MemoryPool::getTotalCapacity(), memPoolSize);
749 memLua = std::max(SharedLuaEngine.getRuntimeMemory(), memLua);
750 memTeal = std::max(SharedLuaEngine.getTealMemory(), memTeal);
751 if (Singleton<WasmRuntime>::isInitialized()) {
752 memWASM = std::max(s_cast<int>(SharedWasmRuntime.getMemorySize()), memWASM);
753 }
754
755 maxCPU = std::max(maxCPU, SharedApplication.getCPUTime());
756 maxGPU = std::max(maxGPU, SharedApplication.getGPUTime());
757 maxDelta = std::max(maxDelta, deltaTime);
758 targetTime = 1000.0 / std::max(SharedApplication.getTargetFPS(), 1u);
759 logicTime += SharedApplication.getLogicTime();
760 renderTime += SharedApplication.getRenderTime();
761
762 if (elapsedTime >= 1.0) {
763 lastAvgCPUTime = 1000.0 * cpuTime / frames;
764 lastAvgGPUTime = 1000.0 * gpuTime / frames;
765 lastAvgDeltaTime = 1000.0 * elapsedTime / frames;
766 cpuTime = gpuTime = 0.0;
767
768 lastMaxCppObjects = maxCppObjects;
769 lastMaxLuaObjects = maxLuaObjects;
770 lastMaxCallbacks = maxCallbacks;
771 maxCppObjects = maxLuaObjects = maxCallbacks = 0;
772
773 lastMemPoolSize = memPoolSize;
774 lastMemLua = memLua;
775 lastMemTeal = memTeal;
776 lastMemWASM = memWASM;
777 memPoolSize = memLua = memTeal = memWASM = 0;
778
779 cpuValues.push_back(maxCPU * 1000.0);
780 gpuValues.push_back(maxGPU * 1000.0);
781 dtValues.push_back(maxDelta * 1000.0);
782 maxCPU = maxGPU = maxDelta = 0;
783
784 if (cpuValues.size() > PlotCount + 1) cpuValues.erase(cpuValues.begin());
785 if (gpuValues.size() > PlotCount + 1) gpuValues.erase(gpuValues.begin());
786 if (dtValues.size() > PlotCount + 1) {
787 dtValues.erase(dtValues.begin());
788 } else {
789 seconds.push_back(dtValues.size() - 1);

Callers 1

doLogicMethod · 0.45

Calls 15

getStatsFunction · 0.85
getCPUTimeMethod · 0.80
getGPUTimeMethod · 0.80
getRuntimeMemoryMethod · 0.80
getTealMemoryMethod · 0.80
getMemorySizeMethod · 0.80
getTargetFPSMethod · 0.80
getLogicTimeMethod · 0.80
getRenderTimeMethod · 0.80
SetMaxDecimalPlacesMethod · 0.80
getVisualSizeMethod · 0.80
isVSyncMethod · 0.80

Tested by

no test coverage detected