Merge pull request #1920

da3eae2 Dynamic monerod --max-concurrency, max 6 (xmrdsc)
This commit is contained in:
luigi1111 2019-02-01 01:09:04 -06:00
commit f8008002f6
No known key found for this signature in database
GPG key ID: F4ACA0183641E010
3 changed files with 9 additions and 5 deletions

View file

@ -298,7 +298,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

View file

@ -101,13 +101,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
@ -124,7 +124,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)
}
}
@ -135,7 +135,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)
}
}

View file

@ -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;