switch to data size formatter

This commit is contained in:
Nikita Smith
2024-11-12 10:36:45 -08:00
parent 880d7a4139
commit 2bbf3ff987
2 changed files with 16 additions and 29 deletions
+4 -10
View File
@@ -56,10 +56,7 @@ lnk_write_file(void *raw_handle, uint64_t offset, void *buffer, uint64_t buffer_
internal void
lnk_log_read(String8 path, U64 size)
{
Temp scratch = scratch_begin(0,0);
String8 size_str = str8_from_memory_size(scratch.arena, size);
lnk_log(LNK_Log_IO_Read, "Read from \"%S\" %S", path, size_str);
scratch_end(scratch);
lnk_log(LNK_Log_IO_Read, "Read from \"%S\" %M", path, size);
}
internal String8
@@ -171,7 +168,7 @@ lnk_write_data_list_to_file_path(String8 path, String8List data)
#if PROFILE_TELEMETRY
{
Temp scratch = scratch_begin(0, 0);
String8 size_str = str8_from_memory_size2(scratch.arena, data.total_size);
String8 size_str = str8_from_memory_size(scratch.arena, data.total_size);
ProfBeginDynamic("Write %.*s to %.*s", str8_varg(size_str), str8_varg(path));
scratch_end(scratch);
}
@@ -194,13 +191,10 @@ lnk_write_data_list_to_file_path(String8 path, String8List data)
is_written = (offset == data.total_size);
if (is_written) {
if (lnk_get_log_status(LNK_Log_IO_Write)) {
Temp scratch = scratch_begin(0,0);
String8 size_str = str8_from_memory_size(scratch.arena, data.total_size);
lnk_log(LNK_Log_IO_Write, "File \"%S\" %S written", path, size_str);
scratch_end(scratch);
lnk_log(LNK_Log_IO_Write, "File \"%S\" %M written", path, data.total_size);
}
} else {
lnk_error(LNK_Error_IO, "incomplete write occurred, %u bytes written, expected %u bytes, file %S",
lnk_error(LNK_Error_IO, "incomplete write occurred, %M written, expected %M, file %S",
offset, data.total_size, path);
}
} else {