Class: CompareCompressors::RawPlotter

Inherits:
Plotter
  • Object
show all
Defined in:
lib/compare_compressors/plotters/raw_plotter.rb

Overview

Plot grouped compression results to gnuplot in 3D (compression time, decompression time, and compressed size).

Constant Summary collapse

DEFAULT_VIEW_ROT_X =
30
DEFAULT_VIEW_ROT_Z =
350

Constants inherited from Plotter

Plotter::DEFAULT_AUTOSCALE_FIX, Plotter::DEFAULT_LMARGIN, Plotter::DEFAULT_LOGSCALE_SIZE, Plotter::DEFAULT_OUTPUT, Plotter::DEFAULT_SHOW_LABELS, Plotter::DEFAULT_TERMINAL, Plotter::DEFAULT_TITLE, Plotter::DEFAULT_USE_CPU_TIME

Instance Attribute Summary collapse

Attributes inherited from Plotter

#autoscale_fix, #group_results, #io, #lmargin, #logscale_size, #output, #show_labels, #terminal, #title, #use_cpu_time

Instance Method Summary collapse

Methods inherited from Plotter

#plot

Constructor Details

#initialize(**options) ⇒ RawPlotter

Returns a new instance of RawPlotter.



12
13
14
15
16
# File 'lib/compare_compressors/plotters/raw_plotter.rb', line 12

def initialize(**options)
  @view_rot_x = options.delete(:view_rot_x) || DEFAULT_VIEW_ROT_X
  @view_rot_z = options.delete(:view_rot_z) || DEFAULT_VIEW_ROT_Z
  super(**options)
end

Instance Attribute Details

#view_rot_xObject (readonly)

Returns the value of attribute view_rot_x.



18
19
20
# File 'lib/compare_compressors/plotters/raw_plotter.rb', line 18

def view_rot_x
  @view_rot_x
end

#view_rot_zObject (readonly)

Returns the value of attribute view_rot_z.



19
20
21
# File 'lib/compare_compressors/plotters/raw_plotter.rb', line 19

def view_rot_z
  @view_rot_z
end

Instance Method Details

#column_namesObject



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/compare_compressors/plotters/raw_plotter.rb', line 33

def column_names
  if use_cpu_time
    [
      :mean_compression_cpu_hours,
      :mean_compressed_gibytes,
      :mean_decompression_cpu_hours
    ]
  else
    [
      :mean_compression_elapsed_hours,
      :mean_compressed_gibytes,
      :mean_decompression_elapsed_hours
    ]
  end
end

#points_splotsObject



53
54
55
56
57
58
59
# File 'lib/compare_compressors/plotters/raw_plotter.rb', line 53

def points_splots
  compressor_names.map do |name|
    "'$#{name}' using #{column_numbers.join(':')} with points" \
    " #{point_style(name)}" \
    " title '#{find_display_name(name)}'"
  end
end

#splotsObject



49
50
51
# File 'lib/compare_compressors/plotters/raw_plotter.rb', line 49

def splots
  points_splots
end

#write_labelsObject



27
28
29
30
31
# File 'lib/compare_compressors/plotters/raw_plotter.rb', line 27

def write_labels
  io.puts "set xlabel 'Compression Time #{time_unit}' rotate parallel"
  io.puts 'set ylabel "Compressed Size (GiB)" rotate parallel'
  io.puts "set zlabel 'Decompression Time #{time_unit}' rotate parallel"
end

#write_styleObject



21
22
23
24
25
# File 'lib/compare_compressors/plotters/raw_plotter.rb', line 21

def write_style
  super
  io.puts format('set view %d, %d', view_rot_x, view_rot_z)
  io.puts 'set grid xtics ytics ztics'
end