Skip to content

Commit

Permalink
benchmarks: Split out suites
Browse files Browse the repository at this point in the history
Split suites out into individual files
Provide usage info when run without BENCHMARK env var
Add option to save logs to output file
Add DTable CSV/Arrow reading suite
  • Loading branch information
jpsamaroo committed Jul 4, 2022
1 parent dbc4b50 commit d33746b
Show file tree
Hide file tree
Showing 5 changed files with 490 additions and 241 deletions.
43 changes: 43 additions & 0 deletions benchmarks/analysis.jl
@@ -0,0 +1,43 @@
path = ARGS[1]
start, finish = parse.(UInt64, ARGS[2:3])

using DataFrames, BenchmarkTools, Dagger, Serialization

logs = deserialize(path)["logs"]

"""
spans(logs::DataFrame) -> DataFrame
Combines start and finish event pairs, and computes their timespan.
"""
function spans(logs)
df = Any[]
evs = Dict{Symbol,Dict{Any,Any}}()
for log in eachrow(logs)
_evs = get!(evs, log.core.category) do
Dict{Any,Any}()
end
if log.core.kind == :finish
if haskey(_evs, log.id)
start = pop!(_evs, log.id)
ev = merge(log, (;span=(start.core.timestamp, log.core.timestamp)))
push!(df, ev)
else
@warn "Dropped :finish for $(log.core.category)"
end
elseif log.core.kind == :start
_evs[log.id] = log
end
end
DataFrame(df)
end

# Combine, select target range, and filter out `take`
tgt = subset(spans(logs), :core=>ByRow(x->start <= x.timestamp <= finish),
:core=>ByRow(x->x.category != :take))

# Sort by largest time contribution
tgt_sort = DataFrame(sort(eachrow(tgt), by=r->r.span[2] - r.span[1], rev=true))
transform!(tgt_sort, :span=>ByRow(s->(s[2]-s[1]) / (1000^3))=>:span_s)
println("Total: $((finish-start) / (1000^3))")
foreach(println, zip(map(c->c.category, tgt_sort.core), tgt_sort.span_s))

0 comments on commit d33746b

Please sign in to comment.