Files
totk-pc-recomp/runtime/prof.h
T
Wellington Dias 1d51343ac1 Build and run the runtime natively on Linux.
Shared runtime code now goes through runtime/platform/platform.h, implemented by platform/win32.c and a new
platform/linux.c: futex locks, a userfaultfd and PAGEMAP_SCAN write watch, signal-based async preemption, our own
fiber switch, and a SIGSEGV handler for the thaw and crash hooks. The window, input, menu and software keyboard get
SDL3 back ends beside the Win32 ones, with the swapchain (gfx_present.c) and input merging (input.c) shared. SHA-256
replaces BCrypt, ELF builds get their own override sections, and the build tools gain Linux branches.

On Linux the selftest and the gfx-abi, astc, nvn and window probes pass. probe-vkmem still fails: imported guest
memory cannot be write-watched on Linux, which the shadow buffers in vk_memory.c will address.
2026-10-29 16:56:56 -03:00

13 lines
785 B
C

// Between perf.c (frame timing, always built) and the OS's sampling profiler (prof_win.c on Windows).
#pragma once
#include <stdint.h>
extern volatile uint32_t prof_render_tid; // the thread that presents (perf_present)
extern volatile uint32_t prof_main_tid; // the guest main thread (perf_main_thread)
extern volatile uint32_t prof_replay_tid; // the asynchronous replay (perf_replay_thread): its waits hold up the frame too
// The sampler; perf.c's weak versions do nothing.
int prof_sampler_start(void); // TOTK_PROFILE: starts sampling; 1 when it runs
void prof_sampler_write(void); // writes the profile once (prof_write)
void prof_sampler_frame(uint64_t frame, uint64_t now, uint64_t d); // every present; d: the interval, 0 on the first