Daniele Bartolini 10 лет назад
Родитель
Сommit
ebbedd25ed
2 измененных файлов с 8 добавлено и 3 удалено
  1. 1 1
      src/core/profiler.h
  2. 7 2
      src/device.cpp

+ 1 - 1
src/core/profiler.h

@@ -82,7 +82,7 @@ namespace profiler_globals
 
 #if CROWN_DEBUG
 	#define ENTER_PROFILE_SCOPE(name) profiler::enter_profile_scope(name)
-	#define LEAVE_PROFILE_SCOPE() profiler::leave_profile_scope(name)
+	#define LEAVE_PROFILE_SCOPE() profiler::leave_profile_scope()
 	#define RECORD_FLOAT(name, value) profiler::record_float(name, value)
 	#define RECORD_VECTOR3(name, value) profiler::record_vector3(name, value)
 	#define ALLOCATE_MEMORY(name, size) profiler::allocate_memory(name, size)

+ 7 - 2
src/device.cpp

@@ -27,9 +27,7 @@
 #include "profiler.h"
 #include "console_server.h"
 #include "input_device.h"
-
 #include "profiler.h"
-#include <stdio.h>
 
 #if CROWN_PLATFORM_ANDROID
 	#include "apk_filesystem.h"
@@ -216,6 +214,9 @@ void Device::update()
 		profiler_globals::clear();
 		console_server_globals::update();
 
+		RECORD_FLOAT("device.dt", _last_delta_time);
+		RECORD_FLOAT("device.fps", 1.0f/_last_delta_time);
+
 		if (!_is_paused)
 		{
 			_resource_manager->complete_requests();
@@ -225,6 +226,10 @@ void Device::update()
 
 		_input_manager->update();
 
+		const bgfx::Stats* stats = bgfx::getStats();
+		RECORD_FLOAT("bgfx.gpu_time", double(stats->gpuTimeEnd - stats->gpuTimeBegin)*1000.0/stats->gpuTimerFreq);
+		RECORD_FLOAT("bgfx.cpu_time", double(stats->cpuTimeEnd - stats->cpuTimeBegin)*1000.0/stats->cpuTimerFreq);
+
 		bgfx::frame();
 		profiler_globals::flush();