mirror of
https://github.com/xmrig/xmrig.git
synced 2026-04-18 05:22:28 -04:00
New log support.
This commit is contained in:
@@ -25,8 +25,8 @@
|
||||
#include <assert.h>
|
||||
|
||||
|
||||
#include "base/io/log/Log.h"
|
||||
#include "common/cpu/Cpu.h"
|
||||
#include "common/log/Log.h"
|
||||
#include "crypto/Asm.h"
|
||||
#include "Mem.h"
|
||||
#include "rapidjson/document.h"
|
||||
|
||||
@@ -30,8 +30,8 @@
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
#include "base/io/log/Log.h"
|
||||
#include "base/tools/Handle.h"
|
||||
#include "common/log/Log.h"
|
||||
#include "core/Config.h"
|
||||
#include "core/Controller.h"
|
||||
#include "workers/Hashrate.h"
|
||||
@@ -163,8 +163,7 @@ void Hashrate::print() const
|
||||
char num3[8] = { 0 };
|
||||
char num4[8] = { 0 };
|
||||
|
||||
LOG_INFO(m_controller->config()->isColors() ? WHITE_BOLD("speed") " 10s/60s/15m " CYAN_BOLD("%s") CYAN(" %s %s ") CYAN_BOLD("H/s") " max " CYAN_BOLD("%s H/s")
|
||||
: "speed 10s/60s/15m %s %s %s H/s max %s H/s",
|
||||
LOG_INFO(WHITE_BOLD("speed") " 10s/60s/15m " CYAN_BOLD("%s") CYAN(" %s %s ") CYAN_BOLD("H/s") " max " CYAN_BOLD("%s H/s"),
|
||||
format(calc(ShortInterval), num1, sizeof(num1)),
|
||||
format(calc(MediumInterval), num2, sizeof(num2)),
|
||||
format(calc(LargeInterval), num3, sizeof(num3)),
|
||||
|
||||
@@ -28,7 +28,6 @@
|
||||
|
||||
|
||||
#include "crypto/CryptoNight_test.h"
|
||||
#include "common/log/Log.h"
|
||||
#include "workers/CpuThread.h"
|
||||
#include "workers/MultiWorker.h"
|
||||
#include "workers/Workers.h"
|
||||
|
||||
@@ -28,8 +28,8 @@
|
||||
|
||||
|
||||
#include "api/Api.h"
|
||||
#include "base/io/log/Log.h"
|
||||
#include "base/tools/Handle.h"
|
||||
#include "common/log/Log.h"
|
||||
#include "core/Config.h"
|
||||
#include "core/Controller.h"
|
||||
#include "crypto/CryptoNight_constants.h"
|
||||
@@ -99,12 +99,11 @@ void Workers::printHashrate(bool detail)
|
||||
}
|
||||
|
||||
if (detail) {
|
||||
const bool isColors = m_controller->config()->isColors();
|
||||
char num1[8] = { 0 };
|
||||
char num2[8] = { 0 };
|
||||
char num3[8] = { 0 };
|
||||
|
||||
xmrig::Log::print("%s| THREAD | AFFINITY | 10s H/s | 60s H/s | 15m H/s |", isColors ? "\x1B[1;37m" : "");
|
||||
xmrig::Log::print(WHITE_BOLD_S "| THREAD | AFFINITY | 10s H/s | 60s H/s | 15m H/s |");
|
||||
|
||||
size_t i = 0;
|
||||
for (const xmrig::IThread *thread : m_controller->config()->threads()) {
|
||||
@@ -178,7 +177,6 @@ void Workers::start(xmrig::Controller *controller)
|
||||
|
||||
const std::vector<xmrig::IThread *> &threads = controller->config()->threads();
|
||||
m_status.algo = controller->config()->algorithm().algo();
|
||||
m_status.colors = controller->config()->isColors();
|
||||
m_status.threads = threads.size();
|
||||
|
||||
for (const xmrig::IThread *thread : threads) {
|
||||
@@ -302,7 +300,7 @@ void Workers::onReady(void *arg)
|
||||
}
|
||||
|
||||
|
||||
void Workers::onResult(uv_async_t *handle)
|
||||
void Workers::onResult(uv_async_t *)
|
||||
{
|
||||
std::list<xmrig::JobResult> results;
|
||||
|
||||
@@ -321,7 +319,7 @@ void Workers::onResult(uv_async_t *handle)
|
||||
}
|
||||
|
||||
|
||||
void Workers::onTick(uv_timer_t *handle)
|
||||
void Workers::onTick(uv_timer_t *)
|
||||
{
|
||||
for (ThreadHandle *handle : m_workers) {
|
||||
if (!handle->worker()) {
|
||||
@@ -350,16 +348,10 @@ void Workers::start(IWorker *worker)
|
||||
const double percent = (double) m_status.hugePages / m_status.pages * 100.0;
|
||||
const size_t memory = m_status.ways * xmrig::cn_select_memory(m_status.algo) / 1024;
|
||||
|
||||
if (m_status.colors) {
|
||||
LOG_INFO(GREEN_BOLD("READY (CPU)") " threads " CYAN_BOLD("%zu(%zu)") " huge pages %s%zu/%zu %1.0f%%\x1B[0m memory " CYAN_BOLD("%zu KB") "",
|
||||
m_status.threads, m_status.ways,
|
||||
(m_status.hugePages == m_status.pages ? "\x1B[1;32m" : (m_status.hugePages == 0 ? "\x1B[1;31m" : "\x1B[1;33m")),
|
||||
m_status.hugePages, m_status.pages, percent, memory);
|
||||
}
|
||||
else {
|
||||
LOG_INFO("READY (CPU) threads %zu(%zu) huge pages %zu/%zu %1.0f%% memory %zu KB",
|
||||
m_status.threads, m_status.ways, m_status.hugePages, m_status.pages, percent, memory);
|
||||
}
|
||||
LOG_INFO(GREEN_BOLD("READY (CPU)") " threads " CYAN_BOLD("%zu(%zu)") " huge pages %s%zu/%zu %1.0f%%\x1B[0m memory " CYAN_BOLD("%zu KB") "",
|
||||
m_status.threads, m_status.ways,
|
||||
(m_status.hugePages == m_status.pages ? GREEN_BOLD_S : (m_status.hugePages == 0 ? RED_BOLD_S : YELLOW_BOLD_S)),
|
||||
m_status.hugePages, m_status.pages, percent, memory);
|
||||
}
|
||||
|
||||
uv_mutex_unlock(&m_mutex);
|
||||
|
||||
@@ -82,7 +82,6 @@ private:
|
||||
{
|
||||
public:
|
||||
inline LaunchStatus() :
|
||||
colors(true),
|
||||
hugePages(0),
|
||||
pages(0),
|
||||
started(0),
|
||||
@@ -91,7 +90,6 @@ private:
|
||||
algo(xmrig::CRYPTONIGHT)
|
||||
{}
|
||||
|
||||
bool colors;
|
||||
size_t hugePages;
|
||||
size_t pages;
|
||||
size_t started;
|
||||
|
||||
Reference in New Issue
Block a user