Skip to content

Commit

Permalink
sampling
Browse files Browse the repository at this point in the history
  • Loading branch information
NatureFreshMilk committed Oct 24, 2019
1 parent b8797c1 commit 33bdc2f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions monitoring/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ dofile(MP.."/metrictypes/counter.lua")
dofile(MP.."/metrictypes/histogram.lua")

dofile(MP.."/register.lua")
dofile(MP.."/sampling.lua")

dofile(MP.."/export/prometheus_push.lua")
dofile(MP.."/export/csv.lua")
Expand Down
13 changes: 13 additions & 0 deletions monitoring/sampling.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@

local iterations = 100000
local count = iterations
local start = minetest.get_us_time()

while count > 0 do
minetest.get_us_time()
count = count - 1
end

local diff = minetest.get_us_time() - start

print("[monitoring] sampling: " .. iterations .. " calls took " .. diff .. " us")

0 comments on commit 33bdc2f

Please sign in to comment.