b0VIM 7.3-LV<4jannissucker~jannis/Dev/lib/stresser/lib/grapher.rbutf-8 3210#"! Utpad}onj*PO  z Y  k ) # "  X  h W    v u X D #  ked`&"dcJ2vub\VU@vZ>qX6end end } :background_colors => ['#fefeee', '#ffffff'] :font_color => 'black', :marker_color => "#cdcdcd", :colors => colors, g.theme = { colors = %w{EFD279 95CBE9 024769 AFD775 2C5700 DE9D7F B6212D 7F5417}.map{|c| "\##{c}"} g.x_axis_label = "concurrency (amount of parallel req)" g.sort = false g.marker_font_size = 10 g.legend_font_size = 20 g.line_width = 2 g.hide_dots = true def set_defaults(g) end hash array.each_with_index{ |v, i| hash[i] = v } hash = Hash.new return array if array.class==Hash def to_hash(array) end g # Return graph g.labels = to_hash(labels) # Add labels end g.data name, values.map(&:to_i) data.each do |name, values| # Add datas set_defaults(g) g.title = title g = Gruff::Line.new # Prepare line graph def line_graph(title, data, labels) protected end y = YAML.load(File.read(yaml_file)) def reports(report = nil, yaml_file = File.join(File.dirname(__FILE__), "reports.yml")) # # Reads a YAML file that defines how reports are built # end g = line_graph( options[:title], data, labels ) # Draw graph end data[columns[i]] = table.column columns[i+1] next unless i%2==0 columns.each_index do |i| labels = table.column "rate" data = Hash.new # Prepare data structure table = Table(csv_file) def graph(csv_file, columns, options = {}) # # Creates a graph from a csv file # end g.write(outfile) # Save graph g = graph(csv_file, columns, :title => options[:title] ) # Draw graph def save_graph(csv_file, columns, outfile, options = {}) # # Creates and saves a graph # end save_graph(csv_file, columns, outfile, :title => report_type) columns = (reports[report_type] or reports[reports.keys.first]) puts "Generating #{report_type} to #{outfile}..." def generate_report(report_type, csv_file, outfile) # # report names # Generates a single report given by name. Uses the yml file for # end puts " open #{File.join(options[:output_dir], prefix)}*.png" puts "Great, now open the images with" puts "~"*80 # Tell user what to do next end generate_report(report, options[:csv_file], outfile) outfile = File.join(options[:output_dir], "#{prefix}_#{report}.png") report_keys.each do |report| # Generate report(s) report_keys = [options[:report]] if report_keys.include?(options[:report]) report_keys = reports(options[:report_definitions]).keys # Generate a single report or all of them? prefix = Time.now.strftime("%Y_%m_%d_%H_%M") # Let's keep things clean def generate_reports(options) # # the user to go ahead and open them # reports, stores them in the given directory, and advises # Parses command line options and creates one or a bunch of # extend selfmodule Grapher$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..', 'lib')require 'yaml'require 'gruff'require 'ruport'