瀏覽代碼

Merge pull request #19217 from godotengine/revert-18998-customizable-performance-reporting-rate

Revert "Make the performance reporting update frequency customizable"
Juan Linietsky 7 年之前
父節點
當前提交
ddc24347ba
共有 6 個文件被更改,包括 8 次插入21 次删除
  1. 0 1
      core/project_settings.cpp
  2. 2 2
      core/script_debugger_remote.cpp
  3. 0 2
      core/script_language.cpp
  4. 0 2
      core/script_language.h
  5. 5 13
      main/main.cpp
  6. 1 1
      main/main.h

+ 0 - 1
core/project_settings.cpp

@@ -1071,7 +1071,6 @@ ProjectSettings::ProjectSettings() {
 	GLOBAL_DEF("rendering/quality/intended_usage/framebuffer_mode", 2);
 
 	GLOBAL_DEF("debug/settings/profiler/max_functions", 16384);
-	GLOBAL_DEF("debug/settings/performance/update_frequency_msec", 250);
 
 	//assigning here, because using GLOBAL_GET on every block for compressing can be slow
 	Compression::zstd_long_distance_matching = GLOBAL_DEF("compression/formats/zstd/long_distance_matching", false);

+ 2 - 2
core/script_debugger_remote.cpp

@@ -880,7 +880,7 @@ void ScriptDebuggerRemote::idle_poll() {
 	if (performance) {
 
 		uint64_t pt = OS::get_singleton()->get_ticks_msec();
-		if (pt - last_perf_time > update_frequency) {
+		if (pt - last_perf_time > 1000) {
 
 			last_perf_time = pt;
 			int max = performance->get("MONITOR_MAX");
@@ -1107,7 +1107,7 @@ ScriptDebuggerRemote::ScriptDebuggerRemote() :
 	eh.userdata = this;
 	add_error_handler(&eh);
 
-	profile_info.resize(CLAMP(int(GLOBAL_GET("debug/settings/profiler/max_functions")), 128, 65535));
+	profile_info.resize(CLAMP(int(ProjectSettings::get_singleton()->get("debug/settings/profiler/max_functions")), 128, 65535));
 	profile_info_ptrs.resize(profile_info.size());
 }
 

+ 0 - 2
core/script_language.cpp

@@ -29,7 +29,6 @@
 /*************************************************************************/
 
 #include "script_language.h"
-#include "project_settings.h"
 
 ScriptLanguage *ScriptServer::_languages[MAX_LANGUAGES];
 int ScriptServer::_language_count = 0;
@@ -284,7 +283,6 @@ ScriptDebugger::ScriptDebugger() {
 	lines_left = -1;
 	depth = -1;
 	break_lang = NULL;
-	update_frequency = GLOBAL_GET("debug/settings/performance/update_frequency_msec");
 }
 
 bool PlaceHolderScriptInstance::set(const StringName &p_name, const Variant &p_value) {

+ 0 - 2
core/script_language.h

@@ -352,8 +352,6 @@ class ScriptDebugger {
 public:
 	typedef void (*RequestSceneTreeMessageFunc)(void *);
 
-	int update_frequency;
-
 	struct LiveEditFuncs {
 
 		void *udata;

+ 5 - 13
main/main.cpp

@@ -1706,7 +1706,7 @@ bool Main::start() {
 
 uint64_t Main::last_ticks = 0;
 uint64_t Main::target_ticks = 0;
-Array Main::frame_times = Array();
+uint32_t Main::frames = 0;
 uint32_t Main::frame = 0;
 bool Main::force_redraw_requested = false;
 
@@ -1825,19 +1825,10 @@ bool Main::iteration() {
 		script_debugger->idle_poll();
 	}
 
+	frames++;
 	Engine::get_singleton()->_idle_frames++;
 
-	// FPS counter
-	frame_times.push_back(ticks);
-	int frames = frame_times.size();
-
-	while (frame_times.size() > 0 && (int)frame_times.get(0) <= ticks - 1000000) {
-		frame_times.pop_front();
-	}
-
-	int update_frequency = MAX(1, (int)GLOBAL_GET("debug/settings/performance/update_frequency_msec"));
-
-	if (frame > update_frequency * 1000) {
+	if (frame > 1000000) {
 
 		if (editor || project_manager) {
 			if (print_fps) {
@@ -1853,7 +1844,8 @@ bool Main::iteration() {
 		idle_process_max = 0;
 		physics_process_max = 0;
 
-		frame %= update_frequency * 1000;
+		frame %= 1000000;
+		frames = 0;
 	}
 
 	if (fixed_fps != -1)

+ 1 - 1
main/main.h

@@ -44,7 +44,7 @@ class Main {
 	static void print_help(const char *p_binary);
 	static uint64_t last_ticks;
 	static uint64_t target_ticks;
-	static Array frame_times;
+	static uint32_t frames;
 	static uint32_t frame;
 	static bool force_redraw_requested;