Skip to content

Commit

Permalink
Even more polish, better display of output, fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
VarLad committed Mar 18, 2024
1 parent ac06f34 commit 07447d1
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 15 deletions.
1 change: 0 additions & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ CoverageTools = "c36e975a-824b-4404-a568-ef97ca766997"
CpuId = "adafc99b-e345-5852-983c-f28acb93d879"
Distributed = "8ba89e20-285c-5b6f-9357-94700520ee1b"
Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
PrettyTables = "08abe8d2-0d0c-5749-adfa-8a2ac140af0d"
Profile = "9abbd945-dff8-562f-b5e8-e1ebf5ef1b79"
TOML = "fa267f1f-6049-4f14-aa54-33bafae1ed76"
TypedTables = "9d95f2ec-7b3d-5a63-8d20-e2491e220bb9"
Expand Down
3 changes: 0 additions & 3 deletions perf/GLM/allocs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,3 @@ result = @check :alloc Dict(:targets => ["GLM"], :path => @__DIR__) begin
end

@info result
pretty_table(result.tables[1])

#pretty_table(x.tables[1])
6 changes: 2 additions & 4 deletions perf/GLM/bench.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using PerfChecker, BenchmarkTools, PrettyTables
using PerfChecker, BenchmarkTools

t = @check :benchmark Dict(:path => @__DIR__, :evals => 1, :samples => 100, :seconds => 100) begin
using GLM, Random, StatsModels
Expand All @@ -22,6 +22,4 @@ t = @check :benchmark Dict(:path => @__DIR__, :evals => 1, :samples => 100, :sec
return nothing
end

Base.show(stdout, "text/plain", t)
println()
pretty_table(t |> to_table)
@info t
4 changes: 2 additions & 2 deletions perf/PatternFolds/allocs.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using PerfChecker
using PrettyTables

x = @check :alloc Dict(:targets => ["PatternFolds"], :path => @__DIR__) begin
x = @check :alloc Dict(:targets => ["PatternFolds"], :path => @__DIR__, :tags => [:patterns, :intervals]) begin
using PatternFolds
end begin
itv = Interval{Open,Closed}(0.0, 1.0)
Expand All @@ -24,4 +24,4 @@ x = @check :alloc Dict(:targets => ["PatternFolds"], :path => @__DIR__) begin
rand(vf, 1000)
end

pretty_table(x |> to_table)
@info x
4 changes: 1 addition & 3 deletions perf/PatternFolds/bench.jl
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,4 @@ t = @check :benchmark Dict(:path => @__DIR__, :evals => 1, :samples => 100, :sec
return nothing
end

Base.show(stdout, "text/plain", t)
println()
pretty_table(t |> to_table)
@info t
22 changes: 22 additions & 0 deletions src/PerfChecker.jl
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,33 @@ struct CheckerResult
pkgs::Vector{PackageSpec}
end

function Base.show(io::IO, v::PerfChecker.CheckerResult)
println(io, "Tables:")
for i in v.tables
println(io, '\t', Base.display(i))
end

println(io, "Hardware Info:")
println(io, "CPU Information:")
println(io, '\t', v.hwinfo.cpus)
println(io, "Machine name: ", v.hwinfo.machine)
println(io, "Word Size: ", v.hwinfo.word)
println(io, "SIMD Bytes: ", v.hwinfo.simdbytes)
println(io, "Core count (physical, total and threads per core): ", v.hwinfo.corecount)

println(io, "Tags used: ", v.tags)

println(io, "Package versions tested (if provided): ")
println(io, Base.display(v.pkgs))
end

find_by_tags(tags::Vector{Symbol}, results::CheckerResult; exact_match = true) = findall(x -> exact_match ? (tags == x.tags) : (!isempty(x.tags tags)), results)

# SECTION - Exports
export @check
export to_table
export find_by_tags
export get_versions

# SECTION - Includes
include("versions.jl")
Expand Down
4 changes: 2 additions & 2 deletions test/pattern_folds.jl
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
rand(vf, 1000)
end

pretty_table(x |> to_table)
@info x

t = @check :benchmark Dict(:path => @__DIR__, :evals => 1, :samples => 100, :seconds => 100) begin
using PatternFolds
Expand Down Expand Up @@ -50,5 +50,5 @@
return nothing
end

pretty_table(t |> to_table)
@info t
end

0 comments on commit 07447d1

Please sign in to comment.