Remove cache sweep profiling

This commit is contained in:
Nik Bougalis
2015-06-09 01:05:55 -07:00
parent 187b4caf3c
commit f237187b0d
5 changed files with 11 additions and 180 deletions

View File

@@ -1978,8 +1978,6 @@
</ClInclude>
<ClInclude Include="..\..\src\ripple\basics\Log.h">
</ClInclude>
<ClInclude Include="..\..\src\ripple\basics\LoggedTimings.h">
</ClInclude>
<ClInclude Include="..\..\src\ripple\basics\make_SSLContext.h">
</ClInclude>
<ClInclude Include="..\..\src\ripple\basics\RangeSet.h">

View File

@@ -2682,9 +2682,6 @@
<ClInclude Include="..\..\src\ripple\basics\Log.h">
<Filter>ripple\basics</Filter>
</ClInclude>
<ClInclude Include="..\..\src\ripple\basics\LoggedTimings.h">
<Filter>ripple\basics</Filter>
</ClInclude>
<ClInclude Include="..\..\src\ripple\basics\make_SSLContext.h">
<Filter>ripple\basics</Filter>
</ClInclude>

View File

@@ -31,7 +31,6 @@
#include <ripple/app/misc/NetworkOPs.h>
#include <ripple/app/tx/TransactionMaster.h>
#include <ripple/basics/Log.h>
#include <ripple/basics/LoggedTimings.h>
#include <ripple/basics/SHA512Half.h>
#include <ripple/basics/StringUtilities.h>
#include <ripple/core/DatabaseCon.h>
@@ -221,15 +220,6 @@ Ledger::Ledger (std::uint32_t ledgerSeq, std::uint32_t closeTime)
Ledger::~Ledger ()
{
if (mTransactionMap)
{
logTimedDestroy <Ledger> (mTransactionMap, "mTransactionMap");
}
if (mAccountStateMap)
{
logTimedDestroy <Ledger> (mAccountStateMap, "mAccountStateMap");
}
}
void Ledger::setImmutable ()

View File

@@ -44,7 +44,6 @@
#include <ripple/app/tx/InboundTransactions.h>
#include <ripple/app/tx/TransactionMaster.h>
#include <ripple/basics/Log.h>
#include <ripple/basics/LoggedTimings.h>
#include <ripple/basics/ResolverAsio.h>
#include <ripple/basics/Sustain.h>
#include <ripple/basics/seconds_clock.h>
@@ -1001,39 +1000,18 @@ public:
// VFALCO NOTE Does the order of calls matter?
// VFALCO TODO fix the dependency inversion using an observer,
// have listeners register for "onSweep ()" notification.
//
family_.fullbelow().sweep ();
logTimedCall (m_journal.warning, "TransactionMaster::sweep", __FILE__, __LINE__, std::bind (
&TransactionMaster::sweep, &m_txMaster));
logTimedCall (m_journal.warning, "NodeStore::sweep", __FILE__, __LINE__, std::bind (
&NodeStore::Database::sweep, m_nodeStore.get()));
logTimedCall (m_journal.warning, "LedgerMaster::sweep", __FILE__, __LINE__, std::bind (
&LedgerMaster::sweep, m_ledgerMaster.get()));
logTimedCall (m_journal.warning, "TempNodeCache::sweep", __FILE__, __LINE__, std::bind (
&NodeCache::sweep, &m_tempNodeCache));
logTimedCall (m_journal.warning, "Validations::sweep", __FILE__, __LINE__, std::bind (
&Validations::sweep, mValidations.get ()));
logTimedCall (m_journal.warning, "InboundLedgers::sweep", __FILE__, __LINE__, std::bind (
&InboundLedgers::sweep, &getInboundLedgers ()));
logTimedCall (m_journal.warning, "SLECache::sweep", __FILE__, __LINE__, std::bind (
&SLECache::sweep, &m_sleCache));
logTimedCall (m_journal.warning, "AcceptedLedger::sweep", __FILE__, __LINE__,
&AcceptedLedger::sweep);
logTimedCall (m_journal.warning, "SHAMap::sweep", __FILE__, __LINE__,std::bind (
&TreeNodeCache::sweep, &family().treecache()));
logTimedCall (m_journal.warning, "NetworkOPs::sweepFetchPack", __FILE__, __LINE__, std::bind (
&NetworkOPs::sweepFetchPack, m_networkOPs.get ()));
family().fullbelow().sweep ();
getMasterTransaction().sweep();
getNodeStore().sweep();
getLedgerMaster().sweep();
getTempNodeCache().sweep();
getValidations().sweep();
getInboundLedgers().sweep();
getSLECache().sweep();
AcceptedLedger::sweep();
family().treecache().sweep();
getOPs().sweepFetchPack();
// VFALCO NOTE does the call to sweep() happen on another thread?
m_sweepTimer.setExpiration (getConfig ().getSize (siSweepInterval));

View File

@@ -1,132 +0,0 @@
//------------------------------------------------------------------------------
/*
This file is part of rippled: https://github.com/ripple/rippled
Copyright (c) 2012, 2013 Ripple Labs Inc.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
//==============================================================================
#ifndef RIPPLE_BASICS_LOGGEDTIMINGS_H_INCLUDED
#define RIPPLE_BASICS_LOGGEDTIMINGS_H_INCLUDED
#include <ripple/basics/Log.h>
#include <beast/module/core/time/Time.h>
#include <beast/module/core/diagnostic/MeasureFunctionCallTime.h>
#include <beast/utility/Debug.h>
namespace ripple {
namespace detail {
/** Template class that performs destruction of an object.
Default implementation simply calls delete
*/
template <typename Object>
struct Destroyer;
/** Specialization for std::shared_ptr.
*/
template <typename Object>
struct Destroyer <std::shared_ptr <Object> >
{
static void destroy (std::shared_ptr <Object>& p)
{
p.reset ();
}
};
/** Specialization for std::unordered_map
*/
template <typename Key, typename Value, typename Hash, typename Alloc>
struct Destroyer <std::unordered_map <Key, Value, Hash, Alloc> >
{
static void destroy (std::unordered_map <Key, Value, Hash, Alloc>& v)
{
v.clear ();
}
};
/** Cleans up an elaspsed time so it prints nicely */
inline double cleanElapsed (double seconds) noexcept
{
if (seconds >= 10)
return std::floor (seconds + 0.5);
return static_cast <int> ((seconds * 10 + 0.5) / 10);
}
} // detail
//------------------------------------------------------------------------------
/** Measure the time required to destroy an object.
*/
template <typename Object>
double timedDestroy (Object& object)
{
std::int64_t const startTime (beast::Time::getHighResolutionTicks ());
detail::Destroyer <Object>::destroy (object);
return beast::Time::highResolutionTicksToSeconds (
beast::Time::getHighResolutionTicks () - startTime);
}
/** Log the timed destruction of an object if the time exceeds a threshold.
*/
template <typename PartitionKey, typename Object>
void logTimedDestroy (
Object& object,
std::string const& objectDescription,
double thresholdSeconds = 1)
{
double const seconds = timedDestroy (object);
if (seconds > thresholdSeconds)
{
deprecatedLogs().journal("LoggedTimings").warning <<
objectDescription << " took " <<
detail::cleanElapsed (seconds) <<
" seconds to destroy";
}
}
//------------------------------------------------------------------------------
/** Log a timed function call if the time exceeds a threshold. */
template <typename Function>
void logTimedCall (
beast::Journal::Stream stream,
std::string const& description,
char const* fileName,
int lineNumber,
Function f,
double thresholdSeconds = 1)
{
double const seconds = beast::measureFunctionCallTime (f);
if (seconds > thresholdSeconds)
{
stream <<
description << " took "<<
detail::cleanElapsed (seconds) <<
" seconds to execute at " <<
beast::Debug::getSourceLocation (fileName, lineNumber);
}
}
} // ripple
#endif