diff options
Diffstat (limited to 'src/Kind.zig')
| -rw-r--r-- | src/Kind.zig | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/Kind.zig b/src/Kind.zig index db3bee49..27cd1a6d 100644 --- a/src/Kind.zig +++ b/src/Kind.zig @@ -279,6 +279,8 @@ pub fn reopen(p: ?*Pardes, id: usize, s: *Slot, bytes: ?[]const u8) bool { // Its file not read (not here): it waits for it, a placeholder. if (s.ops != null and bytes == null and s.path.len > 0) _ = cl.refused.print("{s} is not here", .{s.path}) else if (s.ops) |ops| { const path_z = s.arena.allocator().dupeSentinel(u8, s.path, 0) catch ""; + // (the budget's from here: the file's hash and the tag are the core's) + if (checked) cl.began = @import("FrameStats.zig").nowNs(); cl.opening = true; if (ops.open) |f| s.st = f(if (s.path.len > 0) path_z.ptr else null, if (bytes) |b| b.ptr else null, if (bytes) |b| b.len else 0); cl.opening = false; @@ -917,7 +919,8 @@ const Call = struct { return o; } }; -var current: ?*Call = null; +/// (The loop's: a job on a worker is in none.) +threadlocal var current: ?*Call = null; /// A call's budget, in Debug: a frame (17.4; 2 ms in ReleaseFast, which /// Debug's kinds run three to four times slower than). @@ -1052,6 +1055,12 @@ pub const api: c.pa_api = .{ .heap = struct { /// `heap`'s, any thread: realloc's, n 0 a free. fn f(ptr: ?*anyopaque, n: usize) callconv(.c) ?*anyopaque { + // Its time the core's, as an arena's is (a region's first + // allocation in Debug took 23 ms of a PDF's open). + const t0 = if (checked) @import("FrameStats.zig").nowNs(); + defer if (checked) if (current) |cl| { + cl.began += @import("FrameStats.zig").nowNs() -| t0; + }; if (n == 0) { kind_heap.free(ptr); return null; |
