Datasets:
Download verification/observer.c from PureOne/ChronoSheaf-Input-Lag: direct link, hf CLI and curl.
- Browser
- Download file 948 Bytes
-
https://huggingface.co/datasets/PureOne/ChronoSheaf-Input-Lag/resolve/main/verification/observer.c
- Command line
-
hf download hf://datasets/PureOne/ChronoSheaf-Input-Lag/verification/observer.c
-
curl -L -o observer.c https://huggingface.co/datasets/PureOne/ChronoSheaf-Input-Lag/resolve/main/verification/observer.c
948 Bytes
| /* Inside both comparison paths. Timestamp the real SDL return before the | |
| candidate can wait. This boundary is a software clock, not optical scanout. */ | |
| static _Thread_local int64_t observed; | |
| static unsigned count; | |
| __attribute__((destructor)) static void finish_count(void) { | |
| const char *path=getenv("XR_FIXTURE_COUNT"); | |
| if(path) { FILE *f=fopen(path,"w"); if(f) { fprintf(f,"%u\n",count); fclose(f); } } | |
| } | |
| int64_t xr_last_underlying_us(void) { return observed; } | |
| void SDL_RenderPresent(void *renderer) { | |
| typedef void (*fn)(void *); | |
| static fn next; | |
| if (!next) *(void **)(&next)=dlsym(RTLD_NEXT,"SDL_RenderPresent"); | |
| if (!next) abort(); | |
| next(renderer); | |
| ++count; | |
| struct timespec ts; | |
| if (clock_gettime(CLOCK_MONOTONIC,&ts)) abort(); | |
| observed=(int64_t)ts.tv_sec*1000000+ts.tv_nsec/1000; | |
| } | |