Merge pull request #1590 from SChernykh/dev

Activate MSR mod only for RandomX algorithms
This commit is contained in:
xmrig 2020-03-10 01:15:13 +07:00 committed by GitHub
commit 64650bf121
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -40,6 +40,7 @@ class RxPrivate;
static bool osInitialized = false; static bool osInitialized = false;
static bool msrInitialized = false;
static const char *tag = BLUE_BG(WHITE_BOLD_S " rx ") " "; static const char *tag = BLUE_BG(WHITE_BOLD_S " rx ") " ";
static RxPrivate *d_ptr = nullptr; static RxPrivate *d_ptr = nullptr;
@ -65,6 +66,10 @@ const char *xmrig::rx_tag()
bool xmrig::Rx::init(const Job &job, const RxConfig &config, const CpuConfig &cpu) bool xmrig::Rx::init(const Job &job, const RxConfig &config, const CpuConfig &cpu)
{ {
if (job.algorithm().family() != Algorithm::RANDOM_X) { if (job.algorithm().family() != Algorithm::RANDOM_X) {
if (msrInitialized) {
msrDestroy();
msrInitialized = false;
}
return true; return true;
} }
@ -72,8 +77,12 @@ bool xmrig::Rx::init(const Job &job, const RxConfig &config, const CpuConfig &cp
return true; return true;
} }
if (!osInitialized) { if (!msrInitialized) {
msrInit(config); msrInit(config);
msrInitialized = true;
}
if (!osInitialized) {
setupMainLoopExceptionFrame(); setupMainLoopExceptionFrame();
osInitialized = true; osInitialized = true;
} }