Skip to content

Commit

Permalink
apps.rate_limiter: fix selftest
Browse files Browse the repository at this point in the history
  • Loading branch information
eugeneia committed Apr 15, 2022
1 parent c676980 commit 26bcea8
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions src/apps/rate_limiter/rate_limiter.lua
Original file line number Diff line number Diff line change
Expand Up @@ -148,11 +148,7 @@ function selftest ()
local snapshot = rl:get_stat_snapshot()

-- push some packets through it
while seconds_to_run > 0 do
app.breathe()
timer.run()
C.usleep(10) -- avoid busy loop
end
app.main{duration=seconds_to_run}
-- print final report
app.report()

Expand Down Expand Up @@ -194,10 +190,7 @@ function selftest ()
rl:reset(rate_busy_loop, bucket_size)

local snapshot = rl:get_stat_snapshot()
for i = 1, 100000 do
app.breathe()
timer.run()
end
app.main{duration=0.1}
local elapsed_time =
(tonumber(C.get_time_ns()) - snapshot.time) / 1e9
print("elapsed time ", elapsed_time, "seconds")
Expand Down

0 comments on commit 26bcea8

Please sign in to comment.