stack_tracy 0.1.5 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.rdoc +4 -0
- data/README.md +4 -4
- data/VERSION +1 -1
- data/ext/stack_tracy/stack_tracy.c +16 -13
- data/lib/stack_tracy/version.rb +1 -1
- data/stack_tracy.gemspec +1 -1
- data/test/unit/test_tracy.rb +18 -0
- data/ui/assets/stack_tracy.js +1 -1
- metadata +2 -2
data/CHANGELOG.rdoc
CHANGED
@@ -1,5 +1,9 @@
|
|
1
1
|
= StackTracy CHANGELOG
|
2
2
|
|
3
|
+
== Version 0.1.6 (August 28, 2012)
|
4
|
+
|
5
|
+
* Always logging trace messages (despite of the :only and/or :exclude options)
|
6
|
+
|
3
7
|
== Version 0.1.5 (August 28, 2012)
|
4
8
|
|
5
9
|
* Being able to add trace messages for recognition of executed code (use +String.tracy+)
|
data/README.md
CHANGED
@@ -80,9 +80,9 @@ A couple of examples:
|
|
80
80
|
* `:only => "Foo* Kernel"` records `Foo`, `Foo::Bar`, `Foo::CandyBar` and `Kernel`
|
81
81
|
* `:exclude => :core` records everything except for Ruby core classes and modules (see [stack_tracy.rb](https://github.com/archan937/stack_tracy/blob/master/lib/stack_tracy.rb#L16) for more details)
|
82
82
|
|
83
|
-
###
|
83
|
+
### Adding trace messages
|
84
84
|
|
85
|
-
Sometimes you want to add marks to the stack tree in order to recognize certain events. You can do this by adding trace messages
|
85
|
+
Sometimes you want to add marks to the stack tree in order to recognize certain events. You can do this by adding trace messages with the `String#tracy` method:
|
86
86
|
|
87
87
|
[1] pry(main)> stack_tracy(:print) do
|
88
88
|
[1] pry(main)* "Putting string".tracy
|
@@ -139,7 +139,7 @@ When the amount of calls within the stack trace exceeds the specified `:limit`,
|
|
139
139
|
|
140
140
|
When applying the `:threshold`, calls with a duration **below** the `:threshold` will be folded at default within the stack tree which saves **a lot** of heavy browser rendering on page load as the 'child calls' will be rendered as comment. See [this commit](https://github.com/archan937/stack_tracy/commit/0bb49669015b44cd24715988bf9f7e4cf03a5dad) for more information.
|
141
141
|
|
142
|
-
As of version v0.1.5, `StackTracy.open` (and thus the CLI) is provided with the options `:messages_only` and `:slows_only`. When having set `:messages_only` to `true`, the
|
142
|
+
As of version v0.1.5, `StackTracy.open` (and thus the CLI) is provided with the options `:messages_only` and `:slows_only`. When having set `:messages_only` to `true`, the stack tree will only include trace messages. If you have set `:slows_only` to `true`, then the stack tree will only include slow calls (duration > threshold) **and** trace messages.
|
143
143
|
|
144
144
|
### Using recorded stack events
|
145
145
|
|
@@ -399,7 +399,7 @@ The StackTracy repo is provided with `script/console` which you can use for deve
|
|
399
399
|
Run the following command in your console:
|
400
400
|
|
401
401
|
$ script/console
|
402
|
-
Loading development environment (StackTracy 0.1.
|
402
|
+
Loading development environment (StackTracy 0.1.6)
|
403
403
|
[1] pry(main)> stack_tracy :print do
|
404
404
|
[1] pry(main)* puts "testing"
|
405
405
|
[1] pry(main)* end
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.6
|
@@ -68,7 +68,7 @@ static void stack_tracy_trap(rb_event_flag_t event, NODE *node, VALUE self, ID i
|
|
68
68
|
#endif
|
69
69
|
{
|
70
70
|
int i;
|
71
|
-
bool singleton = false, match = false;
|
71
|
+
bool singleton = false, trace_message = false, match = false;
|
72
72
|
EventInfo info;
|
73
73
|
|
74
74
|
if (event == RUBY_EVENT_CALL || event == RUBY_EVENT_C_CALL) {
|
@@ -101,22 +101,25 @@ static void stack_tracy_trap(rb_event_flag_t event, NODE *node, VALUE self, ID i
|
|
101
101
|
info.method = (ID *) id;
|
102
102
|
|
103
103
|
if (info.method != NULL) {
|
104
|
-
|
104
|
+
trace_message = klass == rbString && id == rbTracy;
|
105
|
+
info.object = (VALUE *)(singleton || trace_message ? self : klass);
|
105
106
|
|
106
107
|
if (info.object) {
|
107
|
-
|
108
|
-
|
109
|
-
|
108
|
+
if (!trace_message) {
|
109
|
+
for (i = 0; i < exclude_size; i++) {
|
110
|
+
if (((VALUE) exclude[i].klass) == (VALUE) info.object) {
|
111
|
+
return;
|
112
|
+
}
|
110
113
|
}
|
111
|
-
}
|
112
114
|
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
115
|
+
if (only_size > 0) {
|
116
|
+
match = false;
|
117
|
+
for (i = 0; i < only_size; i++) {
|
118
|
+
match = match || (((VALUE) only[i].klass) == (VALUE) info.object);
|
119
|
+
}
|
120
|
+
if (!match) {
|
121
|
+
return;
|
122
|
+
}
|
120
123
|
}
|
121
124
|
}
|
122
125
|
|
data/lib/stack_tracy/version.rb
CHANGED
data/stack_tracy.gemspec
CHANGED
@@ -13,7 +13,7 @@ Gem::Specification.new do |gem|
|
|
13
13
|
gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
14
14
|
gem.name = "stack_tracy"
|
15
15
|
gem.require_paths = ["lib"]
|
16
|
-
gem.version = "0.1.
|
16
|
+
gem.version = "0.1.6"
|
17
17
|
|
18
18
|
gem.add_dependency "rich_support", "~> 0.1.2"
|
19
19
|
gem.add_dependency "launchy", "2.1.0"
|
data/test/unit/test_tracy.rb
CHANGED
@@ -187,6 +187,24 @@ module Unit
|
|
187
187
|
hash.delete(:time)
|
188
188
|
end
|
189
189
|
}
|
190
|
+
|
191
|
+
stack_tracy :only => "Kernel" do
|
192
|
+
"Doing something".tracy do
|
193
|
+
puts "testing"
|
194
|
+
end
|
195
|
+
end
|
196
|
+
file, line = __FILE__, __LINE__ - 3
|
197
|
+
|
198
|
+
assert_equal [
|
199
|
+
{:event => "call", :file => string_file, :line => 2, :singleton => false, :object => "Doing something", :method => "tracy", :call => "\"Doing something\"", :depth => 0},
|
200
|
+
{:event => "c-call", :file => file, :line => line, :singleton => false, :object => Kernel, :method => "puts" , :call => "Kernel#puts", :depth => 1}
|
201
|
+
], StackTracy.select.collect{ |event_info|
|
202
|
+
event_info.to_hash.tap do |hash|
|
203
|
+
assert hash.delete(:nsec)
|
204
|
+
assert hash.delete(:duration)
|
205
|
+
hash.delete(:time)
|
206
|
+
end
|
207
|
+
}
|
190
208
|
end
|
191
209
|
|
192
210
|
it "should filter methods as expected" do
|
data/ui/assets/stack_tracy.js
CHANGED
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: stack_tracy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.1.
|
5
|
+
version: 0.1.6
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Paul Engel
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2012-08-
|
13
|
+
date: 2012-08-28 00:00:00 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rich_support
|