Commit 79fefec599

Jakub Konka <kubkon@jakubkonka.com>
2024-07-21 21:14:57
add more tracy hooks
1 parent 5973337
Changed files (4)
src/link/MachO/CodeSignature.zig
@@ -7,6 +7,7 @@ const log = std.log.scoped(.link);
 const macho = std.macho;
 const mem = std.mem;
 const testing = std.testing;
+const trace = @import("../../tracy.zig").trace;
 const Allocator = mem.Allocator;
 const Hasher = @import("hasher.zig").ParallelHasher;
 const MachO = @import("../MachO.zig");
@@ -264,6 +265,9 @@ pub fn writeAdhocSignature(
     opts: WriteOpts,
     writer: anytype,
 ) !void {
+    const tracy = trace(@src());
+    defer tracy.end();
+
     const allocator = macho_file.base.comp.gpa;
 
     var header: macho.SuperBlob = .{
src/link/MachO/hasher.zig
@@ -55,6 +55,8 @@ pub fn ParallelHasher(comptime Hasher: type) type {
             out: *[hash_size]u8,
             err: *fs.File.PReadError!usize,
         ) void {
+            const tracy = trace(@src());
+            defer tracy.end();
             err.* = file.preadAll(buffer, fstart);
             Hasher.hash(buffer, out, .{});
         }
src/link/MachO.zig
@@ -2387,6 +2387,9 @@ fn resizeSections(self: *MachO) !void {
 }
 
 fn writeSectionsAndUpdateLinkeditSizes(self: *MachO) !void {
+    const tracy = trace(@src());
+    defer tracy.end();
+
     const gpa = self.base.comp.gpa;
 
     const cmd = self.symtab_cmd;
@@ -3513,6 +3516,8 @@ pub fn getTarget(self: MachO) std.Target {
 /// the original file. This is super messy, but there doesn't seem any other
 /// way to please the XNU.
 pub fn invalidateKernelCache(dir: fs.Dir, sub_path: []const u8) !void {
+    const tracy = trace(@src());
+    defer tracy.end();
     if (comptime builtin.target.isDarwin() and builtin.target.cpu.arch == .aarch64) {
         try dir.copyFile(sub_path, dir, sub_path, .{});
     }
src/main.zig
@@ -211,6 +211,9 @@ fn verifyLibcxxCorrectlyLinked() void {
 }
 
 fn mainArgs(gpa: Allocator, arena: Allocator, args: []const []const u8) !void {
+    const tr = tracy.trace(@src());
+    defer tr.end();
+
     if (args.len <= 1) {
         std.log.info("{s}", .{usage});
         fatal("expected command argument", .{});