Skip to content

Commit 386427b

Browse files
committed
Functional Chainmarks extension
1 parent da8b5af commit 386427b

File tree

5 files changed

+44
-28
lines changed

5 files changed

+44
-28
lines changed

Project.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,15 @@ TypedTables = "9d95f2ec-7b3d-5a63-8d20-e2491e220bb9"
1414

1515
[weakdeps]
1616
BenchmarkTools = "6e4b80f9-dd63-53aa-95a3-0cdb28fa8baf"
17+
Chairmarks = "0ca39b1e-fe0b-4e98-acfc-b1656634c4de"
1718

1819
[extensions]
1920
BenchmarkToolsExt = "BenchmarkTools"
21+
ChairmarksExt = "Chairmarks"
2022

2123
[compat]
2224
BenchmarkTools = "1.5.0"
25+
Chairmarks = "1.2"
2326
CoverageTools = "1"
2427
CpuId = "0.3.1"
2528
TypedTables = "1"

ext/ChainmarksExt/b.jl

Lines changed: 0 additions & 25 deletions
This file was deleted.
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
module ChainmarksExt
1+
module ChairmarksExt
22

33
using Chainmarks
44
using PerfChecker
55
import TypedTables: Table
66

77
include("b.jl")
8-
include("be.jl")
9-
include("chairmark.jl")
8+
#include("be.jl")
9+
#include("chairmark.jl")
1010
end
1111

ext/ChairmarksExt/b.jl

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
function PerfChecker.default_options(::Val{:chairmark})
2+
return Dict(
3+
:threads => 1,
4+
:track => "none",
5+
:init => nothing,
6+
:setup => nothing,
7+
:f => nothing,
8+
:teardown => nothing,
9+
:kwargs => ()
10+
)
11+
end
12+
13+
function PerfChecker.check(d::Dict, block::Expr, ::Val{:chairmark})
14+
if d[:f] == nothing
15+
d[:f] = @eval () -> $block
16+
end
17+
quote
18+
d = $d
19+
using Chairmarks
20+
return Chairmarks.benchmark(d[:init], d[:setup], d[:f], d[:teardown]; d[:kwargs]...)
21+
end
22+
end
23+
24+
PerfChecker.prep(::Dict, block::Expr, ::Val{:chairmark}) = quote
25+
$block
26+
nothing
27+
end
28+
29+
PerfChecker.post(d::Dict, ::Val{:chairmark}) = d[:check_result]
30+
#=
31+
function PerfChecker.to_table(bench::BenchmarkTools.Trial)
32+
ti = bench.times
33+
l = length(ti)
34+
return Table(times=ti, gctimes=bench.gctimes, memory=fill(bench.memory, l), allocs=fill(bench.allocs, l))
35+
end
36+
=#

src/PerfChecker.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ struct HwInfo
1919
corecount::Tuple{Int, Int, Int}
2020
end
2121

22+
println("Hell")
23+
2224
struct CheckerResult
2325
tables::Vector{Table}
2426
hwinfo::Union{HwInfo,Nothing}

0 commit comments

Comments
 (0)