aboutsummaryrefslogtreecommitdiff
path: root/main.cpp
diff options
context:
space:
mode:
authors_nakamoto <s_nakamoto@1a98c847-1fd6-4fd8-948a-caf3550aa51b>2010-07-08 16:14:56 +0000
committers_nakamoto <s_nakamoto@1a98c847-1fd6-4fd8-948a-caf3550aa51b>2010-07-08 16:14:56 +0000
commita280b4e661560943265cb443745b0b08374985a2 (patch)
tree23e8847e09abe899fa9cba862f96e7d924dc484c /main.cpp
parent603c7ccea84a6e906c9095d73dff8552e79bb5ac (diff)
downloadbitcoin-a280b4e661560943265cb443745b0b08374985a2.tar.xz
Laszlo's fix to make generate threads idle priority on Linux,
replaced some wxBase dependencies: wxMutex, wxFileExists, wxStandardPaths, wxGetLocalTimeMillis
Diffstat (limited to 'main.cpp')
-rw-r--r--main.cpp42
1 files changed, 26 insertions, 16 deletions
diff --git a/main.cpp b/main.cpp
index 2b08744d4e..803548e61e 100644
--- a/main.cpp
+++ b/main.cpp
@@ -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);
+ }
+ }
}
}