aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack')
-rw-r--r--actionpack/lib/action_controller/benchmarking.rb9
1 files changed, 5 insertions, 4 deletions
diff --git a/actionpack/lib/action_controller/benchmarking.rb b/actionpack/lib/action_controller/benchmarking.rb
index 31fa5d940d..5201d31b8b 100644
--- a/actionpack/lib/action_controller/benchmarking.rb
+++ b/actionpack/lib/action_controller/benchmarking.rb
@@ -79,15 +79,16 @@ module ActionController #:nodoc:
end
def rendering_runtime(runtime)
- " | Rendering: #{sprintf("%.5f", @rendering_runtime)} (#{sprintf("%d", (@rendering_runtime * 100) / runtime)}%)"
+ percentage = @rendering_runtime * 100 / runtime
+ " | Rendering: %.5f (%d%%)" % [@rendering_runtime, percentage.to_i]
end
def active_record_runtime(runtime)
db_runtime = ActiveRecord::Base.connection.reset_runtime
db_runtime += @db_rt_before_render if @db_rt_before_render
db_runtime += @db_rt_after_render if @db_rt_after_render
- db_percentage = (db_runtime * 100) / runtime
- " | DB: #{sprintf("%.5f", db_runtime)} (#{sprintf("%d", db_percentage)}%)"
+ db_percentage = db_runtime * 100 / runtime
+ " | DB: %.5f (%d%%)" % [db_runtime, db_percentage.to_i]
end
end
-end \ No newline at end of file
+end