@@ 1,10 1,30 @@
-require "../src/alys"
-
+require "option_parser"
require "uuid"
+require "../src/alys"
+
class X
+ def initialize(@quiet : Bool)
+ end
+
def finalize
- puts 123
+ puts 123 if !@quiet
+ end
+end
+
+sleep_ms = 1000
+iterations = 0
+quiet = false
+
+OptionParser.parse do |parser|
+ parser.on "--sleep=MS", "Sleep duration" do |value|
+ sleep_ms = value.to_i
+ end
+ parser.on "--iterations=ITERATIONS", "Iteration count" do |value|
+ iterations = value.to_i
+ end
+ parser.on "--quiet", "Be quiet" do
+ quiet = true
end
end
@@ 13,13 33,13 @@ Alys.setup_from_env
objs = [] of UUID
-loop do
- X.new
+(0..(iterations > 0 ? iterations : nil)).each do |_|
+ X.new quiet
ptr = GC.malloc 10
ptr = GC.realloc ptr, 20
GC.free ptr
Regex.new "abc"
objs << UUID.random
GC.collect
- sleep 1.seconds
+ sleep sleep_ms.milliseconds unless sleep_ms <= 0
end