authorgravatar for jacobly@ziglang.orgJacob Young <jacobly@ziglang.org> 2026-01-15 21:54:07-05:00
committergravatar for jacobly@ziglang.orgJacob Young <jacobly@ziglang.org> 2026-02-09 10:47:21-05:00
logf2cbc1912b9c58c2a20b9f32fb60b7793f5e4820
tree941d4b75b39f503b1984244e077bd3e1ac0dd317
parenta28d57292f86dfdacf88453509d0b7a1a49443eb

tracy: replace `namedFrame` with `traceNamed`

It is not valid to use frames here because multiple compilations may run concurrently, and a frame with a given name must stop before starting again.

1 files changed, 13 insertions(+), 12 deletions(-)

src/Compilation.zig+13-12
...@@ -21,6 +21,7 @@ const introspect = @import("introspect.zig");...@@ -21,6 +21,7 @@ const introspect = @import("introspect.zig");
21const link = @import("link.zig");21const link = @import("link.zig");
22const tracy = @import("tracy.zig");22const tracy = @import("tracy.zig");
23const trace = tracy.trace;23const trace = tracy.trace;
24const traceNamed = tracy.traceNamed;
24const build_options = @import("build_options");25const build_options = @import("build_options");
25const LibCInstallation = std.zig.LibCInstallation;26const LibCInstallation = std.zig.LibCInstallation;
26const glibc = @import("libs/glibc.zig");27const glibc = @import("libs/glibc.zig");
...@@ -4707,8 +4708,8 @@ fn performAllTheWork(...@@ -4707,8 +4708,8 @@ fn performAllTheWork(
4707 }4708 }
47084709
4709 if (comp.zcu) |zcu| {4710 if (comp.zcu) |zcu| {
4710 const astgen_frame = tracy.namedFrame("astgen");4711 const tracy_trace = traceNamed(@src(), "astgen");
4711 defer astgen_frame.end();4712 defer tracy_trace.end();
47124713
4713 const zir_prog_node = main_progress_node.start("AST Lowering", 0);4714 const zir_prog_node = main_progress_node.start("AST Lowering", 0);
4714 defer zir_prog_node.end();4715 defer zir_prog_node.end();
...@@ -5221,8 +5222,8 @@ fn processOneJob(tid: Zcu.PerThread.Id, comp: *Compilation, job: Job) JobError!v...@@ -5221,8 +5222,8 @@ fn processOneJob(tid: Zcu.PerThread.Id, comp: *Compilation, job: Job) JobError!v
5221 try comp.link_queue.enqueueZcu(comp, tid, .{ .update_line_number = tracked_inst });5222 try comp.link_queue.enqueueZcu(comp, tid, .{ .update_line_number = tracked_inst });
5222 },5223 },
5223 .analyze_func => |func| {5224 .analyze_func => |func| {
5224 const named_frame = tracy.namedFrame("analyze_func");5225 const tracy_trace = traceNamed(@src(), "analyze_func");
5225 defer named_frame.end();5226 defer tracy_trace.end();
52265227
5227 const pt: Zcu.PerThread = .activate(comp.zcu.?, tid);5228 const pt: Zcu.PerThread = .activate(comp.zcu.?, tid);
5228 defer pt.deactivate();5229 defer pt.deactivate();
...@@ -5234,8 +5235,8 @@ fn processOneJob(tid: Zcu.PerThread.Id, comp: *Compilation, job: Job) JobError!v...@@ -5234,8 +5235,8 @@ fn processOneJob(tid: Zcu.PerThread.Id, comp: *Compilation, job: Job) JobError!v
5234 };5235 };
5235 },5236 },
5236 .analyze_comptime_unit => |unit| {5237 .analyze_comptime_unit => |unit| {
5237 const named_frame = tracy.namedFrame("analyze_comptime_unit");5238 const tracy_trace = traceNamed(@src(), "analyze_comptime_unit");
5238 defer named_frame.end();5239 defer tracy_trace.end();
52395240
5240 const pt: Zcu.PerThread = .activate(comp.zcu.?, tid);5241 const pt: Zcu.PerThread = .activate(comp.zcu.?, tid);
5241 defer pt.deactivate();5242 defer pt.deactivate();
...@@ -5274,8 +5275,8 @@ fn processOneJob(tid: Zcu.PerThread.Id, comp: *Compilation, job: Job) JobError!v...@@ -5274,8 +5275,8 @@ fn processOneJob(tid: Zcu.PerThread.Id, comp: *Compilation, job: Job) JobError!v
5274 }5275 }
5275 },5276 },
5276 .resolve_type_fully => |ty| {5277 .resolve_type_fully => |ty| {
5277 const named_frame = tracy.namedFrame("resolve_type_fully");5278 const tracy_trace = traceNamed(@src(), "resolve_type_fully");
5278 defer named_frame.end();5279 defer tracy_trace.end();
52795280
5280 const pt: Zcu.PerThread = .activate(comp.zcu.?, tid);5281 const pt: Zcu.PerThread = .activate(comp.zcu.?, tid);
5281 defer pt.deactivate();5282 defer pt.deactivate();
...@@ -5285,8 +5286,8 @@ fn processOneJob(tid: Zcu.PerThread.Id, comp: *Compilation, job: Job) JobError!v...@@ -5285,8 +5286,8 @@ fn processOneJob(tid: Zcu.PerThread.Id, comp: *Compilation, job: Job) JobError!v
5285 };5286 };
5286 },5287 },
5287 .analyze_mod => |mod| {5288 .analyze_mod => |mod| {
5288 const named_frame = tracy.namedFrame("analyze_mod");5289 const tracy_trace = traceNamed(@src(), "analyze_mod");
5289 defer named_frame.end();5290 defer tracy_trace.end();
52905291
5291 const pt: Zcu.PerThread = .activate(comp.zcu.?, tid);5292 const pt: Zcu.PerThread = .activate(comp.zcu.?, tid);
5292 defer pt.deactivate();5293 defer pt.deactivate();
...@@ -5296,8 +5297,8 @@ fn processOneJob(tid: Zcu.PerThread.Id, comp: *Compilation, job: Job) JobError!v...@@ -5296,8 +5297,8 @@ fn processOneJob(tid: Zcu.PerThread.Id, comp: *Compilation, job: Job) JobError!v
5296 };5297 };
5297 },5298 },
5298 .windows_import_lib => |index| {5299 .windows_import_lib => |index| {
5299 const named_frame = tracy.namedFrame("windows_import_lib");5300 const tracy_trace = traceNamed(@src(), "windows_import_lib");
5300 defer named_frame.end();5301 defer tracy_trace.end();
53015302
5302 const link_lib = comp.windows_libs.keys()[index];5303 const link_lib = comp.windows_libs.keys()[index];
5303 mingw.buildImportLib(comp, link_lib) catch |err| {5304 mingw.buildImportLib(comp, link_lib) catch |err| {