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
992992 if (seconds > 0) { // avoid division by zero and time travel
993993 uint64_t fps = thisFrame / seconds;
994994 // 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) {
996997 qCDebug(scriptengine) <<
998+ "Script:" << name <<
997999 "Frame:" << thisFrame <<
9981000 "Slept (us):" << std::chrono::duration_cast<std::chrono::microseconds>(actuallySleptUntil - beforeSleep).count() <<
9991001 "Avg Updates (us):" << averageUpdate.count() <<
1002+ "averageTimerPerFrame (us):" << averageTimerPerFrame.count() <<
10001003 "FPS:" << fps;
10011004 }
10021005 }