Skip to content

Commit 739228f

Browse files
committed
line up data and protect against nan
1 parent ccfccfa commit 739228f

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

plugins/lua/overlay.lua

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ function print_timers()
2424
for _,timer in pairs(timers) do
2525
sum = sum + timer
2626
end
27+
if elapsed <= 0 then elapsed = 1 end
28+
if sum <= 0 then sum = 1 end
2729
local sorted = {}
2830
for name,timer in pairs(timers) do
2931
table.insert(sorted, {name=name, ms=timer})
@@ -35,10 +37,10 @@ function print_timers()
3537
))
3638
end
3739
print()
38-
print(('elapsed time: %d ms (%dm %ds)'):format(
40+
print(('elapsed time: %8d ms (%dm %ds)'):format(
3941
elapsed, elapsed // 60000, (elapsed % 60000) // 1000
4042
))
41-
print (('total widget processing time: %d ms (%.2f%% of elapsed time)'):format(
43+
print(('widget time: %8d ms (%.2f%% of elapsed time)'):format(
4244
sum, (sum * 100) / elapsed
4345
))
4446
end

0 commit comments

Comments
 (0)