Skip to content

Commit

Permalink
add info about the number of async results returned since the last HU…
Browse files Browse the repository at this point in the history
…D update
  • Loading branch information
fluxionary committed Mar 26, 2024
1 parent 48b0181 commit 4b57135
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions hud.lua
Expand Up @@ -36,6 +36,7 @@ spawnit._hud = futil.define_hud("spawnit:hud", {
f("#mapblocks being processed = %i", stats.calculating_blocks),
f("#async_queue (size) = %i", stats.async_queue_size),
f("#callback_queue (size) = %i", stats.callback_queue_size),
f("#async results since last HUD update = %i", stats.async_results),
f("active mapblock analysis usage = %.1fus/s", stats.ao_calc_usage),
f("async queue usage = %.1fus/s", stats.async_queue_usage),
f("async callback usage = %.1fus/s", stats.async_callback_usage),
Expand Down
1 change: 1 addition & 0 deletions manage_spawn_positions.lua
Expand Up @@ -74,6 +74,7 @@ end

local function make_callback(block_hpos)
return function(hpos_set_by_def)
spawnit._stats.async_results = spawnit._stats.async_results + 1
if spawnit._spawn_poss_by_block_hpos[block_hpos] ~= CALCULATING then
-- if this already got computed somehow, or removed, leave it alone.
return
Expand Down
2 changes: 1 addition & 1 deletion mod.conf
Expand Up @@ -5,7 +5,7 @@ website = https://content.minetest.net/packages/rheo/spawnit/
author = flux
license = LGPL-3.0-or-later
media_license = CC-BY-SA-4.0
version = 2024-02-22
version = 2024-03-26
min_minetest_version = 5.7.0
supported_games = *
depends = fmod, futil, action_queues, afk_api, canonical_name
Expand Down
3 changes: 3 additions & 0 deletions stats.lua
Expand Up @@ -12,6 +12,7 @@ spawnit._stats = {
async_callback_duration = 0,
spawn_mobs_duration = 0,
update_relevant_duration = 0,
async_results = 0,

num_spawned = 0,
total_spawned = 0,
Expand Down Expand Up @@ -49,6 +50,7 @@ function spawnit._get_and_reset_stats()

stats.async_queue_size = spawnit._find_spawn_poss_queue:size()
stats.callback_queue_size = spawnit._callback_queue:size()
stats.async_results = spawnit._stats.async_results

if s.track_memory_usage then
stats.all_mt_lua_memory_usage = collectgarbage("count")
Expand All @@ -65,6 +67,7 @@ function spawnit._get_and_reset_stats()
spawnit._stats.spawn_mobs_duration = 0
spawnit._stats.update_relevant_duration = 0
spawnit._stats.num_spawned = 0
spawnit._stats.async_results = 0
spawnit._stats.total_spawned = stats.total_spawned

if spawnit.has.mesecons_debug then
Expand Down

0 comments on commit 4b57135

Please sign in to comment.