test-prof-autopilot 0.1.0.pre.1 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/test_prof/autopilot/stack_prof/report.rb +70 -23
- data/lib/test_prof/autopilot/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 254d657c3dc55ab41d3834aa7470be97aa17bf27130e8073849784519ba41dc2
|
4
|
+
data.tar.gz: 1311b34585cbaa6ca232bb2e718abe4f7e69ab04a563458ca479037d2fb6d48a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 467db9623c7dea50c2689849b3afe2e1b994c8e3ed05bcb8a4de7dcbcb7279e6d6c9be0cff0880bc2651006e6ce46d606299f55214931f34944ab1ded3ae5fa1
|
7
|
+
data.tar.gz: 144c90bcecb8bc2780606d85c3029883667f6fa2c9a27b191f783d823c19e66698c7062cb5f24621a09cb466005c060c19fa375ef59e8be57b0dccbfea73d77c
|
data/CHANGELOG.md
CHANGED
@@ -24,32 +24,53 @@ module TestProf
|
|
24
24
|
end
|
25
25
|
|
26
26
|
def merge(other)
|
27
|
-
|
28
|
-
|
29
|
-
frames =
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
edges = hash[id][:edges] ||= {}
|
38
|
-
f2[id][:edges].each do |edge, weight|
|
39
|
-
edges[edge] ||= 0
|
40
|
-
edges[edge] += weight
|
41
|
-
end
|
27
|
+
ids_mapping = generate_ids_mapping(data[:frames], other.data[:frames])
|
28
|
+
|
29
|
+
frames = data[:frames].dup
|
30
|
+
|
31
|
+
other.data[:frames].each do |id, new_frame|
|
32
|
+
frame =
|
33
|
+
if ids_mapping[id]
|
34
|
+
frames[ids_mapping[id]]
|
35
|
+
else
|
36
|
+
frames[id] = empty_frame_from(new_frame)
|
42
37
|
end
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
38
|
+
|
39
|
+
frame[:total_samples] += new_frame[:total_samples]
|
40
|
+
frame[:samples] += new_frame[:samples]
|
41
|
+
|
42
|
+
if new_frame[:edges]
|
43
|
+
edges = (frame[:edges] ||= {})
|
44
|
+
|
45
|
+
new_frame[:edges].each do |edge, weight|
|
46
|
+
old_edge = ids_mapping[edge]
|
47
|
+
|
48
|
+
if edges[old_edge]
|
49
|
+
edges[old_edge] += weight
|
50
|
+
else
|
51
|
+
edges[old_edge] = weight
|
47
52
|
end
|
48
53
|
end
|
49
|
-
else
|
50
|
-
hash[id] = f1[id]
|
51
54
|
end
|
52
|
-
|
55
|
+
|
56
|
+
if new_frame[:lines]
|
57
|
+
lines = (frame[:lines] ||= {})
|
58
|
+
|
59
|
+
new_frame[:lines].each do |line, weight|
|
60
|
+
old_line = ids_mapping[line]
|
61
|
+
|
62
|
+
lines[old_line] =
|
63
|
+
if lines[old_line]
|
64
|
+
add_lines(lines[old_line], weight)
|
65
|
+
else
|
66
|
+
weight
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
converted_raw = other.data[:raw].map do |raw|
|
73
|
+
ids_mapping[raw] || raw
|
53
74
|
end
|
54
75
|
|
55
76
|
d1, d2 = data, other.data
|
@@ -62,12 +83,38 @@ module TestProf
|
|
62
83
|
missed_samples: d1[:missed_samples] + d2[:missed_samples],
|
63
84
|
metadata: d1[:metadata].merge(d2[:metadata]),
|
64
85
|
frames: frames,
|
65
|
-
raw: d1[:raw] +
|
86
|
+
raw: d1[:raw] + converted_raw,
|
66
87
|
raw_timestamp_deltas: d1[:raw_timestamp_deltas] + d2[:raw_timestamp_deltas]
|
67
88
|
}
|
68
89
|
|
69
90
|
self.class.new(data)
|
70
91
|
end
|
92
|
+
|
93
|
+
def generate_ids_mapping(frames, other_frames)
|
94
|
+
old_fingerprints = frames_to_fingerprints(frames)
|
95
|
+
new_fingerprints = frames_to_fingerprints(other_frames)
|
96
|
+
|
97
|
+
new_fingerprints.each_with_object({}) do |(fingerprint, frame), hash|
|
98
|
+
next hash unless old_fingerprints[fingerprint]
|
99
|
+
|
100
|
+
hash[frame[:id]] = old_fingerprints[fingerprint][:id]
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
104
|
+
def frames_to_fingerprints(frames)
|
105
|
+
frames.each_with_object({}) do |(id, frame), hash|
|
106
|
+
fingerprint = [frame[:name], frame[:file], frame[:line]].compact.map(&:to_s).join("/")
|
107
|
+
hash[fingerprint] = frame.merge(id: id)
|
108
|
+
hash
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
112
|
+
def empty_frame_from(frame)
|
113
|
+
frame.slice(:name, :file, :line).merge(
|
114
|
+
total_samples: 0,
|
115
|
+
samples: 0
|
116
|
+
)
|
117
|
+
end
|
71
118
|
end
|
72
119
|
end
|
73
120
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: test-prof-autopilot
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ruslan Shakirov
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2023-11-
|
12
|
+
date: 2023-11-21 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: test-prof
|
@@ -149,9 +149,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
149
149
|
version: '2.7'
|
150
150
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
151
151
|
requirements:
|
152
|
-
- - "
|
152
|
+
- - ">="
|
153
153
|
- !ruby/object:Gem::Version
|
154
|
-
version:
|
154
|
+
version: '0'
|
155
155
|
requirements: []
|
156
156
|
rubygems_version: 3.4.20
|
157
157
|
signing_key:
|