X-Git-Url: https://git.kernel.dk/?p=fio.git;a=blobdiff_plain;f=os%2Fos-windows.h;h=09f9c5438d2ff1580d16ab2b5586da488866b648;hp=f68f654c8c832ba8be0aea618d3b622c7377cc48;hb=cab2440c23426b06e7e8327c5353fbd8373dcb5a;hpb=836fcc0fceb233ebcc41ee63b4ea5cae20b678a4 diff --git a/os/os-windows.h b/os/os-windows.h index f68f654c..09f9c543 100644 --- a/os/os-windows.h +++ b/os/os-windows.h @@ -20,9 +20,6 @@ #define FIO_HAVE_ODIRECT #define FIO_HAVE_CPU_AFFINITY #define FIO_HAVE_CHARDEV_SIZE -#define FIO_HAVE_FDATASYNC -#define FIO_HAVE_WINDOWSAIO -#define FIO_HAVE_FALLOCATE #define FIO_HAVE_GETTID #define FIO_USE_GENERIC_RAND @@ -154,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) @@ -250,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 */