Module: QueryCounter::RequestHelper
- Defined in:
- lib/query_counter/request_helper.rb
Instance Method Summary collapse
- #qc_log_count_objects ⇒ Object
- #qc_log_count_objects_around ⇒ Object
- #qc_log_resource_usage ⇒ Object
- #qc_log_resource_usage_around ⇒ Object
Instance Method Details
#qc_log_count_objects ⇒ Object
26 27 28 29 30 31 32 33 34 35 |
# File 'lib/query_counter/request_helper.rb', line 26 def qc_log_count_objects diff_count_objects = {} ObjectSpace.count_objects.each do |name, count| if (diff = (count - Thread.current[:starting_count_objects][name].to_i)) > 0 diff_count_objects[name] = diff end end logger.info "Objects: #{diff_count_objects}" end |
#qc_log_count_objects_around ⇒ Object
9 10 11 12 13 |
# File 'lib/query_counter/request_helper.rb', line 9 def qc_log_count_objects_around yield ensure qc_log_count_objects end |
#qc_log_resource_usage ⇒ Object
15 16 17 18 19 20 21 22 23 24 |
# File 'lib/query_counter/request_helper.rb', line 15 def qc_log_resource_usage gc = GC.count - Thread.current[:starting_gc_count] stats = [] stats << "gc: #{gc}" if gc > 0 QueryCounter.current_collector.stats.each do |resource, stat| stats << "#{resource}: #{stat.count} [#{stat.time.to_i}ms]" end logger.info 'Resource Stats ' + stats.join(', ') end |
#qc_log_resource_usage_around ⇒ Object
3 4 5 6 7 |
# File 'lib/query_counter/request_helper.rb', line 3 def qc_log_resource_usage_around yield ensure qc_log_resource_usage end |