['', 'k', 'M', 'B', 'T', 'Q'].freeze
87 88 89 90 91 92 93 94
# File 'lib/benchmark/ips.rb', line 87 def scale(value) scale = (Math.log10(value) / 3).to_i scale = 0 if scale < 0 || scale >= SUFFIXES.size suffix = SUFFIXES[scale] scaled_value = value.to_f / (1000 ** scale) "%10.3f#{suffix}" % scaled_value end