diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2010-07-25 11:11:23 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2010-07-25 11:11:23 -0700 |
commit | b7e0408ca922cf51228818edbfdcd5c63e3cb84e (patch) | |
tree | 0313ba10f8f42720b03b51fabc992d84c425d8cb /activerecord/lib/active_record/log_subscriber.rb | |
parent | d02f2d2fb213584ce52a231063c948def856f657 (diff) | |
download | rails-b7e0408ca922cf51228818edbfdcd5c63e3cb84e.tar.gz rails-b7e0408ca922cf51228818edbfdcd5c63e3cb84e.tar.bz2 rails-b7e0408ca922cf51228818edbfdcd5c63e3cb84e.zip |
use a hash to collect optional statistics about the instrumentation
Diffstat (limited to 'activerecord/lib/active_record/log_subscriber.rb')
-rw-r--r-- | activerecord/lib/active_record/log_subscriber.rb | 16 |
1 files changed, 1 insertions, 15 deletions
diff --git a/activerecord/lib/active_record/log_subscriber.rb b/activerecord/lib/active_record/log_subscriber.rb index c7ae12977a..278e192e59 100644 --- a/activerecord/lib/active_record/log_subscriber.rb +++ b/activerecord/lib/active_record/log_subscriber.rb @@ -1,25 +1,11 @@ module ActiveRecord class LogSubscriber < ActiveSupport::LogSubscriber - def self.runtime=(value) - Thread.current["active_record_sql_runtime"] = value - end - - def self.runtime - Thread.current["active_record_sql_runtime"] ||= 0 - end - - def self.reset_runtime - rt, self.runtime = runtime, 0 - rt - end - def initialize super @odd_or_even = false end def sql(event) - self.class.runtime += event.duration return unless logger.debug? name = '%s (%.1fms)' % [event.payload[:name], event.duration] @@ -45,4 +31,4 @@ module ActiveRecord end end -ActiveRecord::LogSubscriber.attach_to :active_record
\ No newline at end of file +ActiveRecord::LogSubscriber.attach_to :active_record |