Class: Luna::Binary::BenchMark
- Inherits:
-
Object
- Object
- Luna::Binary::BenchMark
- Defined in:
- lib/luna/binary/benchmark.rb
Instance Attribute Summary collapse
-
#binary_time_arr ⇒ Object
readonly
Returns the value of attribute binary_time_arr.
-
#normal_time_arr ⇒ Object
readonly
Returns the value of attribute normal_time_arr.
-
#scheme ⇒ Object
readonly
Returns the value of attribute scheme.
-
#times ⇒ Object
readonly
Returns the value of attribute times.
-
#workspace ⇒ Object
readonly
Returns the value of attribute workspace.
Instance Method Summary collapse
-
#initialize(times, workspace, scheme) ⇒ BenchMark
constructor
A new instance of BenchMark.
- #print ⇒ Object
- #print_time_arr(time_arr, attention) ⇒ Object
- #run ⇒ Object
- #run_binary ⇒ Object
- #run_no_binary ⇒ Object
- #run_project(arr) ⇒ Object
Constructor Details
#initialize(times, workspace, scheme) ⇒ BenchMark
Returns a new instance of BenchMark.
49 50 51 52 53 54 55 |
# File 'lib/luna/binary/benchmark.rb', line 49 def initialize(times, workspace, scheme) @times = times @workspace = workspace @scheme = scheme @binary_time_arr = [] @normal_time_arr = [] end |
Instance Attribute Details
#binary_time_arr ⇒ Object (readonly)
Returns the value of attribute binary_time_arr.
46 47 48 |
# File 'lib/luna/binary/benchmark.rb', line 46 def binary_time_arr @binary_time_arr end |
#normal_time_arr ⇒ Object (readonly)
Returns the value of attribute normal_time_arr.
47 48 49 |
# File 'lib/luna/binary/benchmark.rb', line 47 def normal_time_arr @normal_time_arr end |
#scheme ⇒ Object (readonly)
Returns the value of attribute scheme.
45 46 47 |
# File 'lib/luna/binary/benchmark.rb', line 45 def scheme @scheme end |
#times ⇒ Object (readonly)
Returns the value of attribute times.
43 44 45 |
# File 'lib/luna/binary/benchmark.rb', line 43 def times @times end |
#workspace ⇒ Object (readonly)
Returns the value of attribute workspace.
44 45 46 |
# File 'lib/luna/binary/benchmark.rb', line 44 def workspace @workspace end |
Instance Method Details
#print ⇒ Object
86 87 88 89 |
# File 'lib/luna/binary/benchmark.rb', line 86 def print print_time_arr(normal_time_arr, "normal average time:") print_time_arr(binary_time_arr, "binary average time:") end |
#print_time_arr(time_arr, attention) ⇒ Object
91 92 93 94 95 96 97 98 99 100 |
# File 'lib/luna/binary/benchmark.rb', line 91 def print_time_arr(time_arr, attention) i = 0 sum_time = 0 time_arr.each { |item| item.print sum_time += item.delta i += 1 } puts "#{attention} #{sum_time/i}" if sum_time > 0 end |
#run ⇒ Object
57 58 59 60 |
# File 'lib/luna/binary/benchmark.rb', line 57 def run run_binary run_no_binary end |
#run_binary ⇒ Object
62 63 64 65 |
# File 'lib/luna/binary/benchmark.rb', line 62 def run_binary Common.instance.command("lbu install") run_project(binary_time_arr) end |
#run_no_binary ⇒ Object
67 68 69 70 |
# File 'lib/luna/binary/benchmark.rb', line 67 def run_no_binary Common.instance.command("lbu install n") run_project(normal_time_arr) end |
#run_project(arr) ⇒ Object
72 73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/luna/binary/benchmark.rb', line 72 def run_project(arr) i = 0 while i < times Common.instance.command("xcodebuild clean -quiet -workspace #{workspace} -scheme #{scheme} -configuration Debug") t = DogTimer.new() t.start Common.instance.command("xcodebuild -workspace #{workspace} -scheme #{scheme} -configuration Debug") t.end arr << t i = i + 1 end end |