Add support for idletime profiling
[fio.git] / os / os-linux.h
index 4e837da93720c34e5960b0c1e298a703b0fb08de..acc5a202aa80fc611bb11ed0bfa7421eaeaece6b 100644 (file)
@@ -35,6 +35,7 @@
 #define FIO_HAVE_TRIM
 #define FIO_HAVE_BINJECT
 #define FIO_HAVE_GETTID
+#define FIO_HAVE_SCHED_IDLE
 #define FIO_USE_GENERIC_INIT_RANDOM_STATE
 
 #ifdef MAP_HUGETLB
@@ -246,4 +247,10 @@ static inline int os_trim(int fd, unsigned long long start,
        return errno;
 }
 
+static inline int fio_set_sched_idle(void)
+{
+       struct sched_param p = { .sched_priority = 0, };
+       return sched_setscheduler(gettid(), SCHED_IDLE, &p);
+}
+
 #endif