Class: RailsRequestStats::Stats::ObjectSpaceStats
- Inherits:
-
Object
- Object
- RailsRequestStats::Stats::ObjectSpaceStats
- Defined in:
- lib/rails_request_stats/stats/object_space_stats.rb
Instance Attribute Summary collapse
-
#array_count_collection ⇒ Object
readonly
Returns the value of attribute array_count_collection.
-
#bignum_count_collection ⇒ Object
readonly
Returns the value of attribute bignum_count_collection.
-
#class_count_collection ⇒ Object
readonly
Returns the value of attribute class_count_collection.
-
#complex_count_collection ⇒ Object
readonly
Returns the value of attribute complex_count_collection.
-
#data_count_collection ⇒ Object
readonly
Returns the value of attribute data_count_collection.
-
#file_count_collection ⇒ Object
readonly
Returns the value of attribute file_count_collection.
-
#float_count_collection ⇒ Object
readonly
Returns the value of attribute float_count_collection.
-
#generated_object_count_collection ⇒ Object
readonly
Returns the value of attribute generated_object_count_collection.
-
#hash_count_collection ⇒ Object
readonly
Returns the value of attribute hash_count_collection.
-
#iclass_count_collection ⇒ Object
readonly
Returns the value of attribute iclass_count_collection.
-
#match_count_collection ⇒ Object
readonly
Returns the value of attribute match_count_collection.
-
#module_count_collection ⇒ Object
readonly
Returns the value of attribute module_count_collection.
-
#node_count_collection ⇒ Object
readonly
Returns the value of attribute node_count_collection.
-
#object_count_collection ⇒ Object
readonly
Returns the value of attribute object_count_collection.
-
#regexp_count_collection ⇒ Object
readonly
Returns the value of attribute regexp_count_collection.
-
#string_count_collection ⇒ Object
readonly
Returns the value of attribute string_count_collection.
-
#struct_count_collection ⇒ Object
readonly
Returns the value of attribute struct_count_collection.
Instance Method Summary collapse
- #add_stats(before_object_space, after_object_space) ⇒ Object
-
#initialize ⇒ ObjectSpaceStats
constructor
A new instance of ObjectSpaceStats.
- #last_stats_generated_objects ⇒ Object
- #total_object_space_count(object_space) ⇒ Object
Constructor Details
#initialize ⇒ ObjectSpaceStats
Returns a new instance of ObjectSpaceStats.
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/rails_request_stats/stats/object_space_stats.rb', line 22 def initialize @object_count_collection = [] @class_count_collection = [] @module_count_collection = [] @float_count_collection = [] @string_count_collection = [] @regexp_count_collection = [] @array_count_collection = [] @hash_count_collection = [] @struct_count_collection = [] @bignum_count_collection = [] @file_count_collection = [] @data_count_collection = [] @match_count_collection = [] @complex_count_collection = [] @node_count_collection = [] @iclass_count_collection = [] @generated_object_count_collection = [] end |
Instance Attribute Details
#array_count_collection ⇒ Object (readonly)
Returns the value of attribute array_count_collection.
4 5 6 |
# File 'lib/rails_request_stats/stats/object_space_stats.rb', line 4 def array_count_collection @array_count_collection end |
#bignum_count_collection ⇒ Object (readonly)
Returns the value of attribute bignum_count_collection.
4 5 6 |
# File 'lib/rails_request_stats/stats/object_space_stats.rb', line 4 def bignum_count_collection @bignum_count_collection end |
#class_count_collection ⇒ Object (readonly)
Returns the value of attribute class_count_collection.
4 5 6 |
# File 'lib/rails_request_stats/stats/object_space_stats.rb', line 4 def class_count_collection @class_count_collection end |
#complex_count_collection ⇒ Object (readonly)
Returns the value of attribute complex_count_collection.
4 5 6 |
# File 'lib/rails_request_stats/stats/object_space_stats.rb', line 4 def complex_count_collection @complex_count_collection end |
#data_count_collection ⇒ Object (readonly)
Returns the value of attribute data_count_collection.
4 5 6 |
# File 'lib/rails_request_stats/stats/object_space_stats.rb', line 4 def data_count_collection @data_count_collection end |
#file_count_collection ⇒ Object (readonly)
Returns the value of attribute file_count_collection.
4 5 6 |
# File 'lib/rails_request_stats/stats/object_space_stats.rb', line 4 def file_count_collection @file_count_collection end |
#float_count_collection ⇒ Object (readonly)
Returns the value of attribute float_count_collection.
4 5 6 |
# File 'lib/rails_request_stats/stats/object_space_stats.rb', line 4 def float_count_collection @float_count_collection end |
#generated_object_count_collection ⇒ Object (readonly)
Returns the value of attribute generated_object_count_collection.
4 5 6 |
# File 'lib/rails_request_stats/stats/object_space_stats.rb', line 4 def generated_object_count_collection @generated_object_count_collection end |
#hash_count_collection ⇒ Object (readonly)
Returns the value of attribute hash_count_collection.
4 5 6 |
# File 'lib/rails_request_stats/stats/object_space_stats.rb', line 4 def hash_count_collection @hash_count_collection end |
#iclass_count_collection ⇒ Object (readonly)
Returns the value of attribute iclass_count_collection.
4 5 6 |
# File 'lib/rails_request_stats/stats/object_space_stats.rb', line 4 def iclass_count_collection @iclass_count_collection end |
#match_count_collection ⇒ Object (readonly)
Returns the value of attribute match_count_collection.
4 5 6 |
# File 'lib/rails_request_stats/stats/object_space_stats.rb', line 4 def match_count_collection @match_count_collection end |
#module_count_collection ⇒ Object (readonly)
Returns the value of attribute module_count_collection.
4 5 6 |
# File 'lib/rails_request_stats/stats/object_space_stats.rb', line 4 def module_count_collection @module_count_collection end |
#node_count_collection ⇒ Object (readonly)
Returns the value of attribute node_count_collection.
4 5 6 |
# File 'lib/rails_request_stats/stats/object_space_stats.rb', line 4 def node_count_collection @node_count_collection end |
#object_count_collection ⇒ Object (readonly)
Returns the value of attribute object_count_collection.
4 5 6 |
# File 'lib/rails_request_stats/stats/object_space_stats.rb', line 4 def object_count_collection @object_count_collection end |
#regexp_count_collection ⇒ Object (readonly)
Returns the value of attribute regexp_count_collection.
4 5 6 |
# File 'lib/rails_request_stats/stats/object_space_stats.rb', line 4 def regexp_count_collection @regexp_count_collection end |
#string_count_collection ⇒ Object (readonly)
Returns the value of attribute string_count_collection.
4 5 6 |
# File 'lib/rails_request_stats/stats/object_space_stats.rb', line 4 def string_count_collection @string_count_collection end |
#struct_count_collection ⇒ Object (readonly)
Returns the value of attribute struct_count_collection.
4 5 6 |
# File 'lib/rails_request_stats/stats/object_space_stats.rb', line 4 def struct_count_collection @struct_count_collection end |
Instance Method Details
#add_stats(before_object_space, after_object_space) ⇒ Object
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/rails_request_stats/stats/object_space_stats.rb', line 42 def add_stats(before_object_space, after_object_space) @object_count_collection << after_object_space[:T_OBJECT] - before_object_space[:T_OBJECT] @class_count_collection << after_object_space[:T_CLASS] - before_object_space[:T_CLASS] @module_count_collection << after_object_space[:T_MODULE] - before_object_space[:T_MODULE] @float_count_collection << after_object_space[:T_FLOAT] - before_object_space[:T_FLOAT] @string_count_collection << after_object_space[:T_STRING] - before_object_space[:T_STRING] @regexp_count_collection << after_object_space[:T_REGEXP] - before_object_space[:T_REGEXP] @array_count_collection << after_object_space[:T_ARRAY] - before_object_space[:T_ARRAY] @hash_count_collection << after_object_space[:T_HASH] - before_object_space[:T_HASH] @struct_count_collection << after_object_space[:T_STRUCT] - before_object_space[:T_STRUCT] @bignum_count_collection << after_object_space[:T_BIGNUM] - before_object_space[:T_BIGNUM] @file_count_collection << after_object_space[:T_FILE] - before_object_space[:T_FILE] @data_count_collection << after_object_space[:T_DATA] - before_object_space[:T_DATA] @match_count_collection << after_object_space[:T_MATCH] - before_object_space[:T_MATCH] @complex_count_collection << after_object_space[:T_COMPLEX] - before_object_space[:T_COMPLEX] @node_count_collection << after_object_space[:T_NODE] - before_object_space[:T_NODE] @iclass_count_collection << after_object_space[:T_ICLASS] - before_object_space[:T_ICLASS] @generated_object_count_collection << total_object_space_count(after_object_space) - total_object_space_count(before_object_space) end |
#last_stats_generated_objects ⇒ Object
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
# File 'lib/rails_request_stats/stats/object_space_stats.rb', line 66 def last_stats_generated_objects { total_generated_objects: generated_object_count_collection.last, object: object_count_collection.last, class: class_count_collection.last, module: module_count_collection.last, float: float_count_collection.last, string: string_count_collection.last, regexp: regexp_count_collection.last, array: array_count_collection.last, hash: hash_count_collection.last, struct: struct_count_collection.last, bignum: bignum_count_collection.last, file: file_count_collection.last, data: data_count_collection.last, match: match_count_collection.last, complex: complex_count_collection.last, node: node_count_collection.last, iclass: iclass_count_collection.last } end |
#total_object_space_count(object_space) ⇒ Object
62 63 64 |
# File 'lib/rails_request_stats/stats/object_space_stats.rb', line 62 def total_object_space_count(object_space) object_space.select { |k, v| k.to_s.start_with?('T_') }.values.reduce(:+) end |