Class: RuntimeProfiler::InstrumentationData
- Inherits:
-
Object
- Object
- RuntimeProfiler::InstrumentationData
- Defined in:
- lib/runtime_profiler/instrumentation_data.rb
Instance Attribute Summary collapse
-
#controller_data ⇒ Object
readonly
Returns the value of attribute controller_data.
-
#sql_data ⇒ Object
readonly
Returns the value of attribute sql_data.
Instance Method Summary collapse
-
#initialize(controller_data: nil, sql_data: nil) ⇒ InstrumentationData
constructor
A new instance of InstrumentationData.
- #persist! ⇒ Object
Constructor Details
#initialize(controller_data: nil, sql_data: nil) ⇒ InstrumentationData
5 6 7 8 |
# File 'lib/runtime_profiler/instrumentation_data.rb', line 5 def initialize(controller_data: nil, sql_data: nil) @controller_data = controller_data || {} @sql_data = sql_data end |
Instance Attribute Details
#controller_data ⇒ Object (readonly)
Returns the value of attribute controller_data.
3 4 5 |
# File 'lib/runtime_profiler/instrumentation_data.rb', line 3 def controller_data @controller_data end |
#sql_data ⇒ Object (readonly)
Returns the value of attribute sql_data.
3 4 5 |
# File 'lib/runtime_profiler/instrumentation_data.rb', line 3 def sql_data @sql_data end |
Instance Method Details
#persist! ⇒ Object
10 11 12 13 14 15 16 17 18 19 |
# File 'lib/runtime_profiler/instrumentation_data.rb', line 10 def persist! File.open(output_file, 'w') do |f| f.write JSON.dump(instrumentation_data) end puts "\n" puts 'Profiling data written at ' + output_file.to_s puts 'You can view profiling data via: bundle exec runtime_profiler view ' + output_file.to_s puts "\n" end |