summaryrefslogtreecommitdiff
path: root/os/os.h
diff options
context:
space:
mode:
authorJens Axboe <jens.axboe@oracle.com>2009-04-29 09:48:04 +0200
committerJens Axboe <jens.axboe@oracle.com>2009-04-29 09:48:04 +0200
commiteb7ccf38bf2e9208b593d021c50e9ad2ec0781ea (patch)
tree823b60d286cdeaa556a6e6d243a516f1b7ebdc1c /os/os.h
parentc311cd2a9e3ca77f4d2cb2f6dd8bd08185e8c0f6 (diff)
downloadfio-eb7ccf38bf2e9208b593d021c50e9ad2ec0781ea.tar.gz
fio-eb7ccf38bf2e9208b593d021c50e9ad2ec0781ea.tar.bz2
Align io units to processor cache line size
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'os/os.h')
-rw-r--r--os/os.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/os/os.h b/os/os.h
index 5a3bc559..dbf09571 100644
--- a/os/os.h
+++ b/os/os.h
@@ -90,4 +90,20 @@ static inline int load_blktrace(struct thread_data *td, const char *fname)
}
#endif
+#define FIO_DEF_CL_SIZE 128
+
+static inline int os_cache_line_size(void)
+{
+#ifdef FIO_HAVE_CL_SIZE
+ int ret = arch_cache_line_size();
+
+ if (ret <= 0)
+ return FIO_DEF_CL_SIZE;
+
+ return ret;
+#else
+ return FIO_DEF_CL_SIZE;
+#endif
+}
+
#endif