Sha256: bc2e5817a446abf30a385868eec4d3bb410054c2a8745abe06368c2f61cc5980
Contents?: true
Size: 601 Bytes
Versions: 2
Compression:
Stored size: 601 Bytes
Contents
# frozen_string_literal: true require 'speed_gun' require 'speed_gun/event' class SpeedGun::Profiler def self.profile(*args, &block) new.profile(*args, &block) end def self.ignore? SpeedGun.config.ignored_profilers.any? do |ignore| name.include?(ignore) end end def profile(name = self.class.name, payload = {}) started_at = Time.now payload[:backtrace] ||= SpeedGun.get_backtrace event = SpeedGun::Event.new(name, payload, started_at) result = yield(event) event.finish! SpeedGun.record(event) unless self.class.ignore? result end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
speed_gun-2.0.1 | lib/speed_gun/profiler.rb |
speed_gun-2.0.0 | lib/speed_gun/profiler.rb |