mirror of
https://github.com/monero-project/monero-gui
synced 2024-11-28 09:31:37 +01:00
Dynamic monerod --max-concurrency, max 6
This commit is contained in:
parent
9689fff957
commit
da3eae20f0
2
main.cpp
2
main.cpp
@ -290,7 +290,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
engine.rootContext()->setContextProperty("defaultAccountName", accountName);
|
||||
engine.rootContext()->setContextProperty("applicationDirectory", QApplication::applicationDirPath());
|
||||
engine.rootContext()->setContextProperty("numberMiningThreadsAvailable", QThread::idealThreadCount());
|
||||
engine.rootContext()->setContextProperty("idealThreadCount", QThread::idealThreadCount());
|
||||
|
||||
bool builtWithScanner = false;
|
||||
#ifdef WITH_SCANNER
|
||||
|
@ -100,13 +100,13 @@ Rectangle {
|
||||
id: soloMinerThreadsLine
|
||||
Layout.preferredWidth: 200 * scaleRatio
|
||||
text: "1"
|
||||
validator: IntValidator { bottom: 1; top: numberMiningThreadsAvailable }
|
||||
validator: IntValidator { bottom: 1; top: idealThreadCount }
|
||||
}
|
||||
}
|
||||
|
||||
Text {
|
||||
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
|
||||
Layout.leftMargin: 125 * scaleRatio
|
||||
font.family: MoneroComponents.Style.fontRegular.name
|
||||
@ -123,7 +123,7 @@ Rectangle {
|
||||
text: qsTr("Use recommended # of threads") + translationManager.emptyString
|
||||
enabled: startSoloMinerButton.enabled
|
||||
onClicked: {
|
||||
soloMinerThreadsLine.text = Math.floor(numberMiningThreadsAvailable / 2);
|
||||
soloMinerThreadsLine.text = Math.floor(idealThreadCount / 2);
|
||||
appWindow.showStatusMessage(qsTr("Set to use recommended # of threads"),3)
|
||||
}
|
||||
}
|
||||
@ -134,7 +134,7 @@ Rectangle {
|
||||
text: qsTr("Use all threads") + translationManager.emptyString
|
||||
enabled: startSoloMinerButton.enabled
|
||||
onClicked: {
|
||||
soloMinerThreadsLine.text = numberMiningThreadsAvailable
|
||||
soloMinerThreadsLine.text = idealThreadCount
|
||||
appWindow.showStatusMessage(qsTr("Set to use all threads"),3)
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
#include "DaemonManager.h"
|
||||
#include <QFile>
|
||||
#include <QThread>
|
||||
#include <QFileInfo>
|
||||
#include <QDir>
|
||||
#include <QDebug>
|
||||
@ -72,7 +73,10 @@ bool DaemonManager::start(const QString &flags, NetworkType::Type nettype, const
|
||||
|
||||
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() << "With command line arguments " << arguments;
|
||||
|
Loading…
Reference in New Issue
Block a user