mirror of
https://github.com/luanti-org/luanti.git
synced 2025-10-13 08:35:20 +02:00
Reduced the CPU usage of the sent block selector algorithm
This commit is contained in:
19
src/game.cpp
19
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
|
||||
@@ -1089,6 +1093,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
|
||||
*/
|
||||
|
Reference in New Issue
Block a user