authorgravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2024-07-21 21:14:57+02:00
committergravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2024-07-22 12:06:02+02:00
log79fefec599fd940adfd611c9da880c01e2aa842c
tree81f72fa8bfcf00e4efaf48b51ffbb0f68b3b6273
parent59733374ed5a629f0109016663a6d79fbfab5129

add more tracy hooks


4 files changed, 14 insertions(+), 0 deletions(-)

src/link/MachO.zig+5
...@@ -2387,6 +2387,9 @@ fn resizeSections(self: *MachO) !void {...@@ -2387,6 +2387,9 @@ fn resizeSections(self: *MachO) !void {
2387}2387}
23882388
2389fn writeSectionsAndUpdateLinkeditSizes(self: *MachO) !void {2389fn writeSectionsAndUpdateLinkeditSizes(self: *MachO) !void {
2390 const tracy = trace(@src());
2391 defer tracy.end();
2392
2390 const gpa = self.base.comp.gpa;2393 const gpa = self.base.comp.gpa;
23912394
2392 const cmd = self.symtab_cmd;2395 const cmd = self.symtab_cmd;
...@@ -3513,6 +3516,8 @@ pub fn getTarget(self: MachO) std.Target {...@@ -3513,6 +3516,8 @@ pub fn getTarget(self: MachO) std.Target {
3513/// the original file. This is super messy, but there doesn't seem any other3516/// the original file. This is super messy, but there doesn't seem any other
3514/// way to please the XNU.3517/// way to please the XNU.
3515pub fn invalidateKernelCache(dir: fs.Dir, sub_path: []const u8) !void {3518pub fn invalidateKernelCache(dir: fs.Dir, sub_path: []const u8) !void {
3519 const tracy = trace(@src());
3520 defer tracy.end();
3516 if (comptime builtin.target.isDarwin() and builtin.target.cpu.arch == .aarch64) {3521 if (comptime builtin.target.isDarwin() and builtin.target.cpu.arch == .aarch64) {
3517 try dir.copyFile(sub_path, dir, sub_path, .{});3522 try dir.copyFile(sub_path, dir, sub_path, .{});
3518 }3523 }
src/link/MachO/CodeSignature.zig+4
...@@ -7,6 +7,7 @@ const log = std.log.scoped(.link);...@@ -7,6 +7,7 @@ const log = std.log.scoped(.link);
7const macho = std.macho;7const macho = std.macho;
8const mem = std.mem;8const mem = std.mem;
9const testing = std.testing;9const testing = std.testing;
10const trace = @import("../../tracy.zig").trace;
10const Allocator = mem.Allocator;11const Allocator = mem.Allocator;
11const Hasher = @import("hasher.zig").ParallelHasher;12const Hasher = @import("hasher.zig").ParallelHasher;
12const MachO = @import("../MachO.zig");13const MachO = @import("../MachO.zig");
...@@ -264,6 +265,9 @@ pub fn writeAdhocSignature(...@@ -264,6 +265,9 @@ pub fn writeAdhocSignature(
264 opts: WriteOpts,265 opts: WriteOpts,
265 writer: anytype,266 writer: anytype,
266) !void {267) !void {
268 const tracy = trace(@src());
269 defer tracy.end();
270
267 const allocator = macho_file.base.comp.gpa;271 const allocator = macho_file.base.comp.gpa;
268272
269 var header: macho.SuperBlob = .{273 var header: macho.SuperBlob = .{
src/link/MachO/hasher.zig+2
...@@ -55,6 +55,8 @@ pub fn ParallelHasher(comptime Hasher: type) type {...@@ -55,6 +55,8 @@ pub fn ParallelHasher(comptime Hasher: type) type {
55 out: *[hash_size]u8,55 out: *[hash_size]u8,
56 err: *fs.File.PReadError!usize,56 err: *fs.File.PReadError!usize,
57 ) void {57 ) void {
58 const tracy = trace(@src());
59 defer tracy.end();
58 err.* = file.preadAll(buffer, fstart);60 err.* = file.preadAll(buffer, fstart);
59 Hasher.hash(buffer, out, .{});61 Hasher.hash(buffer, out, .{});
60 }62 }
src/main.zig+3
...@@ -211,6 +211,9 @@ fn verifyLibcxxCorrectlyLinked() void {...@@ -211,6 +211,9 @@ fn verifyLibcxxCorrectlyLinked() void {
211}211}
212212
213fn mainArgs(gpa: Allocator, arena: Allocator, args: []const []const u8) !void {213fn mainArgs(gpa: Allocator, arena: Allocator, args: []const []const u8) !void {
214 const tr = tracy.trace(@src());
215 defer tr.end();
216
214 if (args.len <= 1) {217 if (args.len <= 1) {
215 std.log.info("{s}", .{usage});218 std.log.info("{s}", .{usage});
216 fatal("expected command argument", .{});219 fatal("expected command argument", .{});