mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-10 22:18:54 +01:00
Laszlo's fix to make generate threads idle priority on Linux,
replaced some wxBase dependencies: wxMutex, wxFileExists, wxStandardPaths, wxGetLocalTimeMillis git-svn-id: https://bitcoin.svn.sourceforge.net/svnroot/bitcoin/trunk@99 1a98c847-1fd6-4fd8-948a-caf3550aa51b
This commit is contained in:
42
main.cpp
42
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user