Skip to content

Commit e7f0230

Browse files
authored
Merge pull request #176 from avevad/refill-buffers-fix
Add new configuration option for enabling/disabling `--refill_buffers` (Closes #175)
2 parents 4401da2 + ac688f3 commit e7f0230

8 files changed

Lines changed: 48 additions & 8 deletions

File tree

src/appsettings.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,17 @@ bool AppSettings::defaultCacheBypassState()
222222
{
223223
return true;
224224
}
225+
bool AppSettings::getContinuousGenerationState() const {
226+
return m_settings->value(QStringLiteral("Benchmark/ContinuousGeneration"), defaultContinuousGenerationState()).toBool();
227+
}
228+
229+
void AppSettings::setContinuousGenerationState(bool continuousGenerationState) {
230+
m_settings->setValue(QStringLiteral("Benchmark/ContinuousGeneration"), continuousGenerationState);
231+
}
232+
233+
bool AppSettings::defaultContinuousGenerationState() {
234+
return false;
235+
}
225236

226237
bool AppSettings::getFlusingCacheState() const
227238
{

src/appsettings.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,10 @@ class AppSettings : public QObject
6767
void setCacheBypassState(bool cacheBypassState);
6868
static bool defaultCacheBypassState();
6969

70+
bool getContinuousGenerationState() const;
71+
void setContinuousGenerationState(bool continuousGenerationState);
72+
static bool defaultContinuousGenerationState();
73+
7074
bool getFlusingCacheState() const;
7175
void setFlushingCacheState(bool flushingCacheState);
7276
static bool defaultFlushingCacheState();

src/benchmark.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ void Benchmark::startTest(int blockSize, int queueDepth, int threads, const QStr
7070
settings.getRandomReadPercentage(),
7171
settings.getBenchmarkTestData() == Global::BenchmarkTestData::Zeros,
7272
settings.getCacheBypassState(),
73+
settings.getContinuousGenerationState(),
7374
blockSize, queueDepth, threads, rw));
7475

7576
if (!isRunning()) return;

src/helper.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,12 @@ QVariantMap HelperAdaptor::prepareBenchmarkFile(const QString &benchmarkFile, in
3535
return m_parentHelper->prepareBenchmarkFile(benchmarkFile, fileSize, fillZeros);
3636
}
3737

38-
QVariantMap HelperAdaptor::startBenchmarkTest(int measuringTime, int fileSize, int randomReadPercentage, bool fillZeros, bool cacheBypass,
38+
QVariantMap HelperAdaptor::startBenchmarkTest(int measuringTime, int fileSize, int randomReadPercentage, bool fillZeros, bool cacheBypass, bool continuousGeneration,
3939
int blockSize, int queueDepth, int threads, const QString &rw)
4040
{
41-
return m_parentHelper->startBenchmarkTest(measuringTime, fileSize, randomReadPercentage, fillZeros, cacheBypass, blockSize, queueDepth, threads, rw);
41+
return m_parentHelper->startBenchmarkTest(
42+
measuringTime, fileSize, randomReadPercentage, fillZeros, cacheBypass,
43+
continuousGeneration, blockSize, queueDepth, threads, rw);
4244
}
4345

4446
QVariantMap HelperAdaptor::flushPageCache()
@@ -203,7 +205,7 @@ QVariantMap Helper::prepareBenchmarkFile(const QString &benchmarkPath, int fileS
203205
return {{"success", true}};
204206
}
205207

206-
QVariantMap Helper::startBenchmarkTest(int measuringTime, int fileSize, int randomReadPercentage, bool fillZeros, bool cacheBypass,
208+
QVariantMap Helper::startBenchmarkTest(int measuringTime, int fileSize, int randomReadPercentage, bool fillZeros, bool cacheBypass, bool continuousGeneration,
207209
int blockSize, int queueDepth, int threads, const QString &rw)
208210
{
209211
if (!isCallerAuthorized()) {
@@ -219,7 +221,7 @@ QVariantMap Helper::startBenchmarkTest(int measuringTime, int fileSize, int rand
219221
<< QStringLiteral("--output-format=json")
220222
<< QStringLiteral("--ioengine=libaio")
221223
<< QStringLiteral("--randrepeat=0")
222-
<< QStringLiteral("--refill_buffers")
224+
<< QStringLiteral("--refill_buffers=%1").arg(continuousGeneration)
223225
<< QStringLiteral("--end_fsync=1")
224226
<< QStringLiteral("--direct=%1").arg(cacheBypass)
225227
<< QStringLiteral("--rwmixread=%1").arg(randomReadPercentage)

src/helper.h

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,10 @@ public slots:
2121
Q_SCRIPTABLE QVariantMap initSession();
2222
Q_SCRIPTABLE QVariantMap endSession();
2323
Q_SCRIPTABLE QVariantMap prepareBenchmarkFile(const QString &benchmarkPath, int fileSize, bool fillZeros);
24-
Q_SCRIPTABLE QVariantMap startBenchmarkTest(int measuringTime, int fileSize, int randomReadPercentage, bool fillZeros, bool cacheBypass,
25-
int blockSize, int queueDepth, int threads, const QString &rw);
24+
Q_SCRIPTABLE QVariantMap startBenchmarkTest(
25+
int measuringTime, int fileSize, int randomReadPercentage,
26+
bool fillZeros, bool cacheBypass, bool continuousGeneration,
27+
int blockSize, int queueDepth, int threads, const QString &rw);
2628
Q_SCRIPTABLE QVariantMap flushPageCache();
2729
Q_SCRIPTABLE QVariantMap removeBenchmarkFile();
2830
Q_SCRIPTABLE QVariantMap stopCurrentTask();
@@ -47,8 +49,11 @@ class Helper : public QObject, public QDBusContext
4749
QVariantMap initSession();
4850
QVariantMap endSession();
4951
QVariantMap prepareBenchmarkFile(const QString &benchmarkPath, int fileSize, bool fillZeros);
50-
QVariantMap startBenchmarkTest(int measuringTime, int fileSize, int randomReadPercentage, bool fillZeros, bool cacheBypass,
51-
int blockSize, int queueDepth, int threads, const QString &rw);
52+
QVariantMap startBenchmarkTest(int measuringTime, int fileSize,
53+
int randomReadPercentage, bool fillZeros,
54+
bool cacheBypass, bool continuousGeneration,
55+
int blockSize, int queueDepth, int threads,
56+
const QString &rw);
5257
QVariantMap flushPageCache();
5358
QVariantMap removeBenchmarkFile();
5459
QVariantMap stopCurrentTask();

src/mainwindow.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@ MainWindow::MainWindow(QWidget *parent)
165165
ui->comboBox_MixRatio->setCurrentIndex(indexMixRatio);
166166

167167
ui->actionTestData_Zeros->setChecked(settings.getBenchmarkTestData() == Global::BenchmarkTestData::Zeros);
168+
ui->actionTestData_Continuous->setChecked(settings.getContinuousGenerationState());
168169
ui->actionRead_Mix->setChecked(settings.getBenchmarkMode() == Global::BenchmarkMode::ReadMix);
169170
ui->actionWrite_Mix->setChecked(settings.getBenchmarkMode() == Global::BenchmarkMode::WriteMix);
170171

@@ -395,6 +396,10 @@ void MainWindow::on_actionUse_O_DIRECT_triggered(bool checked)
395396
AppSettings().setCacheBypassState(checked);
396397
}
397398

399+
void MainWindow::on_actionTestData_Continuous_triggered(bool checked) {
400+
AppSettings().setContinuousGenerationState(checked);
401+
}
402+
398403
void MainWindow::on_actionFlush_Pagecache_triggered(bool checked)
399404
{
400405
AppSettings().setFlushingCacheState(checked);

src/mainwindow.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ private slots:
5757

5858
void on_actionUse_O_DIRECT_triggered(bool checked);
5959

60+
void on_actionTestData_Continuous_triggered(bool checked);
61+
6062
void on_actionCoW_detection_triggered(bool checked);
6163

6264
private:

src/mainwindow.ui

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1030,6 +1030,8 @@
10301030
</property>
10311031
<addaction name="actionTestData_Random"/>
10321032
<addaction name="actionTestData_Zeros"/>
1033+
<addaction name="separator"/>
1034+
<addaction name="actionTestData_Continuous"/>
10331035
</widget>
10341036
<addaction name="menuTest_Data"/>
10351037
<addaction name="separator"/>
@@ -1303,6 +1305,14 @@
13031305
<string>CoW detection</string>
13041306
</property>
13051307
</action>
1308+
<action name="actionTestData_Continuous">
1309+
<property name="checkable">
1310+
<bool>true</bool>
1311+
</property>
1312+
<property name="text">
1313+
<string>Continuous generation</string>
1314+
</property>
1315+
</action>
13061316
</widget>
13071317
<tabstops>
13081318
<tabstop>pushButton_All</tabstop>

0 commit comments

Comments
 (0)