GhostRider hotfixes

- Added average hashrate display
- Fixed the number of threads shown at startup
- Fixed `--threads` or `-t` command line option (but `--cpu-max-threads-hint` is recommended to use)
This commit is contained in:
SChernykh 2021-11-27 12:18:19 +01:00
parent 01fa968763
commit c6292ce9ee
10 changed files with 63 additions and 9 deletions

View file

@ -53,6 +53,9 @@ xmrig::Hashrate::Hashrate(size_t threads) :
m_timestamps[i] = new uint64_t[kBucketSize]();
m_top[i] = 0;
}
m_earliestTimestamp = std::numeric_limits<uint64_t>::max();
m_totalCount = 0;
}
@ -66,6 +69,14 @@ xmrig::Hashrate::~Hashrate()
delete [] m_counts;
delete [] m_timestamps;
delete [] m_top;
}
double xmrig::Hashrate::average() const
{
const uint64_t ts = Chrono::steadyMSecs();
return (ts > m_earliestTimestamp) ? (m_totalCount * 1e3 / (ts - m_earliestTimestamp)) : 0.0;
}
@ -167,4 +178,11 @@ void xmrig::Hashrate::addData(size_t index, uint64_t count, uint64_t timestamp)
m_timestamps[index][top] = timestamp;
m_top[index] = (top + 1) & kBucketMask;
if (index == 0) {
if (m_earliestTimestamp == std::numeric_limits<uint64_t>::max()) {
m_earliestTimestamp = timestamp;
}
m_totalCount = count;
}
}

View file

@ -53,6 +53,8 @@ public:
inline void add(size_t threadId, uint64_t count, uint64_t timestamp) { addData(threadId + 1U, count, timestamp); }
inline void add(uint64_t count, uint64_t timestamp) { addData(0U, count, timestamp); }
double average() const;
static const char *format(double h, char *buf, size_t size);
static rapidjson::Value normalize(double d);
@ -72,6 +74,9 @@ private:
uint32_t* m_top;
uint64_t** m_counts;
uint64_t** m_timestamps;
uint64_t m_earliestTimestamp;
uint64_t m_totalCount;
};

View file

@ -31,6 +31,8 @@ class Worker : public IWorker
public:
Worker(size_t id, int64_t affinity, int priority);
size_t threads() const override { return 1; }
protected:
inline int64_t affinity() const { return m_affinity; }
inline size_t id() const override { return m_id; }

View file

@ -46,6 +46,7 @@ public:
virtual const VirtualMemory *memory() const = 0;
virtual size_t id() const = 0;
virtual size_t intensity() const = 0;
virtual size_t threads() const = 0;
virtual void hashrateData(uint64_t &hashCount, uint64_t &timeStamp, uint64_t &rawHashes) const = 0;
virtual void jobEarlyNotification(const Job &job) = 0;
virtual void start() = 0;

View file

@ -88,6 +88,7 @@ public:
{
if (ready) {
m_started++;
m_totalStarted += worker->threads();
if (m_workersMemory.insert(worker->memory()).second) {
m_hugePages += worker->memory()->hugePages();
@ -112,7 +113,7 @@ public:
LOG_INFO("%s" GREEN_BOLD(" READY") " threads %s%zu/%zu (%zu)" CLEAR " huge pages %s%1.0f%% %zu/%zu" CLEAR " memory " CYAN_BOLD("%zu KB") BLACK_BOLD(" (%" PRIu64 " ms)"),
Tags::cpu(),
m_errors == 0 ? CYAN_BOLD_S : YELLOW_BOLD_S,
m_started, m_threads, m_ways,
m_totalStarted, std::max(m_totalStarted, m_threads), m_ways,
(m_hugePages.isFullyAllocated() ? GREEN_BOLD_S : (m_hugePages.allocated == 0 ? RED_BOLD_S : YELLOW_BOLD_S)),
m_hugePages.percent(),
m_hugePages.allocated, m_hugePages.total,
@ -127,6 +128,7 @@ private:
size_t m_errors = 0;
size_t m_memory = 0;
size_t m_started = 0;
size_t m_totalStarted = 0;
size_t m_threads = 0;
size_t m_ways = 0;
uint64_t m_ts = 0;

View file

@ -44,7 +44,7 @@ xmrig::CpuLaunchData::CpuLaunchData(const Miner *miner, const Algorithm &algorit
affinity(thread.affinity()),
miner(miner),
threads(threads),
intensity(std::min<uint32_t>(thread.intensity(), algorithm.maxIntensity())),
intensity(std::max<uint32_t>(std::min<uint32_t>(thread.intensity(), algorithm.maxIntensity()), algorithm.minIntensity())),
affinities(affinities)
{
}

View file

@ -52,6 +52,15 @@ public:
CpuWorker(size_t id, const CpuLaunchData &data);
~CpuWorker() override;
size_t threads() const override
{
# ifdef XMRIG_ALGO_GHOSTRIDER
return m_ghHelper ? 2 : 1;
# else
return 1;
# endif
}
protected:
bool selfTest() override;
void hashrateData(uint64_t &hashCount, uint64_t &timeStamp, uint64_t &rawHashes) const override;