Update base.

This commit is contained in:
XMRig 2021-09-02 20:02:42 +07:00
parent dbc53c5d46
commit 28312236fd
No known key found for this signature in database
GPG key ID: 446A53638BE94409
9 changed files with 18 additions and 19 deletions

View file

@ -41,9 +41,9 @@
#include "version.h" #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 class App : public IConsoleListener, public ISignalListener
{ {
public: public:
XMRIG_DISABLE_COPY_MOVE_DEFAULT(App) XMRIG_DISABLE_COPY_MOVE(App)
App(Process *process); App();
~App() override; ~App() override;
int exec(); int exec();

View file

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

View file

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

View file

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

View file

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

View file

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