diff --git a/runtime/gfx_window.c b/runtime/gfx_window.c index a679701a..378abcb5 100644 --- a/runtime/gfx_window.c +++ b/runtime/gfx_window.c @@ -217,6 +217,7 @@ static LRESULT CALLBACK wnd_proc(HWND h, UINT m, WPARAM w, LPARAM l) { // The process ends with the window, as in MNG. Save writes go straight to files (runtime/fs_host.c). rt_log("gfx: window closed; exiting"); vk_pipeline_save(); + prof_write(); // ExitProcess runs no atexit handlers ExitProcess(0); case WM_ERASEBKGND: return 1; diff --git a/runtime/svc.c b/runtime/svc.c index 9efb5401..8454885a 100644 --- a/runtime/svc.c +++ b/runtime/svc.c @@ -200,11 +200,12 @@ void rt_svc(Cpu *c, uint32_t imm, uint64_t pc) { return; } case 0x29: get_info(c, pc); return; - case 0x07: { // ExitProcess, as closing the window (gfx_window.c WM_CLOSE): pipeline cache and shader records - // saved, logs flushed, exit code 0 + case 0x07: { // ExitProcess, as closing the window (gfx_window.c WM_CLOSE): pipeline cache, shader records and + // profile saved, logs flushed, exit code 0 char at[160]; rt_log("guest ExitProcess at %s; exiting", ldr_describe(pc, at, sizeof at)); vk_pipeline_save(); + prof_write(); fflush(NULL); if (svc_test_exit_hook) return svc_test_exit_hook(0); ExitProcess(0);