940fcc9ff2
This includes several changes: - Rename memory-static to generate-gems-size-metrics-static - Rename memory-static-objects to generate-gems-memory-metrics-static - Change generate-gems-size-metrics-static interface. The script now expect `bundle exec derailed bundle:mem` output as its input. The script output to stdout, or stderr for error message. - Change generate-gems-memory-metrics-static interface. The script now expect `bundle exec derailed bundle:objects` output as its input. The script output to stdout, or stderr for error message. - Generate gem size metrics. Script generate-gems-size-metrics-static extract each gem size from `bundle exec derailed bundle:mem` output. Save output to metrics file in format: 'gem_size_mb{name="zip"} 0.5'
18 lines
917 B
Ruby
Executable file
18 lines
917 B
Ruby
Executable file
#!/usr/bin/env ruby
|
|
|
|
abort "usage: #{__FILE__} <memory_bundle_objects_file_name>" unless ARGV.length == 1
|
|
memory_bundle_objects_file_name = ARGV.first
|
|
|
|
full_report = File.readlines(memory_bundle_objects_file_name)
|
|
|
|
allocated_str = full_report[1]
|
|
retained_str = full_report[2]
|
|
allocated_stats = /Total allocated: (?<bytes>.*) bytes \((?<objects>.*) objects\)/.match(allocated_str)
|
|
retained_stats = /Total retained: (?<bytes>.*) bytes \((?<objects>.*) objects\)/.match(retained_str)
|
|
|
|
abort 'failed to process the benchmark output' unless allocated_stats && retained_stats
|
|
|
|
puts "memory_static_objects_allocated_mb #{(allocated_stats[:bytes].to_f / (1024 * 1024)).round(1)}"
|
|
puts "memory_static_objects_retained_mb #{(retained_stats[:bytes].to_f / (1024 * 1024)).round(1)}"
|
|
puts "memory_static_objects_allocated_items #{allocated_stats[:objects]}"
|
|
puts "memory_static_objects_retained_items #{retained_stats[:objects]}"
|