1
0
mirror of https://github.com/xmrig/xmrig.git synced 2025-12-13 18:12:50 -05:00

Draft merge

This commit is contained in:
MoneroOcean
2019-06-18 11:17:00 -07:00
217 changed files with 13224 additions and 4105 deletions

View File

@@ -5,7 +5,8 @@
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
* Copyright 2016-2018 XMRig <https://github.com/xmrig>, <support@xmrig.com>
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
* Copyright 2016-2019 XMRig <https://github.com/xmrig>, <support@xmrig.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -29,8 +30,9 @@
#include <stdio.h>
#include "common/log/Log.h"
#include "core/Config.h"
#include "base/io/log/Log.h"
#include "base/tools/Handle.h"
#include "core/config/Config.h"
#include "core/Controller.h"
#include "workers/Hashrate.h"
@@ -48,18 +50,19 @@ inline static const char *format(double h, char *buf, size_t size)
Hashrate::Hashrate(size_t threads, xmrig::Controller *controller) :
m_highest(0.0),
m_threads(0),
m_controller(controller)
m_threads(threads),
m_timer(nullptr)
{
set_threads(threads);
const int printTime = controller->config()->printTime();
if (printTime > 0) {
uv_timer_init(uv_default_loop(), &m_timer);
m_timer.data = this;
m_timer = new uv_timer_t;
uv_timer_init(uv_default_loop(), m_timer);
m_timer->data = this;
uv_timer_start(&m_timer, Hashrate::onReport, (printTime + 4) * 1000, printTime * 1000);
uv_timer_start(m_timer, Hashrate::onReport, (printTime + 4) * 1000, printTime * 1000);
}
}
@@ -175,8 +178,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)),
@@ -187,7 +189,8 @@ void Hashrate::print() const
void Hashrate::stop()
{
uv_timer_stop(&m_timer);
xmrig::Handle::close(m_timer);
m_timer = nullptr;
}