Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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
Showing
5 changed files
with
490 additions
and
241 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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)) |
Oops, something went wrong.