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, "retained" => 0 }.freeze
- MIN_INTERVALS =
{ "cpu" => 200, "wall" => 200, "object" => 400, "retained" => 0 }.freeze
Instance Attribute Summary collapse
-
#async ⇒ Object
readonly
Returns the value of attribute async.
-
#autoredirect ⇒ Object
readonly
Returns the value of attribute autoredirect.
-
#backend ⇒ Object
readonly
Returns the value of attribute backend.
-
#mode ⇒ Object
readonly
Returns the value of attribute mode.
Instance Method Summary collapse
-
#initialize(mode: :wall, interval: nil, ignore_gc: false, autoredirect: false, async: false, backend: nil, 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, backend: nil, metadata: {}) ⇒ Parameters
Returns a new instance of Parameters.
12 13 14 15 16 17 18 19 20 21 |
# File 'lib/app_profiler/parameters.rb', line 12 def initialize(mode: :wall, interval: nil, ignore_gc: false, autoredirect: false, async: false, backend: nil, 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 @backend = backend || AppProfiler::Backend::StackprofBackend.name @metadata = { context: AppProfiler.context }.merge() @async = async end |
Instance Attribute Details
#async ⇒ Object (readonly)
Returns the value of attribute async.
10 11 12 |
# File 'lib/app_profiler/parameters.rb', line 10 def async @async end |
#autoredirect ⇒ Object (readonly)
Returns the value of attribute autoredirect.
10 11 12 |
# File 'lib/app_profiler/parameters.rb', line 10 def autoredirect @autoredirect end |
#backend ⇒ Object (readonly)
Returns the value of attribute backend.
10 11 12 |
# File 'lib/app_profiler/parameters.rb', line 10 def backend @backend end |
#mode ⇒ Object (readonly)
Returns the value of attribute mode.
10 11 12 |
# File 'lib/app_profiler/parameters.rb', line 10 def mode @mode end |
Instance Method Details
#to_h ⇒ Object
27 28 29 30 31 32 33 34 35 36 |
# File 'lib/app_profiler/parameters.rb', line 27 def to_h { mode: @mode, interval: @interval, ignore_gc: @ignore_gc, metadata: @metadata, backend: @backend, async: @async, } end |
#valid? ⇒ Boolean
23 24 25 |
# File 'lib/app_profiler/parameters.rb', line 23 def valid? true end |