vernier 0.4.0 → 0.5.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 +4 -4
- data/ext/vernier/vernier.cc +8 -17
- data/lib/vernier/output/firefox.rb +20 -1
- data/lib/vernier/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f552d6fe2d529de743412cbc9975bfbd4ac87b894777a44ce26ef07dddc8e032
|
4
|
+
data.tar.gz: b9ddcd3e4ce0acb5ac53363e041d1bd9e3a2d4c5bf21b2bbe56c48ed5fef4cdd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1b0808ee6ae8e64866e81e7ba8ed4847788421a00517c00e7aacb54c2fdff16287f92eb10132b5802fcb93955c3e4cf1a8fe4cfc97f4a9742a8130341bea75f7
|
7
|
+
data.tar.gz: 686a7397043be44451cccf9380473cda1e350ee342878ca2428d8bcd6c69aeea36244d15c92e3f998d4b6245c46c37d74ac3aac18ed58c783c288501d0cf7243
|
data/ext/vernier/vernier.cc
CHANGED
@@ -853,13 +853,12 @@ class Thread {
|
|
853
853
|
markers->record_interval(Marker::Type::MARKER_THREAD_RUNNING, from, now);
|
854
854
|
break;
|
855
855
|
case State::STOPPED:
|
856
|
-
// We can go from RUNNING or STARTED to STOPPED
|
857
|
-
assert(state == State::RUNNING || state == State::STARTED);
|
856
|
+
// We can go from RUNNING or STARTED or SUSPENDED to STOPPED
|
857
|
+
assert(state == State::RUNNING || state == State::STARTED || state == State::SUSPENDED);
|
858
858
|
markers->record_interval(Marker::Type::MARKER_THREAD_RUNNING, from, now);
|
859
859
|
markers->record(Marker::Type::MARKER_GVL_THREAD_EXITED);
|
860
860
|
|
861
861
|
stopped_at = now;
|
862
|
-
capture_name();
|
863
862
|
|
864
863
|
break;
|
865
864
|
}
|
@@ -872,13 +871,6 @@ class Thread {
|
|
872
871
|
return state != State::STOPPED;
|
873
872
|
}
|
874
873
|
|
875
|
-
void capture_name() {
|
876
|
-
//char buf[128];
|
877
|
-
//int rc = pthread_getname_np(pthread_id, buf, sizeof(buf));
|
878
|
-
//if (rc == 0)
|
879
|
-
// name = std::string(buf);
|
880
|
-
}
|
881
|
-
|
882
874
|
void mark() {
|
883
875
|
}
|
884
876
|
};
|
@@ -1082,6 +1074,12 @@ class RetainedCollector : public BaseCollector {
|
|
1082
1074
|
void record(VALUE obj) {
|
1083
1075
|
RawSample sample;
|
1084
1076
|
sample.sample();
|
1077
|
+
if (sample.empty()) {
|
1078
|
+
// During thread allocation we allocate one object without a frame
|
1079
|
+
// (as of Ruby 3.3)
|
1080
|
+
// Ideally we'd allow empty samples to be represented
|
1081
|
+
return;
|
1082
|
+
}
|
1085
1083
|
int stack_index = frame_list.stack_index(sample);
|
1086
1084
|
|
1087
1085
|
object_list.push_back(obj);
|
@@ -1496,13 +1494,6 @@ class TimeCollector : public BaseCollector {
|
|
1496
1494
|
rb_remove_event_hook(internal_gc_event_cb);
|
1497
1495
|
rb_remove_event_hook(internal_thread_event_cb);
|
1498
1496
|
|
1499
|
-
// capture thread names
|
1500
|
-
for (auto& thread: this->threads.list) {
|
1501
|
-
if (thread.running()) {
|
1502
|
-
thread.capture_name();
|
1503
|
-
}
|
1504
|
-
}
|
1505
|
-
|
1506
1497
|
frame_list.finalize();
|
1507
1498
|
|
1508
1499
|
VALUE result = build_collector_result();
|
@@ -163,7 +163,7 @@ module Vernier
|
|
163
163
|
@profile = profile
|
164
164
|
@categorizer = categorizer
|
165
165
|
@tid = tid
|
166
|
-
@name = name
|
166
|
+
@name = pretty_name(name)
|
167
167
|
|
168
168
|
timestamps ||= [0] * samples.size
|
169
169
|
@samples, @weights, @timestamps = samples, weights, timestamps
|
@@ -385,6 +385,25 @@ module Vernier
|
|
385
385
|
|
386
386
|
private
|
387
387
|
|
388
|
+
def pretty_name(name)
|
389
|
+
if name.empty?
|
390
|
+
begin
|
391
|
+
tr = ObjectSpace._id2ref(@ruby_thread_id)
|
392
|
+
name = tr.inspect if tr
|
393
|
+
rescue RangeError
|
394
|
+
# Thread was already GC'd
|
395
|
+
end
|
396
|
+
end
|
397
|
+
return name unless name.start_with?("#<Thread")
|
398
|
+
pretty = []
|
399
|
+
obj_address = name[/Thread:(0x\w+)/,1]
|
400
|
+
best_id = name[/\#<Thread:0x\w+@?\s?(.*)\s+\S+>/,1] || ""
|
401
|
+
Gem.path.each { |gem_dir| best_id = best_id.gsub(gem_dir, "...") }
|
402
|
+
pretty << best_id unless best_id.empty?
|
403
|
+
pretty << "(#{obj_address})"
|
404
|
+
pretty.join(' ')
|
405
|
+
end
|
406
|
+
|
388
407
|
def gc_category
|
389
408
|
@categorizer.get_category("GC")
|
390
409
|
end
|
data/lib/vernier/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vernier
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Hawthorn
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-02-27 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: An experimental profiler
|
14
14
|
email:
|