aboutsummaryrefslogtreecommitdiff
path: root/main.cpp
diff options
context:
space:
mode:
authors_nakamoto <s_nakamoto@1a98c847-1fd6-4fd8-948a-caf3550aa51b>2010-06-21 01:33:44 +0000
committers_nakamoto <s_nakamoto@1a98c847-1fd6-4fd8-948a-caf3550aa51b>2010-06-21 01:33:44 +0000
commit68b973a913fd1569d3a9a444d4233b15f7866e3e (patch)
tree97973a93f646b9350a332cef285f68ec44fc68c5 /main.cpp
parent24ba1b64e93baafba2657ba7d8b63c759c3439ce (diff)
fixed colors on ubuntu lucid,v0.2.13
enabled -O2 in makefile.unix, boost removed -mt from their library names in 1.40, updated bitcoin icon, hashmeter, generated and hashmeter log entries -- version 0.2.13 git-svn-id: https://bitcoin.svn.sourceforge.net/svnroot/bitcoin/trunk@86 1a98c847-1fd6-4fd8-948a-caf3550aa51b
Diffstat (limited to 'main.cpp')
-rw-r--r--main.cpp31
1 files changed, 30 insertions, 1 deletions
diff --git a/main.cpp b/main.cpp
index 37f7742b66..0f333765c7 100644
--- a/main.cpp
+++ b/main.cpp
@@ -2487,6 +2487,7 @@ void ThreadBitcoinMiner(void* parg)
vnThreadsRunning[3]--;
PrintException(NULL, "ThreadBitcoinMiner()");
}
+ UIThreadCall(bind(CalledSetStatusBar, "", 0));
printf("ThreadBitcoinMiner exiting, %d threads remaining\n", vnThreadsRunning[3]);
}
@@ -2677,6 +2678,8 @@ void BitcoinMiner()
printf("BitcoinMiner:\n");
printf("proof-of-work found \n hash: %s \ntarget: %s\n", hash.GetHex().c_str(), hashTarget.GetHex().c_str());
pblock->print();
+ printf("%s ", DateTimeStrFormat("%x %H:%M", GetTime()).c_str());
+ printf("generated %s\n", FormatMoney(pblock->vtx[0].vout[0].nValue).c_str());
SetThreadPriority(THREAD_PRIORITY_NORMAL);
CRITICAL_BLOCK(cs_main)
@@ -2704,8 +2707,33 @@ void BitcoinMiner()
}
// Update nTime every few seconds
- if ((++tmp.block.nNonce & 0xffff) == 0)
+ const uint64 nMask = 0xffff;
+ if ((++tmp.block.nNonce & nMask) == 0)
{
+ // Meter hashes/sec
+ static int64 nHashCounter;
+ static int64 nLastTick;
+ if (nLastTick == 0)
+ nLastTick = GetTimeMillis();
+ else
+ nHashCounter += nMask + 1;
+ if (GetTimeMillis() - nLastTick > 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 > 60 * 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);
+ }
+ }
+
+ // Check for stop or if block needs to be rebuilt
if (fShutdown)
return;
if (!fGenerateBitcoins)
@@ -2738,6 +2766,7 @@ void BitcoinMiner()
}
break;
}
+
tmp.block.nTime = pblock->nTime = max(pindexPrev->GetMedianTimePast()+1, GetAdjustedTime());
}
}