@@ -19,21 +19,23 @@ function withtempdir(f::Function)
1919end
2020
2121@testset " Successful (de)serialization" begin
22- b = @benchmarkable sin (1 )
23- tune! (b)
24- bb = run (b)
25-
26- withtempdir () do
27- tmp = joinpath (pwd (), " tmp.json" )
28-
29- BenchmarkTools. save (tmp, b. params, bb)
30- @test isfile (tmp)
31-
32- results = BenchmarkTools. load (tmp)
33- @test results isa Vector{Any}
34- @test length (results) == 2
35- @test eq (results[1 ], b. params)
36- @test eq (results[2 ], bb)
22+ for enable_linux_perf in (false , true )
23+ b = @benchmarkable sin (1 ) enable_linux_perf = enable_linux_perf
24+ tune! (b)
25+ bb = run (b)
26+
27+ withtempdir () do
28+ tmp = joinpath (pwd (), " tmp.json" )
29+
30+ BenchmarkTools. save (tmp, b. params, bb)
31+ @test isfile (tmp)
32+
33+ results = BenchmarkTools. load (tmp)
34+ @test results isa Vector{Any}
35+ @test length (results) == 2
36+ @test eq (results[1 ], b. params)
37+ @test eq (results[2 ], bb)
38+ end
3739 end
3840
3941 # Nested BenchmarkGroups
99101 @test_throws ArgumentError BenchmarkTools. recover ([1 ])
100102end
101103
102- @testset " Backwards Comppatibility with evals_set" begin
104+ @testset " Backwards Compatibility with evals_set and linux perf options " begin
103105 json_string = " [{\" Julia\" :\" 1.11.0-DEV.1116\" ,\" BenchmarkTools\" :\" 1.4.0\" },[[\" Parameters\" ,{\" gctrial\" :true,\" time_tolerance\" :0.05,\" samples\" :10000,\" evals\" :1,\" gcsample\" :false,\" seconds\" :5.0,\" overhead\" :0.0,\" memory_tolerance\" :0.01}]]]"
104106 json_io = IOBuffer (json_string)
105107
106- @test BenchmarkTools. load (json_io) ==
107- [BenchmarkTools. Parameters (5.0 , 10000 , 1 , false , 0.0 , true , false , 0.05 , 0.01 )]
108+ @test BenchmarkTools. load (json_io) == [
109+ BenchmarkTools. Parameters (
110+ 5.0 ,
111+ 10000 ,
112+ 1 ,
113+ false ,
114+ 0.0 ,
115+ true ,
116+ false ,
117+ 0.05 ,
118+ 0.01 ,
119+ false ,
120+ BenchmarkTools. DEFAULT_PARAMETERS. linux_perf_groups,
121+ BenchmarkTools. DEFAULT_PARAMETERS. linux_perf_spaces,
122+ BenchmarkTools. DEFAULT_PARAMETERS. linux_perf_threads,
123+ BenchmarkTools. DEFAULT_PARAMETERS. linux_perf_gcscrub,
124+ ),
125+ ]
108126
109127 json_string = " [{\" Julia\" :\" 1.11.0-DEV.1116\" ,\" BenchmarkTools\" :\" 1.4.0\" },[[\" Parameters\" ,{\" gctrial\" :true,\" time_tolerance\" :0.05,\" evals_set\" :true,\" samples\" :10000,\" evals\" :1,\" gcsample\" :false,\" seconds\" :5.0,\" overhead\" :0.0,\" memory_tolerance\" :0.01}]]]"
110128 json_io = IOBuffer (json_string)
111129
112- @test BenchmarkTools. load (json_io) ==
113- [BenchmarkTools. Parameters (5.0 , 10000 , 1 , true , 0.0 , true , false , 0.05 , 0.01 )]
130+ @test BenchmarkTools. load (json_io) == [
131+ BenchmarkTools. Parameters (
132+ 5.0 ,
133+ 10000 ,
134+ 1 ,
135+ true ,
136+ 0.0 ,
137+ true ,
138+ false ,
139+ 0.05 ,
140+ 0.01 ,
141+ false ,
142+ BenchmarkTools. DEFAULT_PARAMETERS. linux_perf_groups,
143+ BenchmarkTools. DEFAULT_PARAMETERS. linux_perf_spaces,
144+ BenchmarkTools. DEFAULT_PARAMETERS. linux_perf_threads,
145+ BenchmarkTools. DEFAULT_PARAMETERS. linux_perf_gcscrub,
146+ ),
147+ ]
114148end
115149
116150@testset " Inf in Paramters struct" begin
117- params = BenchmarkTools. Parameters (Inf , 10000 , 1 , false , Inf , true , false , Inf , Inf )
151+ params = BenchmarkTools. Parameters (
152+ Inf ,
153+ 10000 ,
154+ 1 ,
155+ false ,
156+ Inf ,
157+ true ,
158+ false ,
159+ Inf ,
160+ Inf ,
161+ false ,
162+ BenchmarkTools. DEFAULT_PARAMETERS. linux_perf_groups,
163+ BenchmarkTools. DEFAULT_PARAMETERS. linux_perf_spaces,
164+ BenchmarkTools. DEFAULT_PARAMETERS. linux_perf_threads,
165+ BenchmarkTools. DEFAULT_PARAMETERS. linux_perf_gcscrub,
166+ )
118167
119168 io = IOBuffer ()
120169 BenchmarkTools. save (io, params)
0 commit comments