diff --git a/main.cpp b/main.cpp index 43b1f5a6..34eb67d1 100644 --- a/main.cpp +++ b/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 diff --git a/pages/Mining.qml b/pages/Mining.qml index c53992c0..1b88071e 100644 --- a/pages/Mining.qml +++ b/pages/Mining.qml @@ -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) } } diff --git a/src/daemon/DaemonManager.cpp b/src/daemon/DaemonManager.cpp index 79db8cff..09507a4a 100644 --- a/src/daemon/DaemonManager.cpp +++ b/src/daemon/DaemonManager.cpp @@ -1,5 +1,6 @@ #include "DaemonManager.h" #include +#include #include #include #include @@ -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;