mirror of
https://github.com/xmrig/xmrig.git
synced 2024-11-18 00:37:46 +00:00
Use uv_get_free_memory.
This commit is contained in:
parent
64fb4f265b
commit
c529770d38
3 changed files with 7 additions and 3 deletions
|
@ -104,9 +104,12 @@ static void print_cpu(Config *)
|
|||
|
||||
static void print_threads(Config *config)
|
||||
{
|
||||
Log::print(GREEN_BOLD(" * ") WHITE_BOLD("%-13s") CYAN_BOLD("%.1f GB"),
|
||||
constexpr size_t oneGiB = 1024U * 1024U * 1024U;
|
||||
|
||||
Log::print(GREEN_BOLD(" * ") WHITE_BOLD("%-13s") CYAN_BOLD("%.1f/%.1f GB"),
|
||||
"MEMORY",
|
||||
static_cast<double>(uv_get_total_memory()) / (1024U * 1024U * 1024U)
|
||||
static_cast<double>(uv_get_free_memory()) / oneGiB,
|
||||
static_cast<double>(uv_get_total_memory()) / oneGiB
|
||||
);
|
||||
|
||||
Log::print(GREEN_BOLD(" * ") WHITE_BOLD("%-13s") WHITE_BOLD("%s%d%%"),
|
||||
|
|
|
@ -67,6 +67,7 @@ static rapidjson::Value getResources(rapidjson::Document &doc)
|
|||
Value memory(kObjectType);
|
||||
Value load_average(kArrayType);
|
||||
|
||||
memory.AddMember("free", uv_get_free_memory(), allocator);
|
||||
memory.AddMember("total", uv_get_total_memory(), allocator);
|
||||
memory.AddMember("resident_set_memory", static_cast<uint64_t>(rss), allocator);
|
||||
|
||||
|
|
|
@ -167,7 +167,7 @@ void xmrig::RxDataset::allocate(bool hugePages)
|
|||
return;
|
||||
}
|
||||
|
||||
if (m_mode == RxConfig::AutoMode && uv_get_total_memory() < (maxSize() + RxCache::maxSize())) {
|
||||
if (m_mode == RxConfig::AutoMode && uv_get_free_memory() < (maxSize() + RxCache::maxSize())) {
|
||||
LOG_ERR(CLEAR "%s" RED_BOLD_S "not enough memory for RandomX dataset", rx_tag());
|
||||
|
||||
return;
|
||||
|
|
Loading…
Reference in a new issue