diff options
author | 2023-05-08 01:44:50 -0700 | |
---|---|---|
committer | 2023-05-08 01:44:50 -0700 | |
commit | 3f895085a0e3cd4eb27ed69273595326d6cceb04 (patch) | |
tree | b92f4b91b026b43f06b3f3d0c20ab11ca2d8980b | |
parent | 81e4203efecc0ec386f5d02c93699e6615b4abeb (diff) | |
download | bun-3f895085a0e3cd4eb27ed69273595326d6cceb04.tar.gz bun-3f895085a0e3cd4eb27ed69273595326d6cceb04.tar.zst bun-3f895085a0e3cd4eb27ed69273595326d6cceb04.zip |
[fs] More logging
-rw-r--r-- | src/cache.zig | 4 | ||||
-rw-r--r-- | src/fs.zig | 4 |
2 files changed, 8 insertions, 0 deletions
diff --git a/src/cache.zig b/src/cache.zig index 7d0803c02..6a33211d5 100644 --- a/src/cache.zig +++ b/src/cache.zig @@ -54,6 +54,7 @@ pub const Set = struct { }; } }; +const debug = Output.scoped(.fs, false); pub const Fs = struct { const Entry = FsCacheEntry; @@ -179,9 +180,12 @@ pub const Fs = struct { } } + debug("openat({d}, {s}) = {d}", .{ dirname_fd, path, file_handle.handle }); + const will_close = rfs.needToCloseFiles() and _file_handle == null; defer { if (will_close) { + debug("close({d})", .{file_handle.handle}); file_handle.close(); } } diff --git a/src/fs.zig b/src/fs.zig index ae2a9e352..ea33062de 100644 --- a/src/fs.zig +++ b/src/fs.zig @@ -22,6 +22,7 @@ const allocators = @import("./allocators.zig"); pub const MAX_PATH_BYTES = bun.MAX_PATH_BYTES; pub const PathBuffer = [bun.MAX_PATH_BYTES]u8; +const debug = Output.scoped(.fs, false); // pub const FilesystemImplementation = @import("fs_impl.zig"); @@ -959,6 +960,7 @@ pub const FileSystem = struct { fs.readFileError(path, err); return err; }); + debug("stat({d}) = {d}", .{ file.handle, size }); // Skip the pread call for empty files // Otherwise will get out of bounds errors @@ -997,6 +999,7 @@ pub const FileSystem = struct { }; shared_buffer.list.items = shared_buffer.list.items[0 .. read_count + offset]; file_contents = shared_buffer.list.items; + debug("pread({d}, {d}) = {d}", .{ file.handle, size, read_count }); if (comptime stream) { // check again that stat() didn't change the file size @@ -1028,6 +1031,7 @@ pub const FileSystem = struct { return err; }; file_contents = buf[0..read_count]; + debug("pread({d}, {d}) = {d}", .{ file.handle, size, read_count }); } return File{ .path = Path.init(path), .contents = file_contents }; |