From f237187b0d6d62e919b7126f02d096cf3ef64a08 Mon Sep 17 00:00:00 2001 From: Nik Bougalis Date: Tue, 9 Jun 2015 01:05:55 -0700 Subject: [PATCH] Remove cache sweep profiling --- Builds/VisualStudio2013/RippleD.vcxproj | 2 - .../VisualStudio2013/RippleD.vcxproj.filters | 3 - src/ripple/app/ledger/Ledger.cpp | 10 -- src/ripple/app/main/Application.cpp | 44 ++---- src/ripple/basics/LoggedTimings.h | 132 ------------------ 5 files changed, 11 insertions(+), 180 deletions(-) delete mode 100644 src/ripple/basics/LoggedTimings.h diff --git a/Builds/VisualStudio2013/RippleD.vcxproj b/Builds/VisualStudio2013/RippleD.vcxproj index 7df5c47eaf..e11a5a3939 100644 --- a/Builds/VisualStudio2013/RippleD.vcxproj +++ b/Builds/VisualStudio2013/RippleD.vcxproj @@ -1978,8 +1978,6 @@ - - diff --git a/Builds/VisualStudio2013/RippleD.vcxproj.filters b/Builds/VisualStudio2013/RippleD.vcxproj.filters index 5965585a70..a9ef17e2df 100644 --- a/Builds/VisualStudio2013/RippleD.vcxproj.filters +++ b/Builds/VisualStudio2013/RippleD.vcxproj.filters @@ -2682,9 +2682,6 @@ ripple\basics - - ripple\basics - ripple\basics diff --git a/src/ripple/app/ledger/Ledger.cpp b/src/ripple/app/ledger/Ledger.cpp index c7fba64843..fdba43afc1 100644 --- a/src/ripple/app/ledger/Ledger.cpp +++ b/src/ripple/app/ledger/Ledger.cpp @@ -31,7 +31,6 @@ #include #include #include -#include #include #include #include @@ -221,15 +220,6 @@ Ledger::Ledger (std::uint32_t ledgerSeq, std::uint32_t closeTime) Ledger::~Ledger () { - if (mTransactionMap) - { - logTimedDestroy (mTransactionMap, "mTransactionMap"); - } - - if (mAccountStateMap) - { - logTimedDestroy (mAccountStateMap, "mAccountStateMap"); - } } void Ledger::setImmutable () diff --git a/src/ripple/app/main/Application.cpp b/src/ripple/app/main/Application.cpp index 3f8b181202..9cb60d8f65 100644 --- a/src/ripple/app/main/Application.cpp +++ b/src/ripple/app/main/Application.cpp @@ -44,7 +44,6 @@ #include #include #include -#include #include #include #include @@ -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)); diff --git a/src/ripple/basics/LoggedTimings.h b/src/ripple/basics/LoggedTimings.h deleted file mode 100644 index 4260ea8f3e..0000000000 --- a/src/ripple/basics/LoggedTimings.h +++ /dev/null @@ -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 -#include -#include -#include - -namespace ripple { - -namespace detail { - -/** Template class that performs destruction of an object. - Default implementation simply calls delete -*/ -template -struct Destroyer; - -/** Specialization for std::shared_ptr. -*/ -template -struct Destroyer > -{ - static void destroy (std::shared_ptr & p) - { - p.reset (); - } -}; - -/** Specialization for std::unordered_map -*/ -template -struct Destroyer > -{ - static void destroy (std::unordered_map & 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 ((seconds * 10 + 0.5) / 10); -} - -} // detail - -//------------------------------------------------------------------------------ - -/** Measure the time required to destroy an object. -*/ - -template -double timedDestroy (Object& object) -{ - std::int64_t const startTime (beast::Time::getHighResolutionTicks ()); - - detail::Destroyer ::destroy (object); - - return beast::Time::highResolutionTicksToSeconds ( - beast::Time::getHighResolutionTicks () - startTime); -} - -/** Log the timed destruction of an object if the time exceeds a threshold. -*/ -template -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 -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