This repository was archived by the owner on Apr 24, 2022. It is now read-only.
File tree 2 files changed +12
-15
lines changed
2 files changed +12
-15
lines changed Original file line number Diff line number Diff line change @@ -33,19 +33,6 @@ bool Miner::s_exit = false;
33
33
34
34
bool Miner::s_noeval = false ;
35
35
36
- void Miner::updateHashRate (uint64_t n)
37
- {
38
- m_hashCounter = n;
39
- std::chrono::steady_clock::time_point t = std::chrono::steady_clock::now ();
40
- float us = float (std::chrono::duration_cast<std::chrono::microseconds>(t - m_hashTime).count ());
41
- m_hashTime = t;
42
-
43
- float hr = 0 ;
44
- if (us)
45
- hr = float (m_hashCounter) / (us / 1000000.0 );
46
- m_hashRate.store (hr, std::memory_order_relaxed);
47
- }
48
-
49
36
std::ostream& operator <<(std::ostream& os, HwMonitor _hw)
50
37
{
51
38
os << _hw.tempC << " C " << _hw.fanP << " %" ;
Original file line number Diff line number Diff line change @@ -286,7 +286,18 @@ class Miner : public Worker
286
286
return m_work;
287
287
}
288
288
289
- void updateHashRate (uint64_t _n);
289
+ inline void updateHashRate (uint64_t _n)
290
+ {
291
+ using namespace std ::chrono;
292
+ steady_clock::time_point t = steady_clock::now ();
293
+ auto us = duration_cast<microseconds>(t - m_hashTime).count ();
294
+ m_hashTime = t;
295
+
296
+ float hr = 0.0 ;
297
+ if (us)
298
+ hr = (float (_n) * 1 .0e6f) / us;
299
+ m_hashRate.store (hr, std::memory_order_relaxed);
300
+ }
290
301
291
302
static unsigned s_dagLoadMode;
292
303
static unsigned s_dagLoadIndex;
@@ -305,7 +316,6 @@ class Miner : public Worker
305
316
WorkPackage m_work;
306
317
mutable Mutex x_work;
307
318
std::chrono::steady_clock::time_point m_hashTime = std::chrono::steady_clock::now();
308
- uint64_t m_hashCounter = 0 ;
309
319
std::atomic<float > m_hashRate = {0.0 };
310
320
};
311
321
You can’t perform that action at this time.
0 commit comments