trace_tree 0.2.16 → 0.2.17

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cb7a1e555384e2acad9ff6f9b7f51a120cbd35bca05afa9ce7470e358d3f3ea7
4
- data.tar.gz: 4cfb486a427b2c6dc2aaff7b1fa5e4a9183bdf52249ee20b23cc580ea76e8081
3
+ metadata.gz: b40964e36895674c6e39e8b8dbb57cef034da914f3b1a6c59d5bc7cf0061abe3
4
+ data.tar.gz: c84f93c457c7f2481f49823cea6ace1b979e5728bfe84b1a03fbcf1b85b1187f
5
5
  SHA512:
6
- metadata.gz: a9ee20d2b1adbb2105567b5d392f2e586b13abe14da5e471d1379af837848379f7b6f52e4f76d45668d98e814125b0bb5c4596194840ad2de21fc613853ea3e7
7
- data.tar.gz: bfa96688b71d085e54ec44990de682d4054c0d28d0b9d0c5bfc2e84b71c85830e916ee7c4d4d5f37a7ea985b7ccd3b5d25a7c2612e42401f49c7ec17762521cc
6
+ metadata.gz: bc7707c5c358b7304c7966d4cd96fde2b98049525e5906ca442a238cd5afa0fd8dac3aeaa2b14b64590e814f68556895bcf1f4b9470c69131ff4c9bdf2530a2b
7
+ data.tar.gz: 1b695fcf38a0cb76de637651e55802c4196dd1bed8ce0b31f3972317b8ed57155892984e04a784ff3ed9bd74f05d6881e9965d70a280facc9ea69a21e1497658
data/README.md CHANGED
@@ -55,7 +55,8 @@ end
55
55
  * `:return => true` by default. It stores return values of functions in generated html. Hover function call and press `r` to print return value in console.
56
56
  * `:args => false` by default. Set it true to puts arguments of `:call` functions into html. Since arguments are always return values of other functions, so this option is not necessary.
57
57
  * `:in => //, :out => nil` by default. Give them regexp(s) to include/exclude methods defined in files match that regexp(s). Notice thread-calls and methods defined by `define_method` are always included. Also, once you set any of these two options, the code to trace should not be in same line with `binding.trace_tree() do`.
58
- * `:no_methods => nil` by defalut. Give it regexp(s) to hide stack under matching methods. Useful when you want to dump stack of a rack middleware but lower middlewares.
58
+ * `:no_methods => nil` by default. Give it regexp(s) to hide stack under matching methods. Useful when you want to dump stack of a rack middleware but lower middlewares.
59
+ * `:warm => nil` by default. Set it something unique to the code block so that the code block will be traced only when it's called second time, in case we dump lots of code loading and initialization.
59
60
  * `:timer => nil` by default. Set it true if you want to know how much time spent in tracing and drawing tree. Notice the `file` should be appendable, otherwise the time will overwrite the tree.
60
61
  * `:debug => nil` by default. Give it somthing like what for `:tmp` to output a whole list of TracePoints in file for debug.
61
62
 
@@ -8,11 +8,16 @@ require 'trace_tree/args'
8
8
  require 'trace_tree/tmp_file'
9
9
  require 'trace_tree/timer'
10
10
  require 'trace_tree/config'
11
+ require 'trace_tree/warm'
11
12
  require 'thread'
12
13
  require 'terminal-tableofhashes'
13
14
 
14
15
  class Binding
15
16
  def trace_tree *log, **opt, &to_do
17
+ if (key = opt[:warm]) && !TraceTree::Warm.check_and_warm(key)
18
+ return yield
19
+ end
20
+
16
21
  TraceTree.new(self).generate *log, **opt, &to_do
17
22
  end
18
23
  end
@@ -1,3 +1,3 @@
1
1
  class TraceTree
2
- VERSION = "0.2.16"
2
+ VERSION = "0.2.17"
3
3
  end
@@ -0,0 +1,20 @@
1
+ require 'set'
2
+
3
+ class TraceTree
4
+ module Warm
5
+
6
+ Warmed = Set.new
7
+ Lock = Mutex.new
8
+
9
+ class << self
10
+ def check_and_warm key
11
+ Lock.synchronize do
12
+ warmed = Warmed.include? key
13
+ Warmed << key unless warmed
14
+ warmed
15
+ end
16
+ end
17
+ end
18
+
19
+ end
20
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: trace_tree
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.16
4
+ version: 0.2.17
5
5
  platform: ruby
6
6
  authors:
7
7
  - ken
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-10-19 00:00:00.000000000 Z
11
+ date: 2019-10-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -177,6 +177,7 @@ files:
177
177
  - lib/trace_tree/tree_graphable.rb
178
178
  - lib/trace_tree/tree_htmlable.rb
179
179
  - lib/trace_tree/version.rb
180
+ - lib/trace_tree/warm.rb
180
181
  - trace_tree.gemspec
181
182
  homepage: https://github.com/turnon/trace_tree
182
183
  licenses: