tangled
alpha
login
or
join now
altagos.dev
/
austin-converter
0
fork
atom
this repo has no description
0
fork
atom
overview
issues
pulls
pipelines
groundwork for partial samples
altagos.dev
8 months ago
6a920a07
b2983bf5
verified
This commit was signed with the committer's
known signature
.
altagos.dev
SSH Key Fingerprint:
SHA256:UbTjEcCZlc6GzQWLCuDK3D//HESWD2xFPkzue9XMras=
+24
-11
1 changed file
expand all
collapse all
unified
split
src
austin.zig
+24
-11
src/austin.zig
···
1
1
const std = @import("std");
2
2
const mem = std.mem;
3
3
4
4
-
pub const Sample = struct {
4
4
+
pub const Process = struct {
5
5
/// Process ID
6
6
pid: usize,
7
7
/// Sub-interpreter ID,
8
8
iid: usize,
9
9
/// Thread ID
10
10
tid: usize,
11
11
-
frames: []FrameWrapper,
12
12
-
metric: Metric,
13
13
-
};
14
14
-
15
15
-
pub const SampleWrapper = union(enum) {
16
16
-
full: Sample,
17
17
-
metric: Metric,
18
11
};
19
12
20
13
pub const Frame = struct {
···
34
27
idle_state: bool,
35
28
/// positive for memory allocations, negative for deallocations
36
29
rss_memory_delta: isize,
30
30
+
};
31
31
+
32
32
+
pub const Sample = struct {
33
33
+
process: Process,
34
34
+
frames: []FrameWrapper,
35
35
+
metric: Metric,
36
36
+
};
37
37
+
38
38
+
pub const PartialSample = struct {
39
39
+
process: Process,
40
40
+
frames: []FrameWrapper,
41
41
+
};
42
42
+
43
43
+
pub const SampleWrapper = union(enum) {
44
44
+
full: Sample,
45
45
+
partial: PartialSample,
46
46
+
metric: Metric,
37
47
};
38
48
39
49
pub const Metadata = struct {
···
201
211
202
212
// PID
203
213
const pid = data.next() orelse return ParseError.NoPID;
204
204
-
sample.pid = std.fmt.parseUnsigned(usize, pid[1..], 0) catch return ParseError.InvalidPID;
205
214
206
215
const thread_raw = data.next() orelse return ParseError.NoThreadInfo;
207
216
var thread = std.mem.tokenizeScalar(u8, thread_raw, ':');
208
217
209
218
// IID
210
219
const iid = thread.next() orelse return ParseError.NoIID;
211
211
-
sample.iid = std.fmt.parseUnsigned(usize, iid[1..], 0) catch return ParseError.InvalidIID;
212
220
213
221
// TID
214
222
const tid = thread.next() orelse return ParseError.NoTID;
215
215
-
sample.tid = std.fmt.parseUnsigned(usize, tid, 0) catch return ParseError.InvalidTID;
223
223
+
224
224
+
sample.process = .{
225
225
+
.pid = std.fmt.parseUnsigned(usize, pid[1..], 0) catch return ParseError.InvalidPID,
226
226
+
.iid = std.fmt.parseUnsigned(usize, iid[1..], 0) catch return ParseError.InvalidIID,
227
227
+
.tid = std.fmt.parseUnsigned(usize, tid, 0) catch return ParseError.InvalidTID,
228
228
+
};
216
229
217
230
// Frames
218
231
var frames: std.ArrayList(FrameWrapper) = try .initCapacity(self.arena, 1);