@@ -30,41 +30,41 @@ extension [TestType](test: Test[TestType])
30
30
baseline : Optional [Baseline ] = Unset )
31
31
(using runner : Runner [ReportType ],
32
32
inc : Inclusion [ReportType , Benchmark ],
33
- specificDuration : SpecificDuration [ DurationType ] = timeInterfaces.long ,
34
- genericDuration : GenericDuration [ DurationType ] = timeInterfaces.long )
33
+ specificDuration : DurationType is SpecificDuration = durationApi.javaLong ,
34
+ genericDuration : DurationType is GenericDuration = durationApi.javaLong )
35
35
: Unit =
36
36
37
37
val action = test.action
38
38
var end = System .currentTimeMillis + warmup.or(SpecificDuration (10000L )).milliseconds
39
39
val times : scm.ArrayBuffer [Long ] = scm.ArrayBuffer ()
40
40
times.sizeHint(4096 )
41
41
val ctx = new TestContext ()
42
-
42
+
43
43
while System .currentTimeMillis < end do
44
44
val t0 = System .nanoTime
45
45
val result = action(ctx)
46
46
val t1 = System .nanoTime - t0
47
47
times += t1
48
-
48
+
49
49
times.clear()
50
-
50
+
51
51
end = System .currentTimeMillis + duration.or(SpecificDuration (10000L )).milliseconds
52
-
52
+
53
53
while System .currentTimeMillis < end do
54
54
val t0 = System .nanoTime
55
55
val result = action(ctx)
56
56
val t1 = System .nanoTime - t0
57
57
times += t1
58
-
58
+
59
59
val count = times.size
60
60
val total = times.sum
61
61
val min : Long = times.min
62
62
val mean : Double = total.toDouble/ count
63
63
val max : Long = times.max
64
64
val variance : Double = (times.map { t => (mean - t)* (mean - t) }.sum)/ count
65
65
val stdDev : Double = math.sqrt(variance)
66
-
66
+
67
67
val benchmark =
68
68
Benchmark (total, times.size, min.toDouble, mean, max.toDouble, stdDev, confidence.or(95 ), baseline)
69
-
69
+
70
70
inc.include(runner.report, test.id, benchmark)
0 commit comments