Class: RailsApiBenchmark::Graph
- Inherits:
-
Object
- Object
- RailsApiBenchmark::Graph
- Defined in:
- lib/rails_api_benchmark/graph.rb
Instance Method Summary collapse
- #copy_file ⇒ Object
- #generate ⇒ Object
-
#initialize(target, output_dir) ⇒ Graph
constructor
A new instance of Graph.
- #run ⇒ Object
Constructor Details
#initialize(target, output_dir) ⇒ Graph
Returns a new instance of Graph.
3 4 5 6 |
# File 'lib/rails_api_benchmark/graph.rb', line 3 def initialize(target, output_dir) @output_dir = output_dir @target = target end |
Instance Method Details
#copy_file ⇒ Object
18 19 20 21 |
# File 'lib/rails_api_benchmark/graph.rb', line 18 def copy_file dest = File.join(@output_dir) FileUtils.mv("#{@target.name}_plot.jpg", dest) end |
#generate ⇒ Object
8 9 10 11 |
# File 'lib/rails_api_benchmark/graph.rb', line 8 def generate run copy_file end |
#run ⇒ Object
13 14 15 16 |
# File 'lib/rails_api_benchmark/graph.rb', line 13 def run gnuplotscript = File.('../../gnuplotscript', __dir__) `gnuplot -e "plot_title='Benchmark #{@target.title}'; plot_file='#{@target.name}_plot.jpg'" #{gnuplotscript}` end |