gvl-tracing 1.2.0 → 1.3.0

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: 643b4b237db640d34ecf842459246640517ca9d58118ca891c76a629f1c6ab73
4
- data.tar.gz: 10c2613b6b66681b46f7d32a143e5742ed98b969d9aca00e3ceb6b22c5579f4b
3
+ metadata.gz: a5ec59682543834d531647bea2601457de0d8f8d57fe039181375891ef29ae60
4
+ data.tar.gz: ebfa80876458868eb9780bdf655c75ff7c3b649f0661799533e6dcd12f5b06ea
5
5
  SHA512:
6
- metadata.gz: f3265c1719bd2dd7859f4df78a4b9096277b45f26b9a6bd515c5a3222f3bdb98e56461eef274f5987a61cfb7ec331ac44dac58a94fd8dadf7474a51b9033f3d6
7
- data.tar.gz: 40a336509af944962fc2c48ae2f40c2ae40ff133b53b7e006f63f1a453e4106d68f6283e008462088f39afd3c5653556ef064fb6bf312aeffc09cd282ba90ba9
6
+ metadata.gz: 259ae5c91f2d750ed61ec938a3eb3f92fc813391393420648288626d824408f1678a534de2185c73a6ea8fc2a695aa46135f5529a8fa9bd32e00c0f878b5a538
7
+ data.tar.gz: ead5ce15933a39684675705a60983dbcd5fc8afb7752822103799261d05d5e3b3f6da8562ca496b9929f7bebf9ed203c31ccc5b778be59bf2c724f7bab9c4d49
data/README.adoc CHANGED
@@ -25,17 +25,15 @@ def fib(n)
25
25
  fib(n - 1) + fib(n - 2)
26
26
  end
27
27
 
28
- GvlTracing.start("example1.json")
28
+ GvlTracing.start("example1.json") do
29
+ Thread.new { sleep(0.05) while true }
29
30
 
30
- Thread.new { sleep(0.05) while true }
31
+ sleep(0.05)
31
32
 
32
- sleep(0.05)
33
+ 3.times.map { Thread.new { fib(37) } }.map(&:join)
33
34
 
34
- 3.times.map { Thread.new { fib(37) } }.map(&:join)
35
-
36
- sleep(0.05)
37
-
38
- GvlTracing.stop
35
+ sleep(0.05)
36
+ end
39
37
  ----
40
38
 
41
39
  To do so:
@@ -65,7 +63,7 @@ Use `require "gvl-tracing"` to load the gem.
65
63
 
66
64
  This gem only provides a single module (`GvlTracing`) with methods:
67
65
 
68
- * `start(filename)`: Starts tracing, writing the results to the provided filename
66
+ * `start(filename, &block)`: Starts tracing, writing the results to the provided filename. When a block is passed, yields the block and calls stop.
69
67
  * `stop`: Stops tracing
70
68
 
71
69
  The resulting traces can be analyzed by going to https://ui.perfetto.dev/[Perfetto UI].
data/lib/gvl-tracing.rb CHANGED
@@ -37,6 +37,14 @@ module GvlTracing
37
37
  def start(file)
38
38
  _start(file)
39
39
  @path = file
40
+
41
+ return unless block_given?
42
+
43
+ begin
44
+ yield
45
+ ensure
46
+ _stop
47
+ end
40
48
  end
41
49
 
42
50
  def stop
@@ -26,5 +26,5 @@
26
26
  # frozen_string_literal: true
27
27
 
28
28
  module GvlTracing
29
- VERSION = "1.2.0"
29
+ VERSION = "1.3.0"
30
30
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gvl-tracing
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ivo Anjo
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-06-06 00:00:00.000000000 Z
11
+ date: 2023-07-01 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
14
  email:
@@ -52,7 +52,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
52
52
  - !ruby/object:Gem::Version
53
53
  version: '0'
54
54
  requirements: []
55
- rubygems_version: 3.4.6
55
+ rubygems_version: 3.4.1
56
56
  signing_key:
57
57
  specification_version: 4
58
58
  summary: Get a timeline view of Global VM Lock usage in your Ruby app