Browse Source

Improved log.

pull/1087/head
XMRig 5 years ago
parent
commit
630a5dce67
  1. 17
      src/backend/cpu/CpuBackend.cpp
  2. 9
      src/core/config/Config.cpp

17
src/backend/cpu/CpuBackend.cpp

@ -32,6 +32,7 @@
#include "backend/cpu/CpuBackend.h"
#include "base/io/log/Log.h"
#include "base/net/stratum/Job.h"
#include "base/tools/Chrono.h"
#include "base/tools/String.h"
#include "core/config/Config.h"
#include "core/Controller.h"
@ -55,6 +56,7 @@ public:
started = 0;
threads = 0;
ways = 0;
ts = Chrono::steadyMSecs();
}
size_t hugePages;
@ -63,6 +65,7 @@ public:
size_t started;
size_t threads;
size_t ways;
uint64_t ts;
};
@ -108,6 +111,14 @@ public:
profileName = cpu.threads().profileName(job.algorithm());
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"),
profileName.data(),
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 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.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);

9
src/core/config/Config.cpp

@ -79,15 +79,6 @@ void xmrig::Config::getJSON(rapidjson::Document &doc) const
doc.AddMember("background", isBackground(), 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("donate-level", m_pools.donateLevel(), allocator);

Loading…
Cancel
Save