Skip to content
Snippets Groups Projects
Commit 13433097 authored by psychocrypt's avatar psychocrypt
Browse files

add backend type

- add type of the backend to each backend-plugin
- add `gteName` to `iBackend` to get the name of the backend
parent 22039b2a
No related branches found
No related tags found
No related merge requests found
...@@ -49,6 +49,7 @@ namespace amd ...@@ -49,6 +49,7 @@ namespace amd
minethd::minethd(miner_work& pWork, size_t iNo, GpuContext* ctx, const jconf::thd_cfg cfg) minethd::minethd(miner_work& pWork, size_t iNo, GpuContext* ctx, const jconf::thd_cfg cfg)
{ {
this->backendType = iBackend::AMD;
oWork = pWork; oWork = pWork;
bQuit = 0; bQuit = 0;
iThreadNo = (uint8_t)iNo; iThreadNo = (uint8_t)iNo;
......
...@@ -94,6 +94,7 @@ bool minethd::thd_setaffinity(std::thread::native_handle_type h, uint64_t cpu_id ...@@ -94,6 +94,7 @@ bool minethd::thd_setaffinity(std::thread::native_handle_type h, uint64_t cpu_id
minethd::minethd(miner_work& pWork, size_t iNo, bool double_work, bool no_prefetch, int64_t affinity) minethd::minethd(miner_work& pWork, size_t iNo, bool double_work, bool no_prefetch, int64_t affinity)
{ {
this->backendType = iBackend::CPU;
oWork = pWork; oWork = pWork;
bQuit = 0; bQuit = 0;
iThreadNo = (uint8_t)iNo; iThreadNo = (uint8_t)iNo;
......
...@@ -5,15 +5,31 @@ ...@@ -5,15 +5,31 @@
#include <atomic> #include <atomic>
#include <cstdint> #include <cstdint>
#include <climits> #include <climits>
#include <vector>
#include <string>
namespace xmrstak namespace xmrstak
{ {
struct iBackend struct iBackend
{ {
enum BackendType : uint32_t { UNKNOWN = 0, CPU = 1u, AMD = 2u, NVIDIA = 3u };
static std::string getName(const BackendType type)
{
std::vector<std::string> backendNames = {
"UNKNOWN",
"CPU",
"AMD",
"NVIDIA"
};
return backendNames[static_cast<uint32_t>(type)];
}
std::atomic<uint64_t> iHashCount; std::atomic<uint64_t> iHashCount;
std::atomic<uint64_t> iTimestamp; std::atomic<uint64_t> iTimestamp;
uint32_t iThreadNo; uint32_t iThreadNo;
BackendType backendType = UNKNOWN;
iBackend() : iHashCount(0), iTimestamp(0) iBackend() : iHashCount(0), iTimestamp(0)
{ {
......
...@@ -66,6 +66,7 @@ namespace nvidia ...@@ -66,6 +66,7 @@ namespace nvidia
minethd::minethd(miner_work& pWork, size_t iNo, const jconf::thd_cfg& cfg) minethd::minethd(miner_work& pWork, size_t iNo, const jconf::thd_cfg& cfg)
{ {
this->backendType = iBackend::NVIDIA;
oWork = pWork; oWork = pWork;
bQuit = 0; bQuit = 0;
iThreadNo = (uint8_t)iNo; iThreadNo = (uint8_t)iNo;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment