execution_time 0.1.2 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +19 -1
- data/lib/execution_time/version.rb +1 -1
- data/lib/execution_time.rb +6 -2
- metadata +34 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fdf5b2936b0ba018e9d552f58a688e42c8fd687d909d7f0ebda250073cb8f65e
|
4
|
+
data.tar.gz: b786631413bff61f616d7b178a5ff271b1c58280ad56d540aad64ff0304fae93
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 98189559f4ae66c349537799b7e7562c189c427174d86c6481ae6e1b5b23fa73e2d9697d911aa9ec45ea728210aca85be4aba7c4e8372b20dd2ef8a68b2b90e4
|
7
|
+
data.tar.gz: a962c753502dac4140d77f0ff2992051ee9875de5c3c79717e805b32aa3a2967a4a0a9e97755001873f21cdafbce729f0490d6d9cdf0164d255515faeadef551
|
data/README.md
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
# ExecutionTime
|
2
2
|
|
3
|
+
[![Listed on OpenSource-Heroes.com](https://opensource-heroes.com/badge-v1.svg)](https://opensource-heroes.com/r/igorkasyanchuk/execution_time)
|
4
|
+
|
3
5
|
Monitor execution time and other metrics directly in `rails console`, similar to what you see after each request.
|
4
6
|
|
5
7
|
`[METRICS] Completed in 908.3ms | Allocations: 2894 | ActiveRecord: 0.9ms (queries: 13)`
|
@@ -10,7 +12,20 @@ Monitor execution time and other metrics directly in `rails console`, similar to
|
|
10
12
|
|
11
13
|
Just add this gem to the Gemfile and start `rails c`. After this try to do something like `User.first`.
|
12
14
|
|
13
|
-
If you want to measure few lines of code just wrap it with `begin/end
|
15
|
+
If you want to measure few lines of code just wrap it with `begin/end`:
|
16
|
+
|
17
|
+
```ruby
|
18
|
+
[4] pry(main)> begin
|
19
|
+
[4] pry(main)* User.first.first_name.size
|
20
|
+
[4] pry(main)* a = User.count + 1
|
21
|
+
[4] pry(main)* b = User.second.last_name.size
|
22
|
+
[4] pry(main)* end
|
23
|
+
User Load (0.4ms) SELECT "users".* FROM "users" ORDER BY "users"."id" ASC LIMIT $1 [["LIMIT", 1]]
|
24
|
+
(3.6ms) SELECT COUNT(*) FROM "users"
|
25
|
+
User Load (0.3ms) SELECT "users".* FROM "users" ORDER BY "users"."id" ASC LIMIT $1 OFFSET $2 [["LIMIT", 1], ["OFFSET", 1]]
|
26
|
+
[METRICS] Completed in 6.8ms | Allocations: 839 | ActiveRecord: 4.3ms (queries: 3)
|
27
|
+
=> 5
|
28
|
+
```
|
14
29
|
|
15
30
|
## Installation
|
16
31
|
|
@@ -41,3 +56,6 @@ You are welcome to contribute.
|
|
41
56
|
|
42
57
|
## License
|
43
58
|
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
59
|
+
|
60
|
+
[<img src="https://github.com/igorkasyanchuk/rails_time_travel/blob/main/docs/more_gems.png?raw=true"
|
61
|
+
/>](https://www.railsjazz.com/?utm_source=github&utm_medium=bottom&utm_campaign=execution_time)
|
data/lib/execution_time.rb
CHANGED
@@ -72,7 +72,11 @@ module ExecutionTime
|
|
72
72
|
module IrbContextExt
|
73
73
|
def evaluate(*args)
|
74
74
|
Measurer.watch do
|
75
|
-
|
75
|
+
if RUBY_VERSION.to_s =~ /^3/ && !args[2].nil?
|
76
|
+
super(args[0], args[1], **args[2])
|
77
|
+
else
|
78
|
+
super(*args)
|
79
|
+
end
|
76
80
|
end
|
77
81
|
end
|
78
82
|
end
|
@@ -95,4 +99,4 @@ module ExecutionTime
|
|
95
99
|
super(code)
|
96
100
|
end
|
97
101
|
end
|
98
|
-
end
|
102
|
+
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.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Igor Kasyanchuk
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-07-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -38,6 +38,34 @@ dependencies:
|
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: irb
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: pry
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
41
69
|
description: Measure execution time in Rails console
|
42
70
|
email:
|
43
71
|
- igorkasyanchuk@gmail.com
|
@@ -56,7 +84,7 @@ homepage: https://github.com/igorkasyanchuk
|
|
56
84
|
licenses:
|
57
85
|
- MIT
|
58
86
|
metadata: {}
|
59
|
-
post_install_message:
|
87
|
+
post_install_message:
|
60
88
|
rdoc_options: []
|
61
89
|
require_paths:
|
62
90
|
- lib
|
@@ -71,8 +99,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
71
99
|
- !ruby/object:Gem::Version
|
72
100
|
version: '0'
|
73
101
|
requirements: []
|
74
|
-
rubygems_version: 3.
|
75
|
-
signing_key:
|
102
|
+
rubygems_version: 3.4.13
|
103
|
+
signing_key:
|
76
104
|
specification_version: 4
|
77
105
|
summary: Measure execution time in Rails console
|
78
106
|
test_files: []
|