History

Add JS profiling API

Karol Suprynowicz committed 3 years ago

Commit a84c68f1 parent 47ec27f6 files · +144 −2Browse files

Showing the changes to libraries/script-engine/src/ScriptManager.cpp (1 of 6 files). Show all

Unified · Split

libraries/script-engine/src/ScriptManager.cpp+4−1
@@ -992,11 +992,14 @@ void ScriptManager::run() { · 991 unmodified lines
992 if (seconds > 0) { // avoid division by zero and time travel992 if (seconds > 0) { // avoid division by zero and time travel
993 uint64_t fps = thisFrame / seconds;993 uint64_t fps = thisFrame / seconds;
994 // Overreporting artificially reduces the reported rate994 // Overreporting artificially reduces the reported rate
995 if (thisFrame % SCRIPT_FPS == 0) {995 const int REPORT_BELOW_FPS = 30;
996 if (thisFrame % SCRIPT_FPS == 0 && fps < REPORT_BELOW_FPS) {
996 qCDebug(scriptengine) <<997 qCDebug(scriptengine) <<
998 "Script:" << name <<
997 "Frame:" << thisFrame <<999 "Frame:" << thisFrame <<
998 "Slept (us):" << std::chrono::duration_cast<std::chrono::microseconds>(actuallySleptUntil - beforeSleep).count() <<1000 "Slept (us):" << std::chrono::duration_cast<std::chrono::microseconds>(actuallySleptUntil - beforeSleep).count() <<
999 "Avg Updates (us):" << averageUpdate.count() <<1001 "Avg Updates (us):" << averageUpdate.count() <<
1002 "averageTimerPerFrame (us):" << averageTimerPerFrame.count() <<
1000 "FPS:" << fps;1003 "FPS:" << fps;
1001 }1004 }
1002 }1005 }