lib/remnant/base.rb in remnant-0.3.3 vs lib/remnant/base.rb in remnant-0.4.0
- old
+ new
@@ -39,13 +39,12 @@
Remnant::Discover.results.map do |remnant_key, ms|
Remnant.handler.timing("#{key_prefix}.#{remnant_key}", ms.to_i)
end
- if Remnant::Database.enabled?
- Remnant.handler.timing("#{key_prefix}.db", Remnant::Database.total_time.to_i)
- end
+ Remnant.handler.timing("#{key_prefix}.gc", Remnant::GC.ms.to_i)
+ Remnant.handler.timing("#{key_prefix}.db", Remnant::Database.total_time.to_i)
@sample_counter = 0
else
@sample_counter += 1
end
@@ -59,28 +58,36 @@
remnant_key
].compact.join('.')
Rails.logger.info "#{Remnant.color}#{ms.to_i}ms#{Remnant.color(true)}\t#{key}"
end
+ Rails.logger.info "#{Remnant.color}#{Remnant::GC.time.to_i}ms (#{Remnant::GC.collections} collections)#{Remnant.color(true)}\tGC"
+ # filters
+ Rails.logger.info ""
+ Rails.logger.info("#{color(false, true)}----- Filters (%.2fms) -----#{color(true)}" % Remnant::Filters.total_time)
+ Remnant::Filters.filters.map do |filter|
+ Rails.logger.info("#{color}%.2fms#{color(true)}\t#{filter[:name]} (#{filter[:type]})" % filter[:ms])
+ end
+
+ # template captures
if Remnant::Template.enabled?
Rails.logger.info ""
Rails.logger.info "#{color(false, true)}----- Templates -----#{color(true)}"
Remnant::Template.trace.root.children.map do |rendering|
Remnant::Template.trace.log(Rails.logger, rendering)
end
end
- if Remnant::Database.enabled?
- Rails.logger.info ""
- Rails.logger.info("#{color(false, true)}---- Database (%.2fms) -----#{color(true)}" % Remnant::Database.total_time)
- if Remnant::Database.suppress?
- Rails.logger.info "queries suppressed in development mode"
- else
- Remnant::Database.queries.map do |query|
- Rails.logger.info("#{color}%.2fms#{color(true)}\t#{query.sql}" % (query.time * 1000))
- end
+ # sql captures
+ Rails.logger.info ""
+ Rails.logger.info("#{color(false, true)}---- Database (%.2fms) -----#{color(true)}" % Remnant::Database.total_time)
+ if Remnant::Database.suppress?
+ Rails.logger.info "queries suppressed in development mode"
+ else
+ Remnant::Database.queries.map do |query|
+ Rails.logger.info("#{color}%.2fms#{color(true)}\t#{query.sql}" % (query.time * 1000))
end
end
Rails.logger.info "#{color(false, true)}-----------------------------------------------#{color(true)}"
end
@@ -90,9 +97,10 @@
Remnant.configuration.custom_hook.call(Remnant::Discover.results)
end
Remnant::Database.reset
Remnant::Template.reset
+ Remnant::Filters.reset
Remnant::Discover.results.clear
end
end
extend ClassMethods
end