Skip to content

Commit

Permalink
line up data and protect against nan
Browse files Browse the repository at this point in the history
  • Loading branch information
myk002 committed Feb 14, 2024
1 parent ccfccfa commit 739228f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions plugins/lua/overlay.lua
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ function print_timers()
for _,timer in pairs(timers) do
sum = sum + timer
end
if elapsed <= 0 then elapsed = 1 end
if sum <= 0 then sum = 1 end
local sorted = {}
for name,timer in pairs(timers) do
table.insert(sorted, {name=name, ms=timer})
Expand All @@ -35,10 +37,10 @@ function print_timers()
))
end
print()
print(('elapsed time: %d ms (%dm %ds)'):format(
print(('elapsed time: %8d ms (%dm %ds)'):format(
elapsed, elapsed // 60000, (elapsed % 60000) // 1000
))
print (('total widget processing time: %d ms (%.2f%% of elapsed time)'):format(
print(('widget time: %8d ms (%.2f%% of elapsed time)'):format(
sum, (sum * 100) / elapsed
))
end
Expand Down

0 comments on commit 739228f

Please sign in to comment.