Class: EasyProfiler::ProfileInstanceBase
- Inherits:
-
Object
- Object
- EasyProfiler::ProfileInstanceBase
- Defined in:
- lib/easy_prof/profile_instance_base.rb
Overview
Base class for profilers.
Direct Known Subclasses
Constant Summary collapse
- @@row_even =
true
Instance Attribute Summary collapse
-
#buffer ⇒ Object
readonly
Returns the value of attribute buffer.
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
-
#debug(message) ⇒ Object
Sets a profiling checkpoint without execution time printing.
-
#dump_results ⇒ Object
Dumps results to the log.
- #end_group ⇒ Object
-
#group(name, options = {}, &block) ⇒ Object
Start a group with a specified name.
-
#initialize(name, config = nil) ⇒ ProfileInstanceBase
constructor
Initializes a new instance of
ProfileInstanceBase
class. -
#progress(message) ⇒ Object
Sets a profiling checkpoint (block execution time will be printed).
Constructor Details
#initialize(name, config = nil) ⇒ ProfileInstanceBase
Initializes a new instance of ProfileInstanceBase
class.
Parameters:
-
name – session name.
-
options – a
Hash
of options (seeEasyProfiler::Profile.start
for details).
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/easy_prof/profile_instance_base.rb', line 13 def initialize(name, config = nil) @name = name @config = Configuration.parse(config) @start = @progress = Time.now.to_f # Initial number of ActiveRecord::Base objects if @config.count_ar_instances @start_ar_instances = @current_ar_instances = active_record_instances_count end # Initial amount of memory used if @config.count_memory_usage @start_memory_usage = @current_memory_usage = process_memory_usage end # A buffer where all log messeges will be stored till the # end of the profiling block. We need this because not every # profiling log will be printed (see EasyProf::Configuration.print_limit). @buffer = [] end |
Instance Attribute Details
#buffer ⇒ Object (readonly)
Returns the value of attribute buffer.
4 5 6 |
# File 'lib/easy_prof/profile_instance_base.rb', line 4 def buffer @buffer end |
#config ⇒ Object (readonly)
Returns the value of attribute config.
4 5 6 |
# File 'lib/easy_prof/profile_instance_base.rb', line 4 def config @config end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
4 5 6 |
# File 'lib/easy_prof/profile_instance_base.rb', line 4 def name @name end |
Instance Method Details
#debug(message) ⇒ Object
Sets a profiling checkpoint without execution time printing.
Parameters:
-
message – a message to associate with a check point.
48 49 |
# File 'lib/easy_prof/profile_instance_base.rb', line 48 def debug() end |
#dump_results ⇒ Object
Dumps results to the log.
64 65 |
# File 'lib/easy_prof/profile_instance_base.rb', line 64 def dump_results end |
#end_group ⇒ Object
60 61 |
# File 'lib/easy_prof/profile_instance_base.rb', line 60 def end_group end |
#group(name, options = {}, &block) ⇒ Object
Start a group with a specified name.
Parameters:
-
name – a name of the group.
56 57 58 |
# File 'lib/easy_prof/profile_instance_base.rb', line 56 def group(name, = {}, &block) self end |
#progress(message) ⇒ Object
Sets a profiling checkpoint (block execution time will be printed).
Parameters:
-
message – a message to associate with a check point.
40 41 |
# File 'lib/easy_prof/profile_instance_base.rb', line 40 def progress() end |