execution_time 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 442112d9c9feb0bf2e01861f7ab6d3c0bd812133cf9523005fcd792c261558cc
4
- data.tar.gz: c177f92ed4ca9683c6db8ece732622252d483f7162d9eb61f222cb436b353c68
3
+ metadata.gz: 6f18a74e2fd925985154a51464fd05101bbaa23f1d3e4ba3b66f80a7d3a88173
4
+ data.tar.gz: f201b8e48c7dd34b32df183ffbdce19ee95f047e1f4a66d182a923fcc13952cd
5
5
  SHA512:
6
- metadata.gz: a4eddc87a2234c1943a29d5b2e5a1b9db919e36ee8a076953627f2cd9aaa3b85b1412489b58be074f73d62c58112377d11241c1a6c99d1650dc56f12d911e6f3
7
- data.tar.gz: 7283093d13704a632d5f8c68f1aa83696cd118a2d8f1e737a2d4212a5b92c3d24b8540ce94e0a4e9cfefbd00803bebb249c1e2f98a9a51dccf08a383233107ff
6
+ metadata.gz: 334c7b1d8d7bfa62d43f54b05b3366389540a6076babb5a448036ccf82609bd54e60ead4cbce9a118b6a26ef9f5375cd4cfb22b9ebb46271adaf2f188652edcf
7
+ data.tar.gz: 741ce85c6c3768b77edf9aa1643c6af001b5be60c508d9f51594d72a83f430dd0f3de9c41010e4775a3b364a0cb58c41d70b55fa436adebeda78aa207370fbd9
data/README.md CHANGED
@@ -1,9 +1,11 @@
1
1
  # ExecutionTime
2
2
 
3
- This gem can get you an execution time info similar to processed requests directly in rails console.
3
+ Monitor execution time and other metrics directly in `rails console`, similar to what you see after each request.
4
4
 
5
5
  `[METRICS] Completed in 908.3ms | Allocations: 2894 | ActiveRecord: 0.9ms (queries: 13)`
6
6
 
7
+ <img src="https://github.com/igorkasyanchuk/execution_time/blob/master/docs/execution_time_new.gif?raw=true" width="90%" />
8
+
7
9
  ## Usage
8
10
 
9
11
  Just add this gem to the Gemfile and start `rails c`. After this try to do something like `User.first`.
@@ -20,7 +22,14 @@ gem 'execution_time'
20
22
 
21
23
  ## First run
22
24
 
23
- Sometime you can see that there are more SQL queries or allocated objects because Ruby just loading objects in memory or verifying connection to the DB.
25
+ Sometime you can see that there are more SQL queries or allocated objects because Ruby is just loading objects in memory or verifying connection to the DB.
26
+
27
+ ## How to disable/enable metrics output in the console
28
+
29
+ If you need to disable gem in the console you can do it by `ExecutionTime.disable!`. And later enable with `ExecutionTime.enable!`.
30
+
31
+ By default gem is enabled.
32
+
24
33
 
25
34
  ## Contributing
26
35
 
@@ -1,6 +1,17 @@
1
1
  require "execution_time/railtie"
2
2
 
3
3
  module ExecutionTime
4
+ mattr_accessor :enabled
5
+ @@enabled = true
6
+
7
+ def ExecutionTime.enable!
8
+ @@enabled = true
9
+ end
10
+
11
+ def ExecutionTime.disable!
12
+ @@enabled = false
13
+ end
14
+
4
15
  class AppMetrics
5
16
  @@counter = 0
6
17
 
@@ -32,6 +43,8 @@ module ExecutionTime
32
43
 
33
44
  class Measurer
34
45
  def Measurer.watch
46
+ return yield unless ExecutionTime.enabled
47
+
35
48
  AppMetrics.reset
36
49
 
37
50
  start = Time.now
@@ -1,3 +1,3 @@
1
1
  module ExecutionTime
2
- VERSION = '0.1.0'
2
+ VERSION = '0.1.1'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: execution_time
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Igor Kasyanchuk
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-05-14 00:00:00.000000000 Z
11
+ date: 2020-06-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails