[feat] Simple Disk Benchmark

This commit is contained in:
2026-06-05 19:27:41 +08:00
Unverified
parent ed7fd54e35
commit 0f344b8c3e
4 changed files with 60 additions and 13 deletions
+26
View File
@@ -196,6 +196,32 @@ extern "C" void kernel_main() {
// Compositor task (replaces the old demo tasks)
task_create("compositor", layer_compositor_task);
serial_write("Sylva: disk read benchmark...\n");
void *ttf_buf = NULL;
UINTN ttf_size = 0;
UINT64 t0 = pit_get_ticks();
EFI_STATUS rd_st = fs_read((WString)L"sys\\resources\\LXGWWenKai-Light.ttf", &ttf_buf, &ttf_size);
UINT64 t1 = pit_get_ticks();
if (EFI_ERROR(rd_st)) {
serial_write("Sylva: fs_read FAILED: ");
serial_write_hex(rd_st);
serial_write("\n");
} else {
UINT64 ticks = t1 - t0;
UINT64 ms = ticks * (1000 / PIT_TICK_HZ);
UINT64 kbps = ms ? (ttf_size * 1000ULL) / (ms * 1024ULL) : 0;
serial_write("Sylva: read ");
serial_write_hex(ttf_size);
serial_write(" bytes in ");
serial_write_hex(ms);
serial_write(" ms (");
serial_write_hex(kbps);
serial_write(" KiB/s)\n");
kfree(ttf_buf);
}
serial_write("Test done.\n\n");
serial_write("Sylva: starting preemptive scheduler\n");
scheduler_run(); // never returns
}