From bd5e03474650983ac609d1c3b44a5aa0750fa225 Mon Sep 17 00:00:00 2001 From: Lizonghang <870644199@qq.com> Date: Wed, 4 Dec 2024 00:55:50 +0400 Subject: [PATCH] set fio engine to sync if posixaio not loadable --- common/profiler.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/common/profiler.cpp b/common/profiler.cpp index 5c40a4ef..f7a11c80 100644 --- a/common/profiler.cpp +++ b/common/profiler.cpp @@ -733,16 +733,18 @@ numjobs=%d const char * write_type = op_rand ? "randwrite" : "write"; const char * block_size = op_rand ? page_size_str : readahead_str; - const char * ioengine = "posixaio"; - bool retry_with_sync = false; + const char * ioengine = "posixaio"; + bool retry_with_sync = false; + const char * output_file = "fio_output.log"; + const char * conf_file = "config.fio"; do { char fio_conf[1024]; snprintf(fio_conf, sizeof(fio_conf), fio_conf_template, ioengine, - read_type, block_size, test_file, n_threads, + read_type, block_size, test_file, n_threads, write_type, block_size, test_file, n_threads); - const char * conf_file = "config.fio"; + std::ofstream conf(conf_file); if (!conf) { LOG_INF("Error: Unable to create configuration file\n"); @@ -751,7 +753,6 @@ numjobs=%d conf << fio_conf; conf.close(); - const char * output_file = "fio_output.log"; std::string command = "fio " + std::string(conf_file) + " > " + std::string(output_file) + " 2>&1"; int ret = std::system(command.c_str());