diff options
Diffstat (limited to 'xmrstak')
-rw-r--r-- | xmrstak/backend/amd/amd_gpu/gpu.cpp | 6 | ||||
-rw-r--r-- | xmrstak/backend/amd/minethd.cpp | 10 | ||||
-rw-r--r-- | xmrstak/backend/amd/minethd.hpp | 4 | ||||
-rw-r--r-- | xmrstak/backend/backendConnector.cpp | 2 | ||||
-rw-r--r-- | xmrstak/backend/cpu/crypto/cryptonight_common.cpp | 2 | ||||
-rw-r--r-- | xmrstak/backend/cpu/minethd.cpp | 6 | ||||
-rw-r--r-- | xmrstak/backend/globalStates.hpp | 2 | ||||
-rw-r--r-- | xmrstak/backend/nvidia/autoAdjust.hpp | 2 | ||||
-rw-r--r-- | xmrstak/backend/nvidia/minethd.cpp | 8 | ||||
-rw-r--r-- | xmrstak/backend/nvidia/minethd.hpp | 2 | ||||
-rw-r--r-- | xmrstak/backend/nvidia/nvcc_code/cryptonight.hpp | 2 | ||||
-rw-r--r-- | xmrstak/cli/cli-miner.cpp | 14 | ||||
-rw-r--r-- | xmrstak/http/httpd.cpp | 2 | ||||
-rw-r--r-- | xmrstak/http/webdesign.cpp | 2 | ||||
-rw-r--r-- | xmrstak/jconf.cpp | 8 | ||||
-rw-r--r-- | xmrstak/jconf.hpp | 8 | ||||
-rw-r--r-- | xmrstak/misc/configEditor.hpp | 4 | ||||
-rw-r--r-- | xmrstak/misc/executor.cpp | 10 | ||||
-rw-r--r-- | xmrstak/misc/executor.hpp | 4 | ||||
-rw-r--r-- | xmrstak/misc/thdq.hpp | 12 | ||||
-rw-r--r-- | xmrstak/net/jpsock.cpp | 8 | ||||
-rw-r--r-- | xmrstak/params.hpp | 2 |
22 files changed, 60 insertions, 60 deletions
diff --git a/xmrstak/backend/amd/amd_gpu/gpu.cpp b/xmrstak/backend/amd/amd_gpu/gpu.cpp index 135cac0..791ceb2 100644 --- a/xmrstak/backend/amd/amd_gpu/gpu.cpp +++ b/xmrstak/backend/amd/amd_gpu/gpu.cpp @@ -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) diff --git a/xmrstak/backend/amd/minethd.cpp b/xmrstak/backend/amd/minethd.cpp index 1582872..c1399e0 100644 --- a/xmrstak/backend/amd/minethd.cpp +++ b/xmrstak/backend/amd/minethd.cpp @@ -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) diff --git a/xmrstak/backend/amd/minethd.hpp b/xmrstak/backend/amd/minethd.hpp index c808192..29ddb74 100644 --- a/xmrstak/backend/amd/minethd.hpp +++ b/xmrstak/backend/amd/minethd.hpp @@ -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(); diff --git a/xmrstak/backend/backendConnector.cpp b/xmrstak/backend/backendConnector.cpp index ef22741..d735cb3 100644 --- a/xmrstak/backend/backendConnector.cpp +++ b/xmrstak/backend/backendConnector.cpp @@ -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; } diff --git a/xmrstak/backend/cpu/crypto/cryptonight_common.cpp b/xmrstak/backend/cpu/crypto/cryptonight_common.cpp index c73dbd8..8b2207d 100644 --- a/xmrstak/backend/cpu/crypto/cryptonight_common.cpp +++ b/xmrstak/backend/cpu/crypto/cryptonight_common.cpp @@ -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 diff --git a/xmrstak/backend/cpu/minethd.cpp b/xmrstak/backend/cpu/minethd.cpp index 933b476..cbb01f9 100644 --- a/xmrstak/backend/cpu/minethd.cpp +++ b/xmrstak/backend/cpu/minethd.cpp @@ -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) diff --git a/xmrstak/backend/globalStates.hpp b/xmrstak/backend/globalStates.hpp index 9fdda2a..442be69 100644 --- a/xmrstak/backend/globalStates.hpp +++ b/xmrstak/backend/globalStates.hpp @@ -15,7 +15,7 @@ struct pool_data { uint32_t iSavedNonce; size_t pool_id; - + pool_data() : iSavedNonce(0), pool_id(invalid_pool_id) { } diff --git a/xmrstak/backend/nvidia/autoAdjust.hpp b/xmrstak/backend/nvidia/autoAdjust.hpp index fbc9f49..c6a7dca 100644 --- a/xmrstak/backend/nvidia/autoAdjust.hpp +++ b/xmrstak/backend/nvidia/autoAdjust.hpp @@ -72,7 +72,7 @@ public: } private: - + void generateThreadConfig() { // load the template of the backend config into a char variable diff --git a/xmrstak/backend/nvidia/minethd.cpp b/xmrstak/backend/nvidia/minethd.cpp index 5e8b3c4..9eab1c0 100644 --- a/xmrstak/backend/nvidia/minethd.cpp +++ b/xmrstak/backend/nvidia/minethd.cpp @@ -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) diff --git a/xmrstak/backend/nvidia/minethd.hpp b/xmrstak/backend/nvidia/minethd.hpp index ffcdab1..d13c868 100644 --- a/xmrstak/backend/nvidia/minethd.hpp +++ b/xmrstak/backend/nvidia/minethd.hpp @@ -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(); diff --git a/xmrstak/backend/nvidia/nvcc_code/cryptonight.hpp b/xmrstak/backend/nvidia/nvcc_code/cryptonight.hpp index 0cfdaac..1b63379 100644 --- a/xmrstak/backend/nvidia/nvcc_code/cryptonight.hpp +++ b/xmrstak/backend/nvidia/nvcc_code/cryptonight.hpp @@ -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; diff --git a/xmrstak/cli/cli-miner.cpp b/xmrstak/cli/cli-miner.cpp index 9ba495e..90da834 100644 --- a/xmrstak/cli/cli-miner.cpp +++ b/xmrstak/cli/cli-miner.cpp @@ -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); diff --git a/xmrstak/http/httpd.cpp b/xmrstak/http/httpd.cpp index 81012fa..dba7d7c 100644 --- a/xmrstak/http/httpd.cpp +++ b/xmrstak/http/httpd.cpp @@ -86,7 +86,7 @@ int httpd::req_handler(void * cls, return ret; } } - + *ptr = nullptr; std::string str; if(strcasecmp(url, "/style.css") == 0) diff --git a/xmrstak/http/webdesign.cpp b/xmrstak/http/webdesign.cpp index 963c080..c31d6c6 100644 --- a/xmrstak/http/webdesign.cpp +++ b/xmrstak/http/webdesign.cpp @@ -106,7 +106,7 @@ extern const char sHtmlCssFile [] = "padding: 0.5em 0em;" "font-weight: bold;" "}" - + ".motd-body {" "overflow: hidden;" "}"; diff --git a/xmrstak/jconf.cpp b/xmrstak/jconf.cpp index a617f96..462f564 100644 --- a/xmrstak/jconf.cpp +++ b/xmrstak/jconf.cpp @@ -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++) { diff --git a/xmrstak/jconf.hpp b/xmrstak/jconf.hpp index 131263e..df1bf79 100644 --- a/xmrstak/jconf.hpp +++ b/xmrstak/jconf.hpp @@ -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(); diff --git a/xmrstak/misc/configEditor.hpp b/xmrstak/misc/configEditor.hpp index 4ab2030..a840bc4 100644 --- a/xmrstak/misc/configEditor.hpp +++ b/xmrstak/misc/configEditor.hpp @@ -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 diff --git a/xmrstak/misc/executor.cpp b/xmrstak/misc/executor.cpp index 43e3d6b..dea1dab 100644 --- a/xmrstak/misc/executor.cpp +++ b/xmrstak/misc/executor.cpp @@ -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 diff --git a/xmrstak/misc/executor.hpp b/xmrstak/misc/executor.hpp index c90e864..c2caa39 100644 --- a/xmrstak/misc/executor.hpp +++ b/xmrstak/misc/executor.hpp @@ -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); diff --git a/xmrstak/misc/thdq.hpp b/xmrstak/misc/thdq.hpp index 248c807..7a4a5cf 100644 --- a/xmrstak/misc/thdq.hpp +++ b/xmrstak/misc/thdq.hpp @@ -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_;
diff --git a/xmrstak/net/jpsock.cpp b/xmrstak/net/jpsock.cpp index cc29375..36c901e 100644 --- a/xmrstak/net/jpsock.cpp +++ b/xmrstak/net/jpsock.cpp @@ -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) { diff --git a/xmrstak/params.hpp b/xmrstak/params.hpp index 1551378..2aedc38 100644 --- a/xmrstak/params.hpp +++ b/xmrstak/params.hpp @@ -46,7 +46,7 @@ struct params configFileCPU("cpu.txt"), configFileNVIDIA("nvidia.txt") {} - + }; } // namepsace xmrstak |