summaryrefslogtreecommitdiff
path: root/src/game.cpp
diff options
context:
space:
mode:
authorPerttu Ahola <celeron55@gmail.com>2011-05-31 00:15:43 +0300
committerPerttu Ahola <celeron55@gmail.com>2011-05-31 00:15:43 +0300
commit223b3793485a76f87599d39364b1003c2ca7c49c (patch)
tree67b2dcc8603a01a32e33d3f0004e7cf4797df2c0 /src/game.cpp
parent16fdb42590dc14772fcf0cc95c6baf08e6f583cd (diff)
downloadminetest-223b3793485a76f87599d39364b1003c2ca7c49c.tar.gz
minetest-223b3793485a76f87599d39364b1003c2ca7c49c.tar.bz2
minetest-223b3793485a76f87599d39364b1003c2ca7c49c.zip
Reduced the CPU usage of the sent block selector algorithm
Diffstat (limited to 'src/game.cpp')
-rw-r--r--src/game.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/game.cpp b/src/game.cpp
index 6932b45f1..e8e6cb71f 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -903,6 +903,10 @@ void the_game(
bool first_loop_after_window_activation = true;
+ // TODO: Convert the static interval timers to these
+ // Interval limiter for profiler
+ IntervalLimiter m_profiler_interval;
+
// Time is in milliseconds
// NOTE: getRealTime() causes strange problems in wine (imprecision?)
// NOTE: So we have to use getTime() and call run()s between them
@@ -1090,6 +1094,21 @@ void the_game(
}
/*
+ Profiler
+ */
+ float profiler_print_interval =
+ g_settings.getFloat("profiler_print_interval");
+ if(profiler_print_interval != 0)
+ {
+ if(m_profiler_interval.step(0.030, profiler_print_interval))
+ {
+ dstream<<"Profiler:"<<std::endl;
+ g_profiler.print(dstream);
+ g_profiler.clear();
+ }
+ }
+
+ /*
Direct handling of user input
*/