Class: ActiveRecordQueryCounter::TransactionInfo
- Inherits:
-
Object
- Object
- ActiveRecordQueryCounter::TransactionInfo
- Defined in:
- lib/active_record_query_counter/transaction_info.rb
Overview
Data structure for storing information about a transaction. Note that the start and end times are monotonic time and not wall clock time.
Instance Attribute Summary collapse
-
#end_time ⇒ Object
readonly
Returns the value of attribute end_time.
-
#start_time ⇒ Object
readonly
Returns the value of attribute start_time.
-
#trace ⇒ Object
readonly
Returns the value of attribute trace.
Instance Method Summary collapse
-
#elapsed_time ⇒ Float
Return the time spent in the transaction.
-
#initialize(start_time:, end_time:, trace:) ⇒ TransactionInfo
constructor
A new instance of TransactionInfo.
Constructor Details
#initialize(start_time:, end_time:, trace:) ⇒ TransactionInfo
9 10 11 12 13 |
# File 'lib/active_record_query_counter/transaction_info.rb', line 9 def initialize(start_time:, end_time:, trace:) @start_time = start_time @end_time = end_time @trace = trace end |
Instance Attribute Details
#end_time ⇒ Object (readonly)
Returns the value of attribute end_time.
7 8 9 |
# File 'lib/active_record_query_counter/transaction_info.rb', line 7 def end_time @end_time end |
#start_time ⇒ Object (readonly)
Returns the value of attribute start_time.
7 8 9 |
# File 'lib/active_record_query_counter/transaction_info.rb', line 7 def start_time @start_time end |
#trace ⇒ Object (readonly)
Returns the value of attribute trace.
7 8 9 |
# File 'lib/active_record_query_counter/transaction_info.rb', line 7 def trace @trace end |
Instance Method Details
#elapsed_time ⇒ Float
Return the time spent in the transaction.
18 19 20 |
# File 'lib/active_record_query_counter/transaction_info.rb', line 18 def elapsed_time end_time - start_time end |