Sha256: 0a5b03e2ee1fd6f280e9d403dbca6bcf4425b3546cba32dac3be6cd4a03083cc

Contents?: true

Size: 1.19 KB

Versions: 1

Compression:

Stored size: 1.19 KB

Contents

#!/usr/bin/env ruby

require 'json'

if ARGV.count<1 
  puts "Usage: #{$0} [-t] [-j] stats1.json"
  exit -1
end

# print header  
if ARGV[0]=='-t'
	heads=['Plugin name','execution_time (s)']
	puts heads.join("\t")   
	ARGV.shift
end

puts_json=false
if ARGV[0]=='-j'
	puts_json=true
	ARGV.shift
end


ARGV.each do |file_path|
	sample_name = File.basename(File.expand_path(File.join(file_path,'..','..')))

	stats=JSON::parse(File.read(file_path))

	res={}
	
	total=0
		

	begin
		stats.keys.each do |k|
			if stats[k]['execution_time']
				res[k]=stats[k]['execution_time']['total_seconds']
				total+=res[k]
			end
		end

		res["TOTAL_plugins"]=total
		
	rescue Excepcion => e

	   puts "Error reading #{file_path}"
	end

	if stats['scbi_mapreduce']
		res['TOTAL_workers']=stats['scbi_mapreduce']['connected_workers']
		res['TOTAL_read']=stats['scbi_mapreduce']['total_read_time']
		res['TOTAL_write']=stats['scbi_mapreduce']['total_write_time']
		res['TOTAL_manager_idle']=stats['scbi_mapreduce']['total_manager_idle_time']
		res['TOTAL_execution']=stats['scbi_mapreduce']['total_seconds']
	end

	if puts_json
		puts JSON::pretty_generate(res)
	else
		res.keys.sort.each do |k|
			puts "#{k}\t#{res[k]}"
		end
	end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
seqtrimnext-2.0.62 bin/resume_execution_times.rb