X-Git-Url: https://git.kernel.dk/?a=blobdiff_plain;f=os%2Fos-windows.h;h=09f9c5438d2ff1580d16ab2b5586da488866b648;hb=3dc1e5b28bc4d9b673fe81fc4884b1a621ffe9de;hp=64808bb980ad5a9052267d95d7038896b1fa4e65;hpb=4700b23465687c7d3de7820341fa96e506e967b2;p=fio.git diff --git a/os/os-windows.h b/os/os-windows.h index 64808bb9..09f9c543 100644 --- a/os/os-windows.h +++ b/os/os-windows.h @@ -20,7 +20,6 @@ #define FIO_HAVE_ODIRECT #define FIO_HAVE_CPU_AFFINITY #define FIO_HAVE_CHARDEV_SIZE -#define FIO_HAVE_FDATASYNC #define FIO_HAVE_GETTID #define FIO_USE_GENERIC_RAND @@ -152,12 +151,14 @@ static inline int blockdev_invalidate_cache(struct fio_file *f) static inline unsigned long long os_phys_mem(void) { - SYSTEM_INFO sysInfo; - uintptr_t addr; + long pagesize, pages; - GetSystemInfo(&sysInfo); - addr = (uintptr_t)sysInfo.lpMaximumApplicationAddress; - return (unsigned long long)addr; + pagesize = sysconf(_SC_PAGESIZE); + pages = sysconf(_SC_PHYS_PAGES); + if (pages == -1 || pagesize == -1) + return 0; + + return (unsigned long long) pages * (unsigned long long) pagesize; } static inline void os_get_tmpdir(char *path, int len) @@ -248,4 +249,11 @@ static inline int init_random_state(struct thread_data *td, unsigned long *rand_ } +static inline int fio_set_sched_idle(void) +{ + /* SetThreadPriority returns nonzero for success */ + return (SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_IDLE))? 0 : -1; +} + + #endif /* FIO_OS_WINDOWS_H */