mirror of
https://github.com/monero-project/monero-gui.git
synced 2024-11-17 00:07:51 +00:00
Dynamic monerod --max-concurrency, max 6
This commit is contained in:
parent
9689fff957
commit
da3eae20f0
3 changed files with 9 additions and 5 deletions
2
main.cpp
2
main.cpp
|
@ -290,7 +290,7 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
engine.rootContext()->setContextProperty("defaultAccountName", accountName);
|
engine.rootContext()->setContextProperty("defaultAccountName", accountName);
|
||||||
engine.rootContext()->setContextProperty("applicationDirectory", QApplication::applicationDirPath());
|
engine.rootContext()->setContextProperty("applicationDirectory", QApplication::applicationDirPath());
|
||||||
engine.rootContext()->setContextProperty("numberMiningThreadsAvailable", QThread::idealThreadCount());
|
engine.rootContext()->setContextProperty("idealThreadCount", QThread::idealThreadCount());
|
||||||
|
|
||||||
bool builtWithScanner = false;
|
bool builtWithScanner = false;
|
||||||
#ifdef WITH_SCANNER
|
#ifdef WITH_SCANNER
|
||||||
|
|
|
@ -100,13 +100,13 @@ Rectangle {
|
||||||
id: soloMinerThreadsLine
|
id: soloMinerThreadsLine
|
||||||
Layout.preferredWidth: 200 * scaleRatio
|
Layout.preferredWidth: 200 * scaleRatio
|
||||||
text: "1"
|
text: "1"
|
||||||
validator: IntValidator { bottom: 1; top: numberMiningThreadsAvailable }
|
validator: IntValidator { bottom: 1; top: idealThreadCount }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Text {
|
Text {
|
||||||
id: numAvailableThreadsText
|
id: numAvailableThreadsText
|
||||||
text: qsTr("Max # of CPU threads available for mining: ") + numberMiningThreadsAvailable + translationManager.emptyString
|
text: qsTr("Max # of CPU threads available for mining: ") + idealThreadCount + translationManager.emptyString
|
||||||
wrapMode: Text.WordWrap
|
wrapMode: Text.WordWrap
|
||||||
Layout.leftMargin: 125 * scaleRatio
|
Layout.leftMargin: 125 * scaleRatio
|
||||||
font.family: MoneroComponents.Style.fontRegular.name
|
font.family: MoneroComponents.Style.fontRegular.name
|
||||||
|
@ -123,7 +123,7 @@ Rectangle {
|
||||||
text: qsTr("Use recommended # of threads") + translationManager.emptyString
|
text: qsTr("Use recommended # of threads") + translationManager.emptyString
|
||||||
enabled: startSoloMinerButton.enabled
|
enabled: startSoloMinerButton.enabled
|
||||||
onClicked: {
|
onClicked: {
|
||||||
soloMinerThreadsLine.text = Math.floor(numberMiningThreadsAvailable / 2);
|
soloMinerThreadsLine.text = Math.floor(idealThreadCount / 2);
|
||||||
appWindow.showStatusMessage(qsTr("Set to use recommended # of threads"),3)
|
appWindow.showStatusMessage(qsTr("Set to use recommended # of threads"),3)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -134,7 +134,7 @@ Rectangle {
|
||||||
text: qsTr("Use all threads") + translationManager.emptyString
|
text: qsTr("Use all threads") + translationManager.emptyString
|
||||||
enabled: startSoloMinerButton.enabled
|
enabled: startSoloMinerButton.enabled
|
||||||
onClicked: {
|
onClicked: {
|
||||||
soloMinerThreadsLine.text = numberMiningThreadsAvailable
|
soloMinerThreadsLine.text = idealThreadCount
|
||||||
appWindow.showStatusMessage(qsTr("Set to use all threads"),3)
|
appWindow.showStatusMessage(qsTr("Set to use all threads"),3)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
#include "DaemonManager.h"
|
#include "DaemonManager.h"
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
|
#include <QThread>
|
||||||
#include <QFileInfo>
|
#include <QFileInfo>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
@ -72,7 +73,10 @@ bool DaemonManager::start(const QString &flags, NetworkType::Type nettype, const
|
||||||
|
|
||||||
arguments << "--check-updates" << "disabled";
|
arguments << "--check-updates" << "disabled";
|
||||||
|
|
||||||
|
// --max-concurrency based on threads available. max: 6
|
||||||
|
int32_t concurrency = qBound(1, QThread::idealThreadCount() / 2, 6);
|
||||||
|
|
||||||
|
arguments << "--max-concurrency" << QString::number(concurrency);
|
||||||
|
|
||||||
qDebug() << "starting monerod " + m_monerod;
|
qDebug() << "starting monerod " + m_monerod;
|
||||||
qDebug() << "With command line arguments " << arguments;
|
qDebug() << "With command line arguments " << arguments;
|
||||||
|
|
Loading…
Reference in a new issue