class RBT::Action::Statistics::ReturnCompileTimeStatistics
Public Class Methods
[](i = ARGV)
click to toggle source
Public Instance Methods
body?()
click to toggle source
dataset?()
click to toggle source
does_the_main_file_exist?()
click to toggle source
empty?()
click to toggle source
keys?()
click to toggle source
#¶ ↑
keys?¶ ↑
#¶ ↑
# File lib/rbt/actions/individual_actions/statistics/return_compile_time_statistics.rb, line 77 def keys? dataset?.keys end
Also aliased as: keys
main_file?()
click to toggle source
reset()
click to toggle source
#¶ ↑
reset (reset tag)¶ ↑
#¶ ↑
Calls superclass method
RBT::Action#reset
# File lib/rbt/actions/individual_actions/statistics/return_compile_time_statistics.rb, line 45 def reset super() infer_the_namespace # ======================================================================= # # === @dataset # ======================================================================= # @dataset = nil # Default value. # ======================================================================= # # === @body # # @body will contain the body of the compile-time statistics. # ======================================================================= # reset_the_body_variable end
reset_the_body_variable()
click to toggle source
return_the_header()
click to toggle source
#¶ ↑
return_the_header
¶ ↑
#¶ ↑
# File lib/rbt/actions/individual_actions/statistics/return_compile_time_statistics.rb, line 91 def return_the_header 'Program name'.ljust(32)+ # header part1 'Compile time [sec] '+ # header part2 'Compile time [min]'+ # header part3 ' Archive file size'+ # header part4 ' #' # header part5 end
run()
click to toggle source
#¶ ↑
run (run tag)¶ ↑
#¶ ↑
# File lib/rbt/actions/individual_actions/statistics/return_compile_time_statistics.rb, line 133 def run try_to_load_up_the_dataset if dataset? reset_the_body_variable # =================================================================== # # Need to sort this dataset by duration next. The programs that # took the longest to compile, will be on "top" of the Array. # =================================================================== # sorted_longest_compilation_comes_first = dataset?.sort_by {|name_of_the_program, n_seconds| n_seconds }.reverse index = 0 sorted_longest_compilation_comes_first.each {|name_of_the_program, n_seconds| index += 1 left_padded = ("#{name_of_the_program.strip}:").ljust(26) right_padded_showing_n_seconds = ( '%.2f' % n_seconds.to_s.strip.to_f ).rjust(12) right_padded_showing_n_seconds << "#{rev} seconds" n_minutes = (n_seconds.to_f / 60.0).round(2) # Rounding to 2 is better. n_minutes = n_minutes.to_s.ljust(4,'0') # =================================================================== # # Next count the amount of numbers before the '.' point. If there # are at the least two numbers, we will .ljust(5,'0') rather than # .ljust(4,'0'). # =================================================================== # if n_minutes.include? '.' first_splitted = n_minutes.split('.').first if first_splitted.size > 1 n_minutes = n_minutes.to_s.ljust(5,'0') end end # =================================================================== # # The program name may be upcased; since we store only downcased # variants for the name of the .yml file at hand, we will also # .downcase() on the program name in the following code. # =================================================================== # archive_size = action( :fast_return_file_size_of_this_program, name_of_the_program.downcase.delete('-') # Downcase it here. ) colourized_file_size = mediumslateblue( "#{archive_size.to_s.rjust(10)} Kb" ) result = ' '+ sfancy(left_padded)+' '+ simp(right_padded_showing_n_seconds)+' '+ orange( ( "(#{n_minutes}" ).rjust(6)+' minutes)' ) result << " #{colourized_file_size}" result << mediumseagreen(" ##{index}") @body << "#{result}\n" } @body << "\n" end end