Class: AppProfiler::Parameters
- Inherits:
-
Object
- Object
- AppProfiler::Parameters
- Defined in:
- lib/app_profiler/parameters.rb
Constant Summary collapse
- DEFAULT_INTERVALS =
{ "cpu" => 1000, "wall" => 1000, "object" => 2000 }.freeze
- MIN_INTERVALS =
{ "cpu" => 200, "wall" => 200, "object" => 400 }.freeze
- MODES =
DEFAULT_INTERVALS.keys.freeze
Instance Attribute Summary collapse
-
#async ⇒ Object
readonly
Returns the value of attribute async.
-
#autoredirect ⇒ Object
readonly
Returns the value of attribute autoredirect.
Instance Method Summary collapse
-
#initialize(mode: :wall, interval: nil, ignore_gc: false, autoredirect: false, async: false, metadata: {}) ⇒ Parameters
constructor
A new instance of Parameters.
- #to_h ⇒ Object
- #valid? ⇒ Boolean
Constructor Details
#initialize(mode: :wall, interval: nil, ignore_gc: false, autoredirect: false, async: false, metadata: {}) ⇒ Parameters
Returns a new instance of Parameters.
13 14 15 16 17 18 19 20 |
# File 'lib/app_profiler/parameters.rb', line 13 def initialize(mode: :wall, interval: nil, ignore_gc: false, autoredirect: false, async: false, metadata: {}) @mode = mode.to_sym @interval = [interval&.to_i || DEFAULT_INTERVALS.fetch(@mode.to_s), MIN_INTERVALS.fetch(@mode.to_s)].max @ignore_gc = !!ignore_gc @autoredirect = autoredirect @metadata = { context: AppProfiler.context }.merge() @async = async end |
Instance Attribute Details
#async ⇒ Object (readonly)
Returns the value of attribute async.
11 12 13 |
# File 'lib/app_profiler/parameters.rb', line 11 def async @async end |
#autoredirect ⇒ Object (readonly)
Returns the value of attribute autoredirect.
11 12 13 |
# File 'lib/app_profiler/parameters.rb', line 11 def autoredirect @autoredirect end |
Instance Method Details
#to_h ⇒ Object
26 27 28 29 30 31 32 33 |
# File 'lib/app_profiler/parameters.rb', line 26 def to_h { mode: @mode, interval: @interval, ignore_gc: @ignore_gc, metadata: @metadata, } end |
#valid? ⇒ Boolean
22 23 24 |
# File 'lib/app_profiler/parameters.rb', line 22 def valid? true end |