mirror of
https://github.com/xmrig/xmrig.git
synced 2025-01-26 20:46:20 +00:00
Improved log.
This commit is contained in:
parent
8ce00adda4
commit
630a5dce67
2 changed files with 15 additions and 11 deletions
|
@ -32,6 +32,7 @@
|
||||||
#include "backend/cpu/CpuBackend.h"
|
#include "backend/cpu/CpuBackend.h"
|
||||||
#include "base/io/log/Log.h"
|
#include "base/io/log/Log.h"
|
||||||
#include "base/net/stratum/Job.h"
|
#include "base/net/stratum/Job.h"
|
||||||
|
#include "base/tools/Chrono.h"
|
||||||
#include "base/tools/String.h"
|
#include "base/tools/String.h"
|
||||||
#include "core/config/Config.h"
|
#include "core/config/Config.h"
|
||||||
#include "core/Controller.h"
|
#include "core/Controller.h"
|
||||||
|
@ -55,6 +56,7 @@ public:
|
||||||
started = 0;
|
started = 0;
|
||||||
threads = 0;
|
threads = 0;
|
||||||
ways = 0;
|
ways = 0;
|
||||||
|
ts = Chrono::steadyMSecs();
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t hugePages;
|
size_t hugePages;
|
||||||
|
@ -63,6 +65,7 @@ public:
|
||||||
size_t started;
|
size_t started;
|
||||||
size_t threads;
|
size_t threads;
|
||||||
size_t ways;
|
size_t ways;
|
||||||
|
uint64_t ts;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -108,6 +111,14 @@ public:
|
||||||
profileName = cpu.threads().profileName(job.algorithm());
|
profileName = cpu.threads().profileName(job.algorithm());
|
||||||
threads = cpu.threads().get(profileName);
|
threads = cpu.threads().get(profileName);
|
||||||
|
|
||||||
|
if (profileName.isNull() || threads.empty()) {
|
||||||
|
workers.stop();
|
||||||
|
|
||||||
|
LOG_WARN(YELLOW_BOLD_S "CPU disabled, no suitable configuration for algo %s", job.algorithm().shortName());
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
LOG_INFO(GREEN_BOLD("CPU") " use profile " BLUE_BG(WHITE_BOLD_S " %s ") WHITE_BOLD_S " (" CYAN_BOLD("%zu") WHITE_BOLD(" threads)") " scratchpad " CYAN_BOLD("%zu KB"),
|
LOG_INFO(GREEN_BOLD("CPU") " use profile " BLUE_BG(WHITE_BOLD_S " %s ") WHITE_BOLD_S " (" CYAN_BOLD("%zu") WHITE_BOLD(" threads)") " scratchpad " CYAN_BOLD("%zu KB"),
|
||||||
profileName.data(),
|
profileName.data(),
|
||||||
threads.size(),
|
threads.size(),
|
||||||
|
@ -217,10 +228,12 @@ void xmrig::CpuBackend::start(IWorker *worker)
|
||||||
const double percent = d_ptr->status.hugePages == 0 ? 0.0 : static_cast<double>(d_ptr->status.hugePages) / d_ptr->status.pages * 100.0;
|
const double percent = d_ptr->status.hugePages == 0 ? 0.0 : static_cast<double>(d_ptr->status.hugePages) / d_ptr->status.pages * 100.0;
|
||||||
const size_t memory = d_ptr->status.ways * d_ptr->status.memory / 1024;
|
const size_t memory = d_ptr->status.ways * d_ptr->status.memory / 1024;
|
||||||
|
|
||||||
LOG_INFO(GREEN_BOLD("CPU READY") " threads " CYAN_BOLD("%zu(%zu)") " huge pages %s%zu/%zu %1.0f%%\x1B[0m memory " CYAN_BOLD("%zu KB") "",
|
LOG_INFO(GREEN_BOLD("CPU READY") " threads " CYAN_BOLD("%zu(%zu)") " huge pages %s%zu/%zu %1.0f%%\x1B[0m memory " CYAN_BOLD("%zu KB") BLACK_BOLD(" (%" PRIu64 " ms)"),
|
||||||
d_ptr->status.threads, d_ptr->status.ways,
|
d_ptr->status.threads, d_ptr->status.ways,
|
||||||
(d_ptr->status.hugePages == d_ptr->status.pages ? GREEN_BOLD_S : (d_ptr->status.hugePages == 0 ? RED_BOLD_S : YELLOW_BOLD_S)),
|
(d_ptr->status.hugePages == d_ptr->status.pages ? GREEN_BOLD_S : (d_ptr->status.hugePages == 0 ? RED_BOLD_S : YELLOW_BOLD_S)),
|
||||||
d_ptr->status.hugePages, d_ptr->status.pages, percent, memory);
|
d_ptr->status.hugePages, d_ptr->status.pages, percent, memory,
|
||||||
|
Chrono::steadyMSecs() - d_ptr->status.ts
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
uv_mutex_unlock(&d_ptr->mutex);
|
uv_mutex_unlock(&d_ptr->mutex);
|
||||||
|
|
|
@ -79,15 +79,6 @@ void xmrig::Config::getJSON(rapidjson::Document &doc) const
|
||||||
doc.AddMember("background", isBackground(), allocator);
|
doc.AddMember("background", isBackground(), allocator);
|
||||||
doc.AddMember("colors", Log::colors, allocator);
|
doc.AddMember("colors", Log::colors, allocator);
|
||||||
|
|
||||||
// if (affinity() != -1L) {
|
|
||||||
// snprintf(affinity_tmp, sizeof(affinity_tmp) - 1, "0x%" PRIX64, affinity());
|
|
||||||
// doc.AddMember("cpu-affinity", StringRef(affinity_tmp), allocator);
|
|
||||||
// }
|
|
||||||
// else {
|
|
||||||
// doc.AddMember("cpu-affinity", kNullType, allocator);
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
doc.AddMember("cpu", m_cpu.toJSON(doc), allocator);
|
doc.AddMember("cpu", m_cpu.toJSON(doc), allocator);
|
||||||
|
|
||||||
doc.AddMember("donate-level", m_pools.donateLevel(), allocator);
|
doc.AddMember("donate-level", m_pools.donateLevel(), allocator);
|
||||||
|
|
Loading…
Reference in a new issue