diff --git a/runtime/boot.c b/runtime/boot.c index 74b4d299..3471ee3f 100644 --- a/runtime/boot.c +++ b/runtime/boot.c @@ -34,6 +34,7 @@ static const InitCount inits_143[] = {{"main", 10717}, {"subsdk0", 45}, {"sdk", #define expected_inits (RT_V143 ? inits_143 : inits_121) static volatile LONG inits_done, checkpoint_seen; +uint64_t rt_guest_start_ns; static const RtLoaded *module_named(const char *name) { for (int i = 0; i < ldr_count(); i++) @@ -354,6 +355,7 @@ void rt_boot(void) { n = {.LowPart = now.dwLowDateTime, .HighPart = now.dwHighDateTime}; rt_log("boot: guest starts %llu ms after process start (%llu ms of it waiting for the prewarm)", (unsigned long long)((n.QuadPart - c.QuadPart) / 10000), (unsigned long long)held); + rt_guest_start_ns = kern_now_ns(); kern_run_on_guest_main(guest_main); rt_fatal("boot: the guest main thread ended"); } diff --git a/runtime/frame_rate.c b/runtime/frame_rate.c index c5c2818b..bb360bf8 100644 --- a/runtime/frame_rate.c +++ b/runtime/frame_rate.c @@ -231,8 +231,9 @@ static void world_clock(double dt, double step) { if (w < 0) { float p[3]; if (!player_pos(p) || fabsf(p[0]) + fabsf(p[2]) < 1.0f) return; // a few guest reads, until the load ends - rt_log("frame step: world clock starts at present %llu (the player at %.1f %.1f %.1f)", - (unsigned long long)presents, p[0], p[1], p[2]); + rt_log("frame step: world clock starts at present %llu, %.2f s after the guest started (the player at %.1f %.1f %.1f)", + (unsigned long long)presents, rt_guest_start_ns ? (kern_now_ns() - rt_guest_start_ns) / 1e9 : 0.0, p[0], + p[1], p[2]); atomic_store_explicit(&world_us, 0, memory_order_relaxed); return; } diff --git a/runtime/host.h b/runtime/host.h index 7376d834..a8919153 100644 --- a/runtime/host.h +++ b/runtime/host.h @@ -208,6 +208,7 @@ void kern_bind_system_event(Cpu *c, uint64_t ev, int autoclear); // guest thre void kern_signal_system_event(uint64_t ev); // any thread int kern_svc(Cpu *c, uint32_t imm); // thread/sync SVCs; 1 if handled uint64_t kern_now_ns(void); +extern uint64_t rt_guest_start_ns; // kern_now_ns when the guest started (boot.c), 0 before typedef struct { uint64_t svcs, threads, host_calls; } RtStats; RtStats rt_stats(void); // host_calls: hostfn_calls()