use DISCARD for fill_policy since default RING_BUFFER fails when wrap around (most result table empty); add README.md and merge-trace.jl

This commit is contained in:
Jianbing Chen
2021-08-25 11:39:00 -05:00
parent fc7cc1e68f
commit 7793a1f331
3 changed files with 104 additions and 1 deletions
+37
View File
@@ -0,0 +1,37 @@
using Base: String
using JSON, DataFrames, Dates, CSV
function check_input_args()
message = "Needs only one json file and at least one trace data file(s)."
@assert length(ARGS) >= 2 && occursin(".json", join(ARGS)) message
json_file, trace_files = nothing, String[]
for arg in ARGS
@assert Base.Filesystem.ispath(arg) "'$(arg)' not found!"
if endswith(arg, ".json")
json_file = arg
else
push!(trace_files, arg)
end
end
json_file, trace_files
end
json_file, trace_files = check_input_args()
out = JSON.parsefile(json_file)
for trace in trace_files
@info "processing $(trace) ..."
f = tempname() * ".json"
run(`trace_to_text json $trace $f`)
todo = JSON.parsefile(f)
out["traceEvents"] = vcat(
out["traceEvents"],
todo["traceEvents"])
end
output_file = replace("$(string(now())).json", ":" => "-")
open(output_file, "w") do f
write(f, JSON.json(out))
@info "output file: $(output_file)"
end