diff options
Diffstat (limited to 'main.cpp')
-rw-r--r-- | main.cpp | 42 |
1 files changed, 26 insertions, 16 deletions
@@ -1477,7 +1477,10 @@ bool CheckDiskSpace(int64 nAdditionalBytes) if (nFreeBytesAvailable < (int64)15000000 + nAdditionalBytes)
{
fShutdown = true;
+ printf("*** %s***\n", _("Warning: Disk space is low "));
+#if wxUSE_GUI
ThreadSafeMessageBox(_("Warning: Disk space is low "), "Bitcoin", wxOK | wxICON_EXCLAMATION);
+#endif
CreateThread(Shutdown, NULL);
return false;
}
@@ -2713,25 +2716,32 @@ void BitcoinMiner() if ((++tmp.block.nNonce & nMask) == 0)
{
// Meter hashes/sec
- static int64 nHashCounter;
- static int64 nLastTick;
- if (nLastTick == 0)
- nLastTick = GetTimeMillis();
+ static int64 nTimerStart;
+ static int nHashCounter;
+ if (nTimerStart == 0)
+ nTimerStart = GetTimeMillis();
else
- nHashCounter += nMask + 1;
- if (GetTimeMillis() - nLastTick > 4000)
+ nHashCounter++;
+ if (GetTimeMillis() - nTimerStart > 4000)
{
- double dHashesPerSec = 1000.0 * nHashCounter / (GetTimeMillis() - nLastTick);
- nLastTick = GetTimeMillis();
- nHashCounter = 0;
- string strStatus = strprintf(" %.0f khash/s", dHashesPerSec/1000.0);
- UIThreadCall(bind(CalledSetStatusBar, strStatus, 0));
- static int64 nLogTime;
- if (GetTime() - nLogTime > 30 * 60)
+ static CCriticalSection cs;
+ CRITICAL_BLOCK(cs)
{
- nLogTime = GetTime();
- printf("%s ", DateTimeStrFormat("%x %H:%M", GetTime()).c_str());
- printf("hashmeter %3d CPUs %6.0f khash/s\n", vnThreadsRunning[3], dHashesPerSec/1000.0);
+ if (GetTimeMillis() - nTimerStart > 4000)
+ {
+ double dHashesPerSec = 1000.0 * (nMask+1) * nHashCounter / (GetTimeMillis() - nTimerStart);
+ nTimerStart = GetTimeMillis();
+ nHashCounter = 0;
+ string strStatus = strprintf(" %.0f khash/s", dHashesPerSec/1000.0);
+ UIThreadCall(bind(CalledSetStatusBar, strStatus, 0));
+ static int64 nLogTime;
+ if (GetTime() - nLogTime > 30 * 60)
+ {
+ nLogTime = GetTime();
+ printf("%s ", DateTimeStrFormat("%x %H:%M", GetTime()).c_str());
+ printf("hashmeter %3d CPUs %6.0f khash/s\n", vnThreadsRunning[3], dHashesPerSec/1000.0);
+ }
+ }
}
}
|