File refill_buffers.patch of Package kdiskmark
From ac688f3cafab2a96b893986ab653de887f5ee4ab Mon Sep 17 00:00:00 2001
From: Vadim Averin <vadim@avevad.com>
Date: Sat, 27 Sep 2025 23:39:41 +0300
Subject: [PATCH] Add new configuration option for enabling/disabling
`--refill_buffers`
---
src/appsettings.cpp | 11 +++++++++++
src/appsettings.h | 4 ++++
src/benchmark.cpp | 1 +
src/helper.cpp | 10 ++++++----
src/helper.h | 13 +++++++++----
src/mainwindow.cpp | 5 +++++
src/mainwindow.h | 2 ++
src/mainwindow.ui | 10 ++++++++++
8 files changed, 48 insertions(+), 8 deletions(-)
diff --git a/src/appsettings.cpp b/src/appsettings.cpp
index af52c6e..0acf5e0 100644
--- a/src/appsettings.cpp
+++ b/src/appsettings.cpp
@@ -222,6 +222,17 @@ bool AppSettings::defaultCacheBypassState()
{
return true;
}
+bool AppSettings::getContinuousGenerationState() const {
+ return m_settings->value(QStringLiteral("Benchmark/ContinuousGeneration"), defaultContinuousGenerationState()).toBool();
+}
+
+void AppSettings::setContinuousGenerationState(bool continuousGenerationState) {
+ m_settings->setValue(QStringLiteral("Benchmark/ContinuousGeneration"), continuousGenerationState);
+}
+
+bool AppSettings::defaultContinuousGenerationState() {
+ return false;
+}
bool AppSettings::getFlusingCacheState() const
{
diff --git a/src/appsettings.h b/src/appsettings.h
index 49f35f4..7711448 100644
--- a/src/appsettings.h
+++ b/src/appsettings.h
@@ -67,6 +67,10 @@ class AppSettings : public QObject
void setCacheBypassState(bool cacheBypassState);
static bool defaultCacheBypassState();
+ bool getContinuousGenerationState() const;
+ void setContinuousGenerationState(bool continuousGenerationState);
+ static bool defaultContinuousGenerationState();
+
bool getFlusingCacheState() const;
void setFlushingCacheState(bool flushingCacheState);
static bool defaultFlushingCacheState();
diff --git a/src/benchmark.cpp b/src/benchmark.cpp
index 7e22e0a..4d56e5a 100644
--- a/src/benchmark.cpp
+++ b/src/benchmark.cpp
@@ -70,6 +70,7 @@ void Benchmark::startTest(int blockSize, int queueDepth, int threads, const QStr
settings.getRandomReadPercentage(),
settings.getBenchmarkTestData() == Global::BenchmarkTestData::Zeros,
settings.getCacheBypassState(),
+ settings.getContinuousGenerationState(),
blockSize, queueDepth, threads, rw));
if (!isRunning()) return;
diff --git a/src/helper.cpp b/src/helper.cpp
index bdbd4b0..734b0c4 100644
--- a/src/helper.cpp
+++ b/src/helper.cpp
@@ -35,10 +35,12 @@ QVariantMap HelperAdaptor::prepareBenchmarkFile(const QString &benchmarkFile, in
return m_parentHelper->prepareBenchmarkFile(benchmarkFile, fileSize, fillZeros);
}
-QVariantMap HelperAdaptor::startBenchmarkTest(int measuringTime, int fileSize, int randomReadPercentage, bool fillZeros, bool cacheBypass,
+QVariantMap HelperAdaptor::startBenchmarkTest(int measuringTime, int fileSize, int randomReadPercentage, bool fillZeros, bool cacheBypass, bool continuousGeneration,
int blockSize, int queueDepth, int threads, const QString &rw)
{
- return m_parentHelper->startBenchmarkTest(measuringTime, fileSize, randomReadPercentage, fillZeros, cacheBypass, blockSize, queueDepth, threads, rw);
+ return m_parentHelper->startBenchmarkTest(
+ measuringTime, fileSize, randomReadPercentage, fillZeros, cacheBypass,
+ continuousGeneration, blockSize, queueDepth, threads, rw);
}
QVariantMap HelperAdaptor::flushPageCache()
@@ -203,7 +205,7 @@ QVariantMap Helper::prepareBenchmarkFile(const QString &benchmarkPath, int fileS
return {{"success", true}};
}
-QVariantMap Helper::startBenchmarkTest(int measuringTime, int fileSize, int randomReadPercentage, bool fillZeros, bool cacheBypass,
+QVariantMap Helper::startBenchmarkTest(int measuringTime, int fileSize, int randomReadPercentage, bool fillZeros, bool cacheBypass, bool continuousGeneration,
int blockSize, int queueDepth, int threads, const QString &rw)
{
if (!isCallerAuthorized()) {
@@ -219,7 +221,7 @@ QVariantMap Helper::startBenchmarkTest(int measuringTime, int fileSize, int rand
<< QStringLiteral("--output-format=json")
<< QStringLiteral("--ioengine=libaio")
<< QStringLiteral("--randrepeat=0")
- << QStringLiteral("--refill_buffers")
+ << QStringLiteral("--refill_buffers=%1").arg(continuousGeneration)
<< QStringLiteral("--end_fsync=1")
<< QStringLiteral("--direct=%1").arg(cacheBypass)
<< QStringLiteral("--rwmixread=%1").arg(randomReadPercentage)
diff --git a/src/helper.h b/src/helper.h
index 50ca950..62dd4c9 100644
--- a/src/helper.h
+++ b/src/helper.h
@@ -21,8 +21,10 @@ public slots:
Q_SCRIPTABLE QVariantMap initSession();
Q_SCRIPTABLE QVariantMap endSession();
Q_SCRIPTABLE QVariantMap prepareBenchmarkFile(const QString &benchmarkPath, int fileSize, bool fillZeros);
- Q_SCRIPTABLE QVariantMap startBenchmarkTest(int measuringTime, int fileSize, int randomReadPercentage, bool fillZeros, bool cacheBypass,
- int blockSize, int queueDepth, int threads, const QString &rw);
+ Q_SCRIPTABLE QVariantMap startBenchmarkTest(
+ int measuringTime, int fileSize, int randomReadPercentage,
+ bool fillZeros, bool cacheBypass, bool continuousGeneration,
+ int blockSize, int queueDepth, int threads, const QString &rw);
Q_SCRIPTABLE QVariantMap flushPageCache();
Q_SCRIPTABLE QVariantMap removeBenchmarkFile();
Q_SCRIPTABLE QVariantMap stopCurrentTask();
@@ -47,8 +49,11 @@ class Helper : public QObject, public QDBusContext
QVariantMap initSession();
QVariantMap endSession();
QVariantMap prepareBenchmarkFile(const QString &benchmarkPath, int fileSize, bool fillZeros);
- QVariantMap startBenchmarkTest(int measuringTime, int fileSize, int randomReadPercentage, bool fillZeros, bool cacheBypass,
- int blockSize, int queueDepth, int threads, const QString &rw);
+ QVariantMap startBenchmarkTest(int measuringTime, int fileSize,
+ int randomReadPercentage, bool fillZeros,
+ bool cacheBypass, bool continuousGeneration,
+ int blockSize, int queueDepth, int threads,
+ const QString &rw);
QVariantMap flushPageCache();
QVariantMap removeBenchmarkFile();
QVariantMap stopCurrentTask();
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index 0d0662c..a332d4a 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -165,6 +165,7 @@ MainWindow::MainWindow(QWidget *parent)
ui->comboBox_MixRatio->setCurrentIndex(indexMixRatio);
ui->actionTestData_Zeros->setChecked(settings.getBenchmarkTestData() == Global::BenchmarkTestData::Zeros);
+ ui->actionTestData_Continuous->setChecked(settings.getContinuousGenerationState());
ui->actionRead_Mix->setChecked(settings.getBenchmarkMode() == Global::BenchmarkMode::ReadMix);
ui->actionWrite_Mix->setChecked(settings.getBenchmarkMode() == Global::BenchmarkMode::WriteMix);
@@ -395,6 +396,10 @@ void MainWindow::on_actionUse_O_DIRECT_triggered(bool checked)
AppSettings().setCacheBypassState(checked);
}
+void MainWindow::on_actionTestData_Continuous_triggered(bool checked) {
+ AppSettings().setContinuousGenerationState(checked);
+}
+
void MainWindow::on_actionFlush_Pagecache_triggered(bool checked)
{
AppSettings().setFlushingCacheState(checked);
diff --git a/src/mainwindow.h b/src/mainwindow.h
index 6f38cca..1538003 100644
--- a/src/mainwindow.h
+++ b/src/mainwindow.h
@@ -57,6 +57,8 @@ private slots:
void on_actionUse_O_DIRECT_triggered(bool checked);
+ void on_actionTestData_Continuous_triggered(bool checked);
+
void on_actionCoW_detection_triggered(bool checked);
private:
diff --git a/src/mainwindow.ui b/src/mainwindow.ui
index d34f46b..a0e2f92 100644
--- a/src/mainwindow.ui
+++ b/src/mainwindow.ui
@@ -1030,6 +1030,8 @@
</property>
<addaction name="actionTestData_Random"/>
<addaction name="actionTestData_Zeros"/>
+ <addaction name="separator"/>
+ <addaction name="actionTestData_Continuous"/>
</widget>
<addaction name="menuTest_Data"/>
<addaction name="separator"/>
@@ -1303,6 +1305,14 @@
<string>CoW detection</string>
</property>
</action>
+ <action name="actionTestData_Continuous">
+ <property name="checkable">
+ <bool>true</bool>
+ </property>
+ <property name="text">
+ <string>Continuous generation</string>
+ </property>
+ </action>
</widget>
<tabstops>
<tabstop>pushButton_All</tabstop>