Update base.
This commit is contained in:
parent
b38046db46
commit
46e49cde0b
40 changed files with 162 additions and 244 deletions
|
@ -29,23 +29,12 @@
|
|||
|
||||
|
||||
#include "base/kernel/Platform.h"
|
||||
#include "base/io/log/Log.h"
|
||||
#include "version.h"
|
||||
|
||||
|
||||
#ifdef XMRIG_NVIDIA_PROJECT
|
||||
# include "nvidia/cryptonight.h"
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef XMRIG_AMD_PROJECT
|
||||
static uint32_t timerResolution = 0;
|
||||
#endif
|
||||
|
||||
|
||||
static inline OSVERSIONINFOEX winOsVersion()
|
||||
{
|
||||
typedef NTSTATUS (NTAPI *RtlGetVersionFunction)(LPOSVERSIONINFO);
|
||||
using RtlGetVersionFunction = NTSTATUS (*)(LPOSVERSIONINFO);
|
||||
OSVERSIONINFOEX result = { sizeof(OSVERSIONINFOEX), 0, 0, 0, 0, {'\0'}, 0, 0, 0, 0, 0};
|
||||
|
||||
HMODULE ntdll = GetModuleHandleW(L"ntdll.dll");
|
||||
|
@ -75,11 +64,6 @@ char *xmrig::Platform::createUserAgent()
|
|||
length += snprintf(buf + length, max - length, ") libuv/%s", uv_version_string());
|
||||
# endif
|
||||
|
||||
# ifdef XMRIG_NVIDIA_PROJECT
|
||||
const int cudaVersion = cuda_get_runtime_version();
|
||||
length += snprintf(buf + length, max - length, " CUDA/%d.%d", cudaVersion / 1000, cudaVersion % 100);
|
||||
# endif
|
||||
|
||||
# ifdef __GNUC__
|
||||
length += snprintf(buf + length, max - length, " gcc/%d.%d.%d", __GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__);
|
||||
# elif _MSC_VER
|
||||
|
@ -93,10 +77,6 @@ char *xmrig::Platform::createUserAgent()
|
|||
#ifndef XMRIG_FEATURE_HWLOC
|
||||
bool xmrig::Platform::setThreadAffinity(uint64_t cpu_id)
|
||||
{
|
||||
if (cpu_id >= 64) {
|
||||
LOG_ERR("Unable to set affinity. Windows supports only affinity up to 63.");
|
||||
}
|
||||
|
||||
const bool result = (SetThreadAffinityMask(GetCurrentThread(), 1ULL << cpu_id) != 0);
|
||||
Sleep(1);
|
||||
return result;
|
||||
|
@ -104,34 +84,6 @@ bool xmrig::Platform::setThreadAffinity(uint64_t cpu_id)
|
|||
#endif
|
||||
|
||||
|
||||
uint32_t xmrig::Platform::setTimerResolution(uint32_t resolution)
|
||||
{
|
||||
# ifdef XMRIG_AMD_PROJECT
|
||||
TIMECAPS tc;
|
||||
|
||||
if (timeGetDevCaps(&tc, sizeof(TIMECAPS)) != TIMERR_NOERROR) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
timerResolution = std::min<uint32_t>(std::max<uint32_t>(tc.wPeriodMin, resolution), tc.wPeriodMax);
|
||||
|
||||
return timeBeginPeriod(timerResolution) == TIMERR_NOERROR ? timerResolution : 0;
|
||||
# else
|
||||
return resolution;
|
||||
# endif
|
||||
}
|
||||
|
||||
|
||||
void xmrig::Platform::restoreTimerResolution()
|
||||
{
|
||||
# ifdef XMRIG_AMD_PROJECT
|
||||
if (timerResolution) {
|
||||
timeEndPeriod(timerResolution);
|
||||
}
|
||||
# endif
|
||||
}
|
||||
|
||||
|
||||
void xmrig::Platform::setProcessPriority(int priority)
|
||||
{
|
||||
if (priority == -1) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue