mirror of
https://github.com/xmrig/xmrig.git
synced 2024-11-18 00:37:46 +00:00
Revert Platform::setProcessPriority
This commit is contained in:
parent
dbb721cb5e
commit
4a9a7434f6
5 changed files with 49 additions and 0 deletions
|
@ -51,6 +51,7 @@ public:
|
||||||
static uint32_t setTimerResolution(uint32_t resolution);
|
static uint32_t setTimerResolution(uint32_t resolution);
|
||||||
static void init(const char *userAgent);
|
static void init(const char *userAgent);
|
||||||
static void restoreTimerResolution();
|
static void restoreTimerResolution();
|
||||||
|
static void setProcessPriority(int priority);
|
||||||
static void setThreadPriority(int priority);
|
static void setThreadPriority(int priority);
|
||||||
|
|
||||||
static inline const char *userAgent() { return m_userAgent; }
|
static inline const char *userAgent() { return m_userAgent; }
|
||||||
|
|
|
@ -83,6 +83,11 @@ void xmrig::Platform::restoreTimerResolution()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void xmrig::Platform::setProcessPriority(int)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void xmrig::Platform::setThreadPriority(int priority)
|
void xmrig::Platform::setThreadPriority(int priority)
|
||||||
{
|
{
|
||||||
if (priority == -1) {
|
if (priority == -1) {
|
||||||
|
|
|
@ -111,6 +111,11 @@ void xmrig::Platform::restoreTimerResolution()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void xmrig::Platform::setProcessPriority(int)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void xmrig::Platform::setThreadPriority(int priority)
|
void xmrig::Platform::setThreadPriority(int priority)
|
||||||
{
|
{
|
||||||
if (priority == -1) {
|
if (priority == -1) {
|
||||||
|
|
|
@ -131,6 +131,43 @@ void xmrig::Platform::restoreTimerResolution()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void xmrig::Platform::setProcessPriority(int priority)
|
||||||
|
{
|
||||||
|
if (priority == -1) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
DWORD prio = IDLE_PRIORITY_CLASS;
|
||||||
|
switch (priority)
|
||||||
|
{
|
||||||
|
case 1:
|
||||||
|
prio = BELOW_NORMAL_PRIORITY_CLASS;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 2:
|
||||||
|
prio = NORMAL_PRIORITY_CLASS;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 3:
|
||||||
|
prio = ABOVE_NORMAL_PRIORITY_CLASS;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 4:
|
||||||
|
prio = HIGH_PRIORITY_CLASS;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 5:
|
||||||
|
prio = REALTIME_PRIORITY_CLASS;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
SetPriorityClass(GetCurrentProcess(), prio);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void xmrig::Platform::setThreadPriority(int priority)
|
void xmrig::Platform::setThreadPriority(int priority)
|
||||||
{
|
{
|
||||||
if (priority == -1) {
|
if (priority == -1) {
|
||||||
|
|
|
@ -262,6 +262,7 @@ xmrig::Miner::Miner(Controller *controller)
|
||||||
{
|
{
|
||||||
const int priority = controller->config()->cpu().priority();
|
const int priority = controller->config()->cpu().priority();
|
||||||
if (priority >= 0) {
|
if (priority >= 0) {
|
||||||
|
Platform::setProcessPriority(priority);
|
||||||
Platform::setThreadPriority(std::min(priority + 1, 5));
|
Platform::setThreadPriority(std::min(priority + 1, 5));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue