mirror of
https://github.com/jwinterm/xmr-stak.git
synced 2026-10-17 05:41:41 +02:00
Remove whitespace lines
This commit is contained in:
@@ -478,7 +478,7 @@ std::vector<GpuContext> getAMDDevices(int index)
|
||||
ctxVec.push_back(ctx);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
free(device_list);
|
||||
free(platforms);
|
||||
@@ -565,7 +565,7 @@ size_t InitOpenCL(GpuContext* ctx, size_t num_gpus, size_t platform_idx)
|
||||
{
|
||||
printer::inst()->print_msg(L1,"WARNING: using non AMD device: %s", platformName.c_str());
|
||||
}
|
||||
|
||||
|
||||
free(platforms);
|
||||
|
||||
/*MSVC skimping on devel costs by shoehorning C99 to be a subset of C++? Noooo... can't be.*/
|
||||
@@ -674,7 +674,7 @@ size_t XMRSetJob(GpuContext* ctx, uint8_t* input, size_t input_len, uint64_t tar
|
||||
|
||||
input[input_len] = 0x01;
|
||||
memset(input + input_len + 1, 0, 88 - input_len - 1);
|
||||
|
||||
|
||||
size_t numThreads = ctx->rawIntensity;
|
||||
|
||||
if((ret = clEnqueueWriteBuffer(ctx->CommandQueues, ctx->InputBuffer, CL_TRUE, 0, 88, input, 0, NULL, NULL)) != CL_SUCCESS)
|
||||
|
||||
@@ -61,7 +61,7 @@ minethd::minethd(miner_work& pWork, size_t iNo, GpuContext* ctx, const jconf::th
|
||||
|
||||
std::unique_lock<std::mutex> lck(thd_aff_set);
|
||||
std::future<void> order_guard = order_fix.get_future();
|
||||
|
||||
|
||||
oWorkThd = std::thread(&minethd::work_main, this);
|
||||
|
||||
order_guard.wait();
|
||||
@@ -126,7 +126,7 @@ std::vector<iBackend*>* minethd::thread_starter(uint32_t threadOffset, miner_wor
|
||||
printer::inst()->print_msg(L1, "WARNING: AMD device not found");
|
||||
return pvThreads;
|
||||
}
|
||||
|
||||
|
||||
size_t i, n = jconf::inst()->GetThreadCount();
|
||||
pvThreads->reserve(n);
|
||||
|
||||
@@ -172,7 +172,7 @@ void minethd::consume_work()
|
||||
memcpy(&oWork, &globalStates::inst().oGlobalWork, sizeof(miner_work));
|
||||
iJobNo++;
|
||||
globalStates::inst().iConsumeCnt++;
|
||||
|
||||
|
||||
}
|
||||
|
||||
void minethd::work_main()
|
||||
@@ -184,13 +184,13 @@ void minethd::work_main()
|
||||
std::unique_lock<std::mutex> lck(thd_aff_set);
|
||||
lck.release();
|
||||
std::this_thread::yield();
|
||||
|
||||
|
||||
uint64_t iCount = 0;
|
||||
cryptonight_ctx* cpu_ctx;
|
||||
cpu_ctx = cpu::minethd::minethd_alloc_ctx();
|
||||
cn_hash_fun hash_fun = cpu::minethd::func_selector(::jconf::inst()->HaveHardwareAes(), true /*bNoPrefetch*/, ::jconf::inst()->IsCurrencyMonero());
|
||||
globalStates::inst().iConsumeCnt++;
|
||||
|
||||
|
||||
while (bQuit == 0)
|
||||
{
|
||||
if (oWork.bStall)
|
||||
|
||||
@@ -26,9 +26,9 @@ public:
|
||||
|
||||
private:
|
||||
typedef void (*cn_hash_fun)(const void*, size_t, void*, cryptonight_ctx*);
|
||||
|
||||
|
||||
minethd(miner_work& pWork, size_t iNo, GpuContext* ctx, const jconf::thd_cfg cfg);
|
||||
|
||||
|
||||
void work_main();
|
||||
void consume_work();
|
||||
|
||||
|
||||
@@ -94,7 +94,7 @@ std::vector<iBackend*>* BackendConnector::thread_starter(miner_work& pWork)
|
||||
printer::inst()->print_msg(L0, "WARNING: backend CPU disabled.");
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
globalStates::inst().iThreadCount = pvThreads->size();
|
||||
return pvThreads;
|
||||
}
|
||||
|
||||
@@ -186,7 +186,7 @@ size_t cryptonight_init(size_t use_fast_mem, size_t use_mlock, alloc_msg* msg)
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
bRebootDesirable = TRUE;
|
||||
return 1;
|
||||
#else
|
||||
|
||||
@@ -254,7 +254,7 @@ std::vector<iBackend*> minethd::thread_starter(uint32_t threadOffset, miner_work
|
||||
{
|
||||
win_exit();
|
||||
}
|
||||
|
||||
|
||||
|
||||
//Launch the requested number of single and double threads, to distribute
|
||||
//load evenly we need to alternate single and double threads
|
||||
@@ -280,7 +280,7 @@ std::vector<iBackend*> minethd::thread_starter(uint32_t threadOffset, miner_work
|
||||
minethd* thd = new minethd(pWork, i + threadOffset, cfg.bDoubleMode, cfg.bNoPrefetch, cfg.iCpuAff);
|
||||
pvThreads.push_back(thd);
|
||||
}
|
||||
|
||||
|
||||
return pvThreads;
|
||||
}
|
||||
|
||||
@@ -359,7 +359,7 @@ void minethd::work_main()
|
||||
piNonce = (uint32_t*)(oWork.bWorkBlob + 39);
|
||||
globalStates::inst().inst().iConsumeCnt++;
|
||||
result.iThreadId = iThreadNo;
|
||||
|
||||
|
||||
while (bQuit == 0)
|
||||
{
|
||||
if (oWork.bStall)
|
||||
|
||||
@@ -15,7 +15,7 @@ struct pool_data
|
||||
{
|
||||
uint32_t iSavedNonce;
|
||||
size_t pool_id;
|
||||
|
||||
|
||||
pool_data() : iSavedNonce(0), pool_id(invalid_pool_id)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -72,7 +72,7 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
|
||||
void generateThreadConfig()
|
||||
{
|
||||
// load the template of the backend config into a char variable
|
||||
|
||||
@@ -63,7 +63,7 @@ namespace nvidia
|
||||
#else
|
||||
void *lib_handle;
|
||||
#endif
|
||||
|
||||
|
||||
minethd::minethd(miner_work& pWork, size_t iNo, const jconf::thd_cfg& cfg)
|
||||
{
|
||||
this->backendType = iBackend::NVIDIA;
|
||||
@@ -81,7 +81,7 @@ minethd::minethd(miner_work& pWork, size_t iNo, const jconf::thd_cfg& cfg)
|
||||
|
||||
std::unique_lock<std::mutex> lck(thd_aff_set);
|
||||
std::future<void> order_guard = order_fix.get_future();
|
||||
|
||||
|
||||
oWorkThd = std::thread(&minethd::work_main, this);
|
||||
|
||||
order_guard.wait();
|
||||
@@ -211,7 +211,7 @@ void minethd::work_main()
|
||||
std::unique_lock<std::mutex> lck(thd_aff_set);
|
||||
lck.release();
|
||||
std::this_thread::yield();
|
||||
|
||||
|
||||
uint64_t iCount = 0;
|
||||
cryptonight_ctx* cpu_ctx;
|
||||
cpu_ctx = cpu::minethd::minethd_alloc_ctx();
|
||||
@@ -227,7 +227,7 @@ void minethd::work_main()
|
||||
}
|
||||
|
||||
bool mineMonero = strcmp_i(::jconf::inst()->GetCurrency(), "monero");
|
||||
|
||||
|
||||
while (bQuit == 0)
|
||||
{
|
||||
if (oWork.bStall)
|
||||
|
||||
@@ -30,7 +30,7 @@ public:
|
||||
|
||||
private:
|
||||
typedef void (*cn_hash_fun)(const void*, size_t, void*, cryptonight_ctx*);
|
||||
|
||||
|
||||
minethd(miner_work& pWork, size_t iNo, const jconf::thd_cfg& cfg);
|
||||
|
||||
void work_main();
|
||||
|
||||
@@ -12,7 +12,7 @@ typedef struct {
|
||||
int device_threads;
|
||||
int device_bfactor;
|
||||
int device_bsleep;
|
||||
|
||||
|
||||
uint32_t *d_input;
|
||||
uint32_t inputlen;
|
||||
uint32_t *d_result_count;
|
||||
|
||||
@@ -59,7 +59,7 @@ void help()
|
||||
{
|
||||
using namespace std;
|
||||
using namespace xmrstak;
|
||||
|
||||
|
||||
cout<<"Usage: "<<params::inst().binaryName<<" [OPTION]..."<<endl;
|
||||
cout<<" "<<endl;
|
||||
cout<<" -h, --help show this help"<<endl;
|
||||
@@ -113,7 +113,7 @@ inline const char* bool_to_str(bool v)
|
||||
std::string get_multipool_entry(bool& final)
|
||||
{
|
||||
std::cout<<std::endl<<"- Next Pool:"<<std::endl<<std::endl;
|
||||
|
||||
|
||||
std::string pool;
|
||||
if(xmrstak::params::inst().currency == "monero")
|
||||
std::cout<<"- Pool address: e.g. pool.usxmrpool.com:3333"<<std::endl;
|
||||
@@ -147,7 +147,7 @@ std::string get_multipool_entry(bool& final)
|
||||
}
|
||||
|
||||
final = !read_yes_no("- Do you want to add another pool? (y/n)");
|
||||
|
||||
|
||||
return "\t{\"pool_address\" : \"" + pool +"\", \"wallet_address\" : \"" + userName + "\", \"pool_password\" : \"" +
|
||||
passwd + "\", \"use_nicehash\" : " + bool_to_str(nicehash) + ", \"use_tls\" : " + bool_to_str(tls) +
|
||||
", \"tls_fingerprint\" : \"\", \"pool_weight\" : " + std::to_string(pool_weight) + " },\n";
|
||||
@@ -217,13 +217,13 @@ void do_guided_config(bool userSetPasswd)
|
||||
bool tls = read_yes_no("- Does this pool port support TLS/SSL? Use no if unknown. (y/N)");
|
||||
#endif
|
||||
bool nicehash = read_yes_no("- Do you want to use nicehash on this pool? (y/n)");
|
||||
|
||||
|
||||
bool multipool;
|
||||
if(!userSetPool)
|
||||
multipool = read_yes_no("- Do you want to use multiple pools? (y/n)");
|
||||
else
|
||||
multipool = false;
|
||||
|
||||
|
||||
int64_t pool_weight;
|
||||
if(multipool)
|
||||
{
|
||||
@@ -241,7 +241,7 @@ void do_guided_config(bool userSetPasswd)
|
||||
}
|
||||
else
|
||||
pool_weight = 1;
|
||||
|
||||
|
||||
std::string pool_table;
|
||||
pool_table += "\t{\"pool_address\" : \"" + pool +"\", \"wallet_address\" : \"" + userName + "\", \"pool_password\" : \"" +
|
||||
passwd + "\", \"use_nicehash\" : " + bool_to_str(nicehash) + ", \"use_tls\" : " + bool_to_str(tls) +
|
||||
@@ -256,7 +256,7 @@ void do_guided_config(bool userSetPasswd)
|
||||
}
|
||||
while(!final);
|
||||
}
|
||||
|
||||
|
||||
configTpl.replace("POOLCONF", pool_table);
|
||||
configTpl.replace("CURRENCY", currency);
|
||||
configTpl.write(params::inst().configFile);
|
||||
|
||||
@@ -86,7 +86,7 @@ int httpd::req_handler(void * cls,
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
*ptr = nullptr;
|
||||
std::string str;
|
||||
if(strcasecmp(url, "/style.css") == 0)
|
||||
|
||||
@@ -106,7 +106,7 @@ extern const char sHtmlCssFile [] =
|
||||
"padding: 0.5em 0em;"
|
||||
"font-weight: bold;"
|
||||
"}"
|
||||
|
||||
|
||||
".motd-body {"
|
||||
"overflow: hidden;"
|
||||
"}";
|
||||
|
||||
+4
-4
@@ -148,7 +148,7 @@ bool jconf::GetPoolConfig(size_t id, pool_cfg& cfg)
|
||||
cfg.tls = jtls->GetBool();
|
||||
cfg.tls_fingerprint = jtlsfp->GetString();
|
||||
cfg.raw_weight = jwt->GetUint64();
|
||||
|
||||
|
||||
size_t dlt = wt_max - wt_min;
|
||||
if(dlt != 0)
|
||||
{
|
||||
@@ -412,13 +412,13 @@ bool jconf::parse_config(const char* sFilename)
|
||||
printer::inst()->print_msg(L0, "Invalid config file. pool_list must not be empty.");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
std::vector<size_t> pool_weights;
|
||||
pool_weights.reserve(pool_cnt);
|
||||
|
||||
|
||||
const char* aPoolValues[] = { "pool_address", "wallet_address", "pool_password", "use_nicehash", "use_tls", "tls_fingerprint", "pool_weight" };
|
||||
Type poolValTypes[] = { kStringType, kStringType, kStringType, kTrueType, kTrueType, kStringType, kNumberType };
|
||||
|
||||
|
||||
constexpr size_t pvcnt = sizeof(aPoolValues)/sizeof(aPoolValues[0]);
|
||||
for(uint32_t i=0; i < pool_cnt; i++)
|
||||
{
|
||||
|
||||
+4
-4
@@ -19,7 +19,7 @@ public:
|
||||
};
|
||||
|
||||
bool parse_config(const char* sFilename = xmrstak::params::inst().configFile.c_str());
|
||||
|
||||
|
||||
struct pool_cfg {
|
||||
const char* sPoolAddr;
|
||||
const char* sWalletAddr;
|
||||
@@ -30,10 +30,10 @@ public:
|
||||
size_t raw_weight;
|
||||
double weight;
|
||||
};
|
||||
|
||||
|
||||
size_t wt_max;
|
||||
size_t wt_min;
|
||||
|
||||
|
||||
uint64_t GetPoolCount();
|
||||
bool GetPoolConfig(size_t id, pool_cfg& cfg);
|
||||
|
||||
@@ -46,7 +46,7 @@ public:
|
||||
};
|
||||
|
||||
bool TlsSecureAlgos();
|
||||
|
||||
|
||||
const std::string GetCurrency();
|
||||
bool IsCurrencyMonero();
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ struct configEditor
|
||||
|
||||
configEditor()
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
static bool file_exist( const std::string filename)
|
||||
@@ -51,7 +51,7 @@ struct configEditor
|
||||
{
|
||||
m_fileContent = std::regex_replace(m_fileContent, std::regex(search), substring);
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
||||
} // namepsace xmrstak
|
||||
|
||||
@@ -267,7 +267,7 @@ void executor::log_socket_error(jpsock* pool, std::string&& sError)
|
||||
pool_name.reserve(128);
|
||||
pool_name.append("[").append(pool->get_pool_addr()).append("] ");
|
||||
sError.insert(0, pool_name);
|
||||
|
||||
|
||||
vSocketLog.emplace_back(std::move(sError));
|
||||
printer::inst()->print_msg(L1, "SOCKET ERROR - %s", vSocketLog.back().msg.c_str());
|
||||
|
||||
@@ -321,7 +321,7 @@ jpsock* executor::pick_pool_by_id(size_t pool_id)
|
||||
void executor::on_sock_ready(size_t pool_id)
|
||||
{
|
||||
jpsock* pool = pick_pool_by_id(pool_id);
|
||||
|
||||
|
||||
if(pool->is_dev_pool())
|
||||
printer::inst()->print_msg(L1, "Dev pool connected. Logging in...");
|
||||
else
|
||||
@@ -342,7 +342,7 @@ void executor::on_sock_error(size_t pool_id, std::string&& sError, bool silent)
|
||||
jpsock* pool = pick_pool_by_id(pool_id);
|
||||
|
||||
pool->disconnect();
|
||||
|
||||
|
||||
if(pool_id == current_pool_id)
|
||||
current_pool_id = invalid_pool_id;
|
||||
|
||||
@@ -505,7 +505,7 @@ void executor::ex_main()
|
||||
if(!cfg.tls) tls = false;
|
||||
pools.emplace_back(i+1, cfg.sPoolAddr, cfg.sWalletAddr, cfg.sPasswd, cfg.weight, false, cfg.tls, cfg.tls_fingerprint, cfg.nicehash);
|
||||
}
|
||||
|
||||
|
||||
if(jconf::inst()->IsCurrencyMonero())
|
||||
{
|
||||
if(tls)
|
||||
@@ -753,7 +753,7 @@ void executor::hashrate_report(std::string& out)
|
||||
|
||||
if((i & 0x1) == 1) //We had odd number of threads
|
||||
out.append("|\n");
|
||||
|
||||
|
||||
if(nthd != 1)
|
||||
out.append("-----------------------------------------------------\n");
|
||||
else
|
||||
|
||||
@@ -53,7 +53,7 @@ private:
|
||||
};
|
||||
|
||||
inline void set_timestamp() { dev_timestamp = get_timestamp(); };
|
||||
|
||||
|
||||
// In miliseconds, has to divide a second (1000ms) into an integer number
|
||||
constexpr static size_t iTickTime = 500;
|
||||
|
||||
@@ -97,7 +97,7 @@ private:
|
||||
constexpr static size_t motd_max_length = 512;
|
||||
bool motd_filter_console(std::string& motd);
|
||||
bool motd_filter_web(std::string& motd);
|
||||
|
||||
|
||||
void hashrate_report(std::string& out);
|
||||
void result_report(std::string& out);
|
||||
void connection_report(std::string& out);
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
#pragma once
|
||||
|
||||
|
||||
#include <queue>
|
||||
#include <thread>
|
||||
#include <mutex>
|
||||
#include <condition_variable>
|
||||
|
||||
|
||||
template <typename T>
|
||||
class thdq
|
||||
{
|
||||
@@ -17,7 +17,7 @@ public:
|
||||
queue_.pop();
|
||||
return item;
|
||||
}
|
||||
|
||||
|
||||
void pop(T& item)
|
||||
{
|
||||
std::unique_lock<std::mutex> mlock(mutex_);
|
||||
@@ -25,7 +25,7 @@ public:
|
||||
item = queue_.front();
|
||||
queue_.pop();
|
||||
}
|
||||
|
||||
|
||||
void push(const T& item)
|
||||
{
|
||||
std::unique_lock<std::mutex> mlock(mutex_);
|
||||
@@ -33,7 +33,7 @@ public:
|
||||
mlock.unlock();
|
||||
cond_.notify_one();
|
||||
}
|
||||
|
||||
|
||||
void push(T&& item)
|
||||
{
|
||||
std::unique_lock<std::mutex> mlock(mutex_);
|
||||
@@ -41,7 +41,7 @@ public:
|
||||
mlock.unlock();
|
||||
cond_.notify_one();
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
std::queue<T> queue_;
|
||||
std::mutex mutex_;
|
||||
|
||||
@@ -443,7 +443,7 @@ bool jpsock::connect(std::string& sConnectError)
|
||||
sSocketError.clear();
|
||||
iJobDiff = 0;
|
||||
connect_attempts++;
|
||||
|
||||
|
||||
if(sck->set_hostname(net_addr.c_str()))
|
||||
{
|
||||
bRunning = true;
|
||||
@@ -607,13 +607,13 @@ bool jpsock::cmd_submit(const char* sJobId, uint32_t iNonce, const uint8_t* bRes
|
||||
|
||||
if(ext_backend)
|
||||
snprintf(sBackend, sizeof(sBackend), ",\"backend\":\"%s\"", xmrstak::iBackend::getName(bend->backendType));
|
||||
|
||||
|
||||
if(ext_hashcount)
|
||||
snprintf(sHashcount, sizeof(sHashcount), ",\"hashcount\":%llu", int_port(bend->iHashCount.load(std::memory_order_relaxed)));
|
||||
|
||||
if(ext_algo)
|
||||
snprintf(sAlgo, sizeof(sAlgo), ",\"algo\":\"%s\"", algo_full_cn ? "cryptonight" : "cryptonight-lite");
|
||||
|
||||
|
||||
bin2hex((unsigned char*)&iNonce, 4, sNonce);
|
||||
sNonce[8] = '\0';
|
||||
|
||||
@@ -648,7 +648,7 @@ bool jpsock::get_pool_motd(std::string& strin)
|
||||
{
|
||||
if(!ext_motd)
|
||||
return false;
|
||||
|
||||
|
||||
std::unique_lock<std::mutex>(motd_mutex);
|
||||
if(pool_motd.size() > 0)
|
||||
{
|
||||
|
||||
+1
-1
@@ -46,7 +46,7 @@ struct params
|
||||
configFileCPU("cpu.txt"),
|
||||
configFileNVIDIA("nvidia.txt")
|
||||
{}
|
||||
|
||||
|
||||
};
|
||||
|
||||
} // namepsace xmrstak
|
||||
|
||||
Reference in New Issue
Block a user