Log high SHAMap destroy times in ~Ledger

This commit is contained in:
Vinnie Falco
2013-08-22 15:23:54 -07:00
parent 8b86b81fc9
commit 663d5c9cee
2 changed files with 39 additions and 0 deletions

View File

@@ -172,6 +172,43 @@ Ledger::Ledger (const std::string& rawLedger, bool hasPrefix) :
initializeFees ();
}
Ledger::~Ledger ()
{
double txDeleteSeconds = 0;
{
int64 const startTime (Time::getHighResolutionTicks ());
mTransactionMap.reset ();
txDeleteSeconds = Time::highResolutionTicksToSeconds (
Time::getHighResolutionTicks () - startTime);
}
double acctDeleteSeconds = 0;
{
int64 const startTime (Time::getHighResolutionTicks ());
mAccountStateMap.reset ();
acctDeleteSeconds = Time::highResolutionTicksToSeconds (
Time::getHighResolutionTicks () - startTime);
}
if (txDeleteSeconds >= 1)
{
WriteLog (lsWARNING, Ledger) << "mTransactionMap took " <<
String (txDeleteSeconds, 1) << " seconds to destroy.";
}
if (acctDeleteSeconds >= 1)
{
WriteLog (lsWARNING, Ledger) << "mAccountStateMap took " <<
String (acctDeleteSeconds, 1) << " seconds to destroy.";
}
}
void Ledger::setImmutable ()
{
updateHash ();

View File

@@ -80,6 +80,8 @@ public:
Ledger (Ledger & target, bool isMutable); // snapshot
~Ledger ();
static Ledger::pointer getSQL (const std::string & sqlStatement);
static Ledger::pointer getSQL1 (SqliteStatement*);
static void getSQL2 (Ledger::ref);