Options class replaced to xmrig::Config.

This commit is contained in:
XMRig 2018-03-31 16:29:47 +07:00
parent aad19f1a35
commit aac7b0404a
25 changed files with 240 additions and 1104 deletions

View file

@ -4,8 +4,8 @@
* Copyright 2014 Lucas Jones <https://github.com/lucasjones>
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
* Copyright 2016-2017 XMRig <support@xmrig.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>
*
* 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
@ -27,8 +27,10 @@
#include <memory.h>
#include <stdio.h>
#include "core/Config.h"
#include "core/Controller.h"
#include "log/Log.h"
#include "Options.h"
#include "workers/Hashrate.h"
@ -43,9 +45,10 @@ inline const char *format(double h, char* buf, size_t size)
}
Hashrate::Hashrate(int threads) :
Hashrate::Hashrate(int threads, xmrig::Controller *controller) :
m_highest(0.0),
m_threads(threads)
m_threads(threads),
m_controller(controller)
{
m_counts = new uint64_t*[threads];
m_timestamps = new uint64_t*[threads];
@ -60,7 +63,7 @@ Hashrate::Hashrate(int threads) :
memset(m_timestamps[0], 0, sizeof(uint64_t) * kBucketSize);
}
const int printTime = Options::i()->printTime();
const int printTime = controller->config()->printTime();
if (printTime > 0) {
uv_timer_init(uv_default_loop(), &m_timer);
@ -153,7 +156,7 @@ void Hashrate::print()
char num3[8];
char num4[8];
LOG_INFO(Options::i()->colors() ? "\x1B[01;37mspeed\x1B[0m 2.5s/60s/15m \x1B[01;36m%s \x1B[22;36m%s %s \x1B[01;36mH/s\x1B[0m max: \x1B[01;36m%s H/s" : "speed 2.5s/60s/15m %s %s %s H/s max: %s H/s",
LOG_INFO(m_controller->config()->isColors() ? "\x1B[01;37mspeed\x1B[0m 2.5s/60s/15m \x1B[01;36m%s \x1B[22;36m%s %s \x1B[01;36mH/s\x1B[0m max: \x1B[01;36m%s H/s" : "speed 2.5s/60s/15m %s %s %s H/s max: %s H/s",
format(calc(ShortInterval), num1, sizeof(num1)),
format(calc(MediumInterval), num2, sizeof(num2)),
format(calc(LargeInterval), num3, sizeof(num3)),