Added hashrate to reports.

This commit is contained in:
XMRig 2017-09-01 03:45:08 +03:00
parent 30dd7d6fe4
commit 1651b041de
7 changed files with 99 additions and 7 deletions

View file

@ -153,10 +153,10 @@ void Hashrate::print()
char num4[8];
LOG_INFO(Options::i()->colors() ? "\x1B[01;37mspeed\x1B[0m 2.5s/60s/15m \x1B[01;36m%s \x1B[22;36m%s %s \x1B[01;36mH/s\x1B[0m max: \x1B[01;36m%s H/s" : "speed 2.5s/60s/15m %s %s %s H/s max: %s H/s",
format(calc(2500), num1, sizeof(num1)),
format(calc(60000), num2, sizeof(num2)),
format(calc(900000), num3, sizeof(num3)),
format(m_highest, num4, sizeof(num4))
format(calc(ShortInterval), num1, sizeof(num1)),
format(calc(MediumInterval), num2, sizeof(num2)),
format(calc(LargeInterval), num3, sizeof(num3)),
format(m_highest, num4, sizeof(num4))
);
}
@ -169,7 +169,7 @@ void Hashrate::stop()
void Hashrate::updateHighest()
{
double highest = calc(2500);
double highest = calc(ShortInterval);
if (std::isnormal(highest) && highest > m_highest) {
m_highest = highest;
}

View file

@ -32,6 +32,12 @@
class Hashrate
{
public:
enum Intervals {
ShortInterval = 2500,
MediumInterval = 60000,
LargeInterval = 900000
};
Hashrate(int threads);
double calc(size_t ms) const;
double calc(size_t threadId, size_t ms) const;
@ -41,6 +47,7 @@ public:
void updateHighest();
inline double highest() const { return m_highest; }
inline int threads() const { return m_threads; }
private:
static void onReport(uv_timer_t *handle);

View file

@ -24,6 +24,7 @@
#include <cmath>
#include "api/Api.h"
#include "interfaces/IJobResultListener.h"
#include "Mem.h"
#include "Options.h"
@ -192,4 +193,6 @@ void Workers::onTick(uv_timer_t *handle)
if ((m_ticks++ & 0xF) == 0) {
m_hashrate->updateHighest();
}
Api::tick(m_hashrate);
}