Skip to content

Commit

Permalink
Log event statistics means in debug mode
Browse files Browse the repository at this point in the history
  • Loading branch information
moreginger committed Apr 2, 2023
1 parent 4e557ee commit f526101
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion replaycam.lua
Original file line number Diff line number Diff line change
Expand Up @@ -598,6 +598,7 @@ function EventStatistics:new(o, types)
setmetatable(o, self)
self.__index = self

o._types = types
for _, type in pairs(types) do
o[type] = { 0, 0 }
end
Expand Down Expand Up @@ -630,6 +631,14 @@ function EventStatistics:getPercentile(type, importance)
return 1 - exp(-m * importance)
end

function EventStatistics:summary()
local summary = {}
for _, type in pairs(self._types) do
summary[#summary+1] = type .. ': ' .. (self:getMean(type) or 'nil')
end
return table.concat(summary, ', ')
end

-- WORLD INFO

local mapSizeX, mapSizeZ = Game.mapSizeX, Game.mapSizeZ
Expand Down Expand Up @@ -919,7 +928,8 @@ local function selectMostInterestingEvent(currentFrame)
event = event.next
end
if logging >= LOG_DEBUG and mie then
spEcho('mie', mie.type, mie.sbj, mostPercentile, mie.started)
spEcho('eventStats', eventStatistics:summary())
spEcho('mie', mie.type, mie.sbjName, mostPercentile, mie.started)
end
return mie
end
Expand Down

0 comments on commit f526101

Please sign in to comment.