Class: Mysql2::Client
- Inherits:
-
Object
- Object
- Mysql2::Client
- Includes:
- Peek::Mysql2::Timing
- Defined in:
- lib/peek/views/mysql2.rb
Overview
Instrument SQL time
Class Attribute Summary collapse
-
.query_count ⇒ Object
Returns the value of attribute query_count.
-
.query_time ⇒ Object
Returns the value of attribute query_time.
Instance Method Summary collapse
Methods included from Peek::Mysql2::Timing
Class Attribute Details
.query_count ⇒ Object
Returns the value of attribute query_count.
7 8 9 |
# File 'lib/peek/views/mysql2.rb', line 7 def query_count @query_count end |
.query_time ⇒ Object
Returns the value of attribute query_time.
7 8 9 |
# File 'lib/peek/views/mysql2.rb', line 7 def query_time @query_time end |
Instance Method Details
#call_with_timing(*args, &block) ⇒ Object
16 17 18 19 20 21 22 23 |
# File 'lib/peek/views/mysql2.rb', line 16 def call_with_timing(*args, &block) start = Time.now call_without_timing(*args, &block) ensure duration = (Time.now - start) Mysql2::Client.query_time.update { |value| value + duration } Mysql2::Client.query_count.update { |value| value + 1 } end |