Update base.

This commit is contained in:
XMRig
2021-09-02 20:02:42 +07:00
parent dbc53c5d46
commit 28312236fd
9 changed files with 18 additions and 19 deletions

View File

@ -41,9 +41,9 @@
#include "version.h"
xmrig::App::App(Process *process)
xmrig::App::App()
{
m_controller = std::make_shared<Controller>(process);
m_controller = std::make_shared<Controller>();
}

View File

@ -48,9 +48,9 @@ class Signals;
class App : public IConsoleListener, public ISignalListener
{
public:
XMRIG_DISABLE_COPY_MOVE_DEFAULT(App)
XMRIG_DISABLE_COPY_MOVE(App)
App(Process *process);
App();
~App() override;
int exec();

View File

@ -25,17 +25,17 @@
#include <cinttypes>
#include <cstdio>
#include <uv.h>
#include "Summary.h"
#include "backend/cpu/Cpu.h"
#include "base/io/log/Log.h"
#include "base/kernel/OS.h"
#include "base/net/stratum/Pool.h"
#include "core/config/Config.h"
#include "core/Controller.h"
#include "crypto/common/Assembly.h"
#include "crypto/common/VirtualMemory.h"
#include "Summary.h"
#include "version.h"
@ -124,8 +124,8 @@ static void print_cpu(const Config *)
static void print_memory(const Config *config)
{
constexpr size_t oneGiB = 1024U * 1024U * 1024U;
const auto freeMem = static_cast<double>(uv_get_free_memory());
const auto totalMem = static_cast<double>(uv_get_total_memory());
const auto freeMem = static_cast<double>(OS::freemem());
const auto totalMem = static_cast<double>(OS::totalmem());
const double percent = freeMem > 0 ? ((totalMem - freeMem) / totalMem * 100.0) : 100.0;

@ -1 +1 @@
Subproject commit 0a760acab1bee001eb554d62ca0490a6a3412b0d
Subproject commit e7443c6fd48eda8fa2d39895b11a67d49e89e2d1

View File

@ -33,8 +33,8 @@
#include <cassert>
xmrig::Controller::Controller(Process *process) :
Base(process)
xmrig::Controller::Controller() :
Base()
{
}

View File

@ -38,9 +38,9 @@ class Network;
class Controller : public Base
{
public:
XMRIG_DISABLE_COPY_MOVE_DEFAULT(Controller)
XMRIG_DISABLE_COPY_MOVE(Controller)
Controller(Process *process);
Controller();
~Controller() override;
int init() override;

View File

@ -19,7 +19,6 @@
#include <algorithm>
#include <cinttypes>
#include <cstring>
#include <uv.h>
#include "core/config/Config.h"

View File

@ -21,6 +21,7 @@
#include "backend/cpu/Cpu.h"
#include "base/io/log/Log.h"
#include "base/io/log/Tags.h"
#include "base/kernel/OS.h"
#include "base/kernel/Platform.h"
#include "crypto/common/VirtualMemory.h"
#include "crypto/randomx/randomx.h"
@ -29,7 +30,6 @@
#include <thread>
#include <uv.h>
namespace xmrig {
@ -203,7 +203,7 @@ void xmrig::RxDataset::allocate(bool hugePages, bool oneGbPages)
return;
}
if (m_mode == RxConfig::AutoMode && uv_get_total_memory() < (maxSize() + RxCache::maxSize())) {
if (m_mode == RxConfig::AutoMode && OS::totalmem() < (maxSize() + RxCache::maxSize())) {
LOG_ERR(CLEAR "%s" RED_BOLD_S "not enough memory for RandomX dataset", Tags::randomx());
return;

View File

@ -26,12 +26,12 @@ int main(int argc, char **argv)
using namespace xmrig;
Process process(argc, argv);
const Entry::Id entry = Entry::get(process);
const auto entry = Entry::get();
if (entry) {
return Entry::exec(process, entry);
return Entry::exec(entry);
}
App app(&process);
App app;
return app.exec();
}