Skip to content

Commit 3eecbe7

Browse files
committed
Store raw data in JSON output file
This will be useful so we can store info such as the rss and stats.
1 parent 33e376a commit 3eecbe7

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

run_benchmarks.rb

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,7 @@ def sort_benchmarks(bench_names)
208208
def run_benchmarks(ruby:, ruby_description:, categories:, name_filters:, out_path:, harness:, pre_init:, rss:, no_pinning:)
209209
bench_times = {}
210210
bench_rss = {}
211+
bench_data = {}
211212

212213
# Get the list of benchmark files/directories matching name filters
213214
bench_files = Dir.children('benchmarks').sort.filter do |entry|
@@ -281,11 +282,14 @@ def run_benchmarks(ruby:, ruby_description:, categories:, name_filters:, out_pat
281282
# Convert RSS to MiB
282283
bench_rss[bench_name] = out_data["rss"] / 1024.0 / 1024.0
283284
end
285+
284286
# Convert times to ms
285287
bench_times[bench_name] = out_data["values"].map { |v| 1000 * Float(v) }
288+
289+
bench_data[bench_name] = out_data
286290
end
287291

288-
return bench_times, bench_rss
292+
return bench_times, bench_rss, bench_data
289293
end
290294

291295
# Default values for command-line arguments
@@ -402,8 +406,9 @@ def run_benchmarks(ruby:, ruby_description:, categories:, name_filters:, out_pat
402406
bench_start_time = Time.now.to_f
403407
bench_times = {}
404408
bench_rss = {}
409+
bench_data = {}
405410
args.executables.each do |name, executable|
406-
bench_times[name], bench_rss[name] = run_benchmarks(
411+
bench_times[name], bench_rss[name], bench_data[name] = run_benchmarks(
407412
ruby: executable,
408413
ruby_description: ruby_descriptions[name],
409414
categories: args.categories,
@@ -481,6 +486,7 @@ def run_benchmarks(ruby:, ruby_description:, categories:, name_filters:, out_pat
481486
metadata: ruby_descriptions,
482487
}
483488
out_data[:rss] = bench_rss if args.rss
489+
out_data[:raw_data] = bench_data
484490
out_data.merge!(bench_times)
485491
json_str = JSON.generate(out_data)
486492
file.write json_str

0 commit comments

Comments
 (0)