Class: CompareCompressors::SizePlotter
- Inherits:
-
Plotter
- Object
- Plotter
- CompareCompressors::SizePlotter
show all
- Defined in:
- lib/compare_compressors/plotters/size_plotter.rb
Overview
Plot grouped compression results to gnuplot in 2D — just compression time or decompression time vs size.
Constant Summary
collapse
- DEFAULT_DECOMPRESSION =
plot compression by default
false
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) ⇒ SizePlotter
Returns a new instance of SizePlotter.
11
12
13
14
15
16
17
18
19
|
# File 'lib/compare_compressors/plotters/size_plotter.rb', line 11
def initialize(**options)
@decompression = \
if options.key?(:decompression)
options.delete(:decompression)
else
DEFAULT_DECOMPRESSION
end
super(**options)
end
|
Instance Attribute Details
#decompression ⇒ Object
Returns the value of attribute decompression.
21
22
23
|
# File 'lib/compare_compressors/plotters/size_plotter.rb', line 21
def decompression
@decompression
end
|
Instance Method Details
#column_names ⇒ Object
44
45
46
|
# File 'lib/compare_compressors/plotters/size_plotter.rb', line 44
def column_names
[time_column_name, :mean_compressed_gibytes]
end
|
#plots ⇒ Object
52
53
54
55
56
57
58
|
# File 'lib/compare_compressors/plotters/size_plotter.rb', line 52
def plots
if show_labels
point_plots + point_label_plots
else
point_plots
end
end
|
#point_label_plots ⇒ Object
68
69
70
71
72
73
74
|
# File 'lib/compare_compressors/plotters/size_plotter.rb', line 68
def point_label_plots
compressor_names.map do |name|
columns = column_numbers(column_names + [:compressor_level])
"'$#{name}' using #{columns.join(':')}" \
' with labels left offset 0, character 0.5 notitle'
end
end
|
#point_plots ⇒ Object
60
61
62
63
64
65
66
|
# File 'lib/compare_compressors/plotters/size_plotter.rb', line 60
def point_plots
compressor_names.map do |name|
"'$#{name}' using #{column_numbers.join(':')} with points" \
" #{point_style(name)}" \
" title '#{find_display_name(name)}'"
end
end
|
#time_column_name ⇒ Object
32
33
34
35
36
37
38
39
40
41
42
|
# File 'lib/compare_compressors/plotters/size_plotter.rb', line 32
def time_column_name
if decompression && use_cpu_time
:mean_decompression_cpu_hours
elsif decompression
:mean_decompression_elapsed_hours
elsif use_cpu_time
:mean_compression_cpu_hours
else
:mean_compression_elapsed_hours
end
end
|
#write_labels ⇒ Object
23
24
25
26
27
28
29
30
|
# File 'lib/compare_compressors/plotters/size_plotter.rb', line 23
def write_labels
io.puts 'set ylabel "Compressed Size (GiB)"'
if decompression
io.puts "set xlabel 'Decompression Time #{time_unit}'"
else
io.puts "set xlabel 'Compression Time #{time_unit}'"
end
end
|
#write_plots ⇒ Object
48
49
50
|
# File 'lib/compare_compressors/plotters/size_plotter.rb', line 48
def write_plots
io.puts "plot #{plots.join(", \\\n ")}"
end
|