mirror of
https://github.com/jwinterm/xmr-stak.git
synced 2026-10-29 06:38:39 +01:00
rename Params to params
This commit is contained in:
@@ -102,8 +102,8 @@ private:
|
||||
configTpl.replace("PLATFORMINDEX",std::to_string(platformIndex));
|
||||
configTpl.replace("NUMGPUS",std::to_string(devVec.size()));
|
||||
configTpl.replace("GPUCONFIG",conf);
|
||||
configTpl.write(Params::inst().configFileAMD);
|
||||
printer::inst()->print_msg(L0, "AMD: GPU configuration stored in file '%s'", Params::inst().configFileAMD.c_str());
|
||||
configTpl.write(params::inst().configFileAMD);
|
||||
printer::inst()->print_msg(L0, "AMD: GPU configuration stored in file '%s'", params::inst().configFileAMD.c_str());
|
||||
}
|
||||
|
||||
std::vector<GpuContext> devVec;
|
||||
|
||||
@@ -19,7 +19,7 @@ public:
|
||||
return oInst;
|
||||
};
|
||||
|
||||
bool parse_config(const char* sFilename = Params::inst().configFileAMD.c_str());
|
||||
bool parse_config(const char* sFilename = params::inst().configFileAMD.c_str());
|
||||
|
||||
struct thd_cfg {
|
||||
size_t index;
|
||||
|
||||
@@ -95,7 +95,7 @@ std::vector<iBackend*>* minethd::thread_starter(uint32_t threadOffset, miner_wor
|
||||
{
|
||||
std::vector<iBackend*>* pvThreads = new std::vector<iBackend*>();
|
||||
|
||||
if(!configEditor::file_exist(Params::inst().configFileAMD))
|
||||
if(!configEditor::file_exist(params::inst().configFileAMD))
|
||||
{
|
||||
autoAdjust adjust;
|
||||
if(!adjust.printConfig())
|
||||
|
||||
@@ -65,7 +65,7 @@ std::vector<iBackend*>* BackendConnector::thread_starter(miner_work& pWork)
|
||||
std::vector<iBackend*>* pvThreads = new std::vector<iBackend*>;
|
||||
|
||||
#ifndef CONF_NO_CUDA
|
||||
if(Params::inst().useNVIDIA)
|
||||
if(params::inst().useNVIDIA)
|
||||
{
|
||||
plugin nvidiaplugin("NVIDIA", "xmrstak_cuda_backend");
|
||||
std::vector<iBackend*>* nvidiaThreads = nvidiaplugin.startBackend(static_cast<uint32_t>(pvThreads->size()), pWork, environment::inst());
|
||||
@@ -76,7 +76,7 @@ std::vector<iBackend*>* BackendConnector::thread_starter(miner_work& pWork)
|
||||
#endif
|
||||
|
||||
#ifndef CONF_NO_OPENCL
|
||||
if(Params::inst().useAMD)
|
||||
if(params::inst().useAMD)
|
||||
{
|
||||
plugin amdplugin("AMD", "xmrstak_opencl_backend");
|
||||
std::vector<iBackend*>* amdThreads = amdplugin.startBackend(static_cast<uint32_t>(pvThreads->size()), pWork, environment::inst());
|
||||
@@ -87,7 +87,7 @@ std::vector<iBackend*>* BackendConnector::thread_starter(miner_work& pWork)
|
||||
#endif
|
||||
|
||||
#ifndef CONF_NO_CPU
|
||||
if(Params::inst().useCPU)
|
||||
if(params::inst().useCPU)
|
||||
{
|
||||
auto cpuThreads = cpu::minethd::thread_starter(static_cast<uint32_t>(pvThreads->size()), pWork);
|
||||
pvThreads->insert(std::end(*pvThreads), std::begin(cpuThreads), std::end(cpuThreads));
|
||||
|
||||
@@ -100,8 +100,8 @@ public:
|
||||
}
|
||||
|
||||
configTpl.replace("CPUCONFIG",conf);
|
||||
configTpl.write(Params::inst().configFileCPU);
|
||||
printer::inst()->print_msg(L0, "CPU configuration stored in file '%s'", Params::inst().configFileCPU.c_str());
|
||||
configTpl.write(params::inst().configFileCPU);
|
||||
printer::inst()->print_msg(L0, "CPU configuration stored in file '%s'", params::inst().configFileCPU.c_str());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -77,8 +77,8 @@ public:
|
||||
}
|
||||
|
||||
configTpl.replace("CPUCONFIG",conf);
|
||||
configTpl.write(Params::inst().configFileCPU);
|
||||
printer::inst()->print_msg(L0, "CPU configuration stored in file '%s'", Params::inst().configFileCPU.c_str());
|
||||
configTpl.write(params::inst().configFileCPU);
|
||||
printer::inst()->print_msg(L0, "CPU configuration stored in file '%s'", params::inst().configFileCPU.c_str());
|
||||
/* Destroy topology object. */
|
||||
hwloc_topology_destroy(topology);
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ public:
|
||||
return oInst;
|
||||
};
|
||||
|
||||
bool parse_config(const char* sFilename = Params::inst().configFileCPU.c_str());
|
||||
bool parse_config(const char* sFilename = params::inst().configFileCPU.c_str());
|
||||
|
||||
struct thd_cfg {
|
||||
bool bDoubleMode;
|
||||
|
||||
@@ -251,7 +251,7 @@ std::vector<iBackend*> minethd::thread_starter(uint32_t threadOffset, miner_work
|
||||
{
|
||||
std::vector<iBackend*> pvThreads;
|
||||
|
||||
if(!configEditor::file_exist(Params::inst().configFileCPU))
|
||||
if(!configEditor::file_exist(params::inst().configFileCPU))
|
||||
{
|
||||
autoAdjust adjust;
|
||||
if(!adjust.printConfig())
|
||||
|
||||
@@ -102,8 +102,8 @@ private:
|
||||
}
|
||||
|
||||
configTpl.replace("GPUCONFIG",conf);
|
||||
configTpl.write(Params::inst().configFileNVIDIA);
|
||||
printer::inst()->print_msg(L0, "NVIDIA: GPU configuration stored in file '%s'", Params::inst().configFileNVIDIA.c_str());
|
||||
configTpl.write(params::inst().configFileNVIDIA);
|
||||
printer::inst()->print_msg(L0, "NVIDIA: GPU configuration stored in file '%s'", params::inst().configFileNVIDIA.c_str());
|
||||
}
|
||||
|
||||
std::vector<nvid_ctx> nvidCtxVec;
|
||||
|
||||
@@ -17,7 +17,7 @@ public:
|
||||
return oInst;
|
||||
};
|
||||
|
||||
bool parse_config(const char* sFilename = Params::inst().configFileNVIDIA.c_str());
|
||||
bool parse_config(const char* sFilename = params::inst().configFileNVIDIA.c_str());
|
||||
|
||||
struct thd_cfg {
|
||||
uint32_t id;
|
||||
|
||||
@@ -121,7 +121,7 @@ std::vector<iBackend*>* minethd::thread_starter(uint32_t threadOffset, miner_wor
|
||||
{
|
||||
std::vector<iBackend*>* pvThreads = new std::vector<iBackend*>();
|
||||
|
||||
if(!configEditor::file_exist(Params::inst().configFileNVIDIA))
|
||||
if(!configEditor::file_exist(params::inst().configFileNVIDIA))
|
||||
{
|
||||
autoAdjust adjust;
|
||||
if(!adjust.printConfig())
|
||||
|
||||
+28
-19
@@ -41,6 +41,7 @@
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
#include <time.h>
|
||||
#include <iostream>
|
||||
|
||||
#ifndef CONF_NO_TLS
|
||||
#include <openssl/ssl.h>
|
||||
@@ -54,6 +55,14 @@
|
||||
|
||||
void do_benchmark();
|
||||
|
||||
void help()
|
||||
{
|
||||
using namespace std;
|
||||
using namespace xmrstak;
|
||||
|
||||
cout<<"Usage: "<<params::inst().executablePrefix<<" [--help|-h] [--benchmark] [-c CONFIGFILE] [CONFIG FILE]"<<endl;
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
#ifndef CONF_NO_TLS
|
||||
@@ -77,28 +86,28 @@ int main(int argc, char *argv[])
|
||||
pos = pathWithName.rfind("\\");
|
||||
}
|
||||
|
||||
Params::inst().executablePrefix = std::string(pathWithName, 0, pos);
|
||||
params::inst().executablePrefix = std::string(pathWithName, 0, pos);
|
||||
|
||||
for(int i = 1; i < argc; ++i)
|
||||
{
|
||||
std::string opName(argv[i]);
|
||||
if(opName.compare("-h") == 0 || opName.compare("--help") == 0)
|
||||
{
|
||||
printer::inst()->print_msg(L0, "Usage: %s [--help|-h] [--benchmark] [-c CONFIGFILE] [CONFIG FILE]", argv[0]);
|
||||
help();
|
||||
win_exit();
|
||||
return 0;
|
||||
}
|
||||
else if(opName.compare("--noCPU") == 0)
|
||||
{
|
||||
Params::inst().useCPU = false;
|
||||
params::inst().useCPU = false;
|
||||
}
|
||||
else if(opName.compare("--noAMD") == 0)
|
||||
{
|
||||
Params::inst().useAMD = false;
|
||||
params::inst().useAMD = false;
|
||||
}
|
||||
else if(opName.compare("--noAMD") == 0)
|
||||
{
|
||||
Params::inst().useNVIDIA = false;
|
||||
params::inst().useNVIDIA = false;
|
||||
}
|
||||
else if(opName.compare("--cpu") == 0)
|
||||
{
|
||||
@@ -109,7 +118,7 @@ int main(int argc, char *argv[])
|
||||
win_exit();
|
||||
return 1;
|
||||
}
|
||||
Params::inst().configFileCPU = argv[i];
|
||||
params::inst().configFileCPU = argv[i];
|
||||
}
|
||||
else if(opName.compare("--amd") == 0)
|
||||
{
|
||||
@@ -120,7 +129,7 @@ int main(int argc, char *argv[])
|
||||
win_exit();
|
||||
return 1;
|
||||
}
|
||||
Params::inst().configFileAMD = argv[i];
|
||||
params::inst().configFileAMD = argv[i];
|
||||
}
|
||||
else if(opName.compare("--nvidia") == 0)
|
||||
{
|
||||
@@ -131,7 +140,7 @@ int main(int argc, char *argv[])
|
||||
win_exit();
|
||||
return 1;
|
||||
}
|
||||
Params::inst().configFileNVIDIA = argv[i];
|
||||
params::inst().configFileNVIDIA = argv[i];
|
||||
}
|
||||
else if(opName.compare("-o") == 0 || opName.compare("--url") == 0)
|
||||
{
|
||||
@@ -142,7 +151,7 @@ int main(int argc, char *argv[])
|
||||
win_exit();
|
||||
return 1;
|
||||
}
|
||||
Params::inst().poolURL = argv[i];
|
||||
params::inst().poolURL = argv[i];
|
||||
}
|
||||
else if(opName.compare("-u") == 0 || opName.compare("--user") == 0)
|
||||
{
|
||||
@@ -153,7 +162,7 @@ int main(int argc, char *argv[])
|
||||
win_exit();
|
||||
return 1;
|
||||
}
|
||||
Params::inst().poolUsername = argv[i];
|
||||
params::inst().poolUsername = argv[i];
|
||||
}
|
||||
else if(opName.compare("-p") == 0 || opName.compare("--pass") == 0)
|
||||
{
|
||||
@@ -164,14 +173,14 @@ int main(int argc, char *argv[])
|
||||
win_exit();
|
||||
return 1;
|
||||
}
|
||||
Params::inst().poolPasswd = argv[i];
|
||||
params::inst().poolPasswd = argv[i];
|
||||
}
|
||||
else
|
||||
Params::inst().configFile = argv[i];
|
||||
params::inst().configFile = argv[i];
|
||||
}
|
||||
|
||||
// check if we need a guided start
|
||||
if(!configEditor::file_exist(Params::inst().configFile))
|
||||
if(!configEditor::file_exist(params::inst().configFile))
|
||||
{
|
||||
// load the template of the backend config into a char variable
|
||||
const char *tpl =
|
||||
@@ -179,19 +188,19 @@ int main(int argc, char *argv[])
|
||||
;
|
||||
configEditor configTpl{};
|
||||
configTpl.set(std::string(tpl));
|
||||
auto& pool = Params::inst().poolURL;
|
||||
auto& pool = params::inst().poolURL;
|
||||
if(pool.empty())
|
||||
{
|
||||
std::cout<<"Please enter:\n- pool address: e.g. pool.usxmrpool.com:3333"<<std::endl;
|
||||
std::cin >> pool;
|
||||
}
|
||||
auto& userName = Params::inst().poolUsername;
|
||||
auto& userName = params::inst().poolUsername;
|
||||
if(userName.empty())
|
||||
{
|
||||
std::cout<<"- user name (wallet address or pool login):"<<std::endl;
|
||||
std::cin >> userName;
|
||||
}
|
||||
auto& passwd = Params::inst().poolPasswd;
|
||||
auto& passwd = params::inst().poolPasswd;
|
||||
if(passwd.empty())
|
||||
{
|
||||
// clear everything from stdin to allow an empty password
|
||||
@@ -202,11 +211,11 @@ int main(int argc, char *argv[])
|
||||
configTpl.replace("POOLURL", pool);
|
||||
configTpl.replace("POOLUSER", userName);
|
||||
configTpl.replace("POOLPASSWD", passwd);
|
||||
configTpl.write(Params::inst().configFile);
|
||||
std::cout<<"Configuration stored in file '"<<Params::inst().configFile<<"'"<<std::endl;
|
||||
configTpl.write(params::inst().configFile);
|
||||
std::cout<<"Configuration stored in file '"<<params::inst().configFile<<"'"<<std::endl;
|
||||
}
|
||||
|
||||
if(!jconf::inst()->parse_config(Params::inst().configFile.c_str()))
|
||||
if(!jconf::inst()->parse_config(params::inst().configFile.c_str()))
|
||||
{
|
||||
win_exit();
|
||||
return 0;
|
||||
|
||||
+3
-3
@@ -127,7 +127,7 @@ const char* jconf::GetTlsFingerprint()
|
||||
|
||||
const char* jconf::GetPoolAddress()
|
||||
{
|
||||
auto& poolURL = xmrstak::Params::inst().poolURL;
|
||||
auto& poolURL = xmrstak::params::inst().poolURL;
|
||||
if(poolURL.empty())
|
||||
poolURL = prv->configValues[sPoolAddr]->GetString();
|
||||
return poolURL.c_str();
|
||||
@@ -135,7 +135,7 @@ const char* jconf::GetPoolAddress()
|
||||
|
||||
const char* jconf::GetPoolPwd()
|
||||
{
|
||||
auto& poolPasswd = xmrstak::Params::inst().poolPasswd;
|
||||
auto& poolPasswd = xmrstak::params::inst().poolPasswd;
|
||||
if(poolPasswd.empty())
|
||||
poolPasswd = prv->configValues[sPoolPwd]->GetString();
|
||||
return poolPasswd.c_str();
|
||||
@@ -144,7 +144,7 @@ const char* jconf::GetPoolPwd()
|
||||
|
||||
const char* jconf::GetWalletAddress()
|
||||
{
|
||||
auto& poolUsername = xmrstak::Params::inst().poolUsername;
|
||||
auto& poolUsername = xmrstak::params::inst().poolUsername;
|
||||
if(poolUsername.empty())
|
||||
poolUsername = prv->configValues[sWalletAddr]->GetString();
|
||||
return poolUsername.c_str();
|
||||
|
||||
+1
-1
@@ -18,7 +18,7 @@ public:
|
||||
return env.pJconfConfig;
|
||||
};
|
||||
|
||||
bool parse_config(const char* sFilename = xmrstak::Params::inst().configFile.c_str());
|
||||
bool parse_config(const char* sFilename = xmrstak::params::inst().configFile.c_str());
|
||||
|
||||
struct thd_cfg {
|
||||
bool bDoubleMode;
|
||||
|
||||
@@ -8,7 +8,7 @@ namespace xmrstak
|
||||
{
|
||||
|
||||
class globalStates;
|
||||
class Params;
|
||||
class params;
|
||||
|
||||
struct environment
|
||||
{
|
||||
@@ -39,7 +39,7 @@ struct environment
|
||||
globalStates* pglobalStates;
|
||||
jconf* pJconfConfig;
|
||||
executor* pExecutor;
|
||||
Params* pParams;
|
||||
params* pParams;
|
||||
|
||||
};
|
||||
|
||||
|
||||
+4
-4
@@ -7,14 +7,14 @@
|
||||
namespace xmrstak
|
||||
{
|
||||
|
||||
struct Params
|
||||
struct params
|
||||
{
|
||||
|
||||
static inline Params& inst()
|
||||
static inline params& inst()
|
||||
{
|
||||
auto& env = environment::inst();
|
||||
if(env.pParams == nullptr)
|
||||
env.pParams = new Params;
|
||||
env.pParams = new params;
|
||||
return *env.pParams;
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ struct Params
|
||||
std::string configFileNVIDIA;
|
||||
std::string configFileCPU;
|
||||
|
||||
Params() :
|
||||
params() :
|
||||
useAMD(true),
|
||||
useNVIDIA(true),
|
||||
useCPU(true),
|
||||
|
||||
Reference in New Issue
Block a user