Move InstanceCounter to ripple_basics

This commit is contained in:
Vinnie Falco
2013-05-30 09:37:31 -07:00
parent 827b5c4b10
commit 47e00f20fb
25 changed files with 27 additions and 42 deletions

View File

@@ -69,6 +69,7 @@
#include "utility/ripple_ByteOrder.cpp"
#include "utility/ripple_DiffieHellmanUtil.cpp"
#include "utility/ripple_InstanceCounter.cpp"
#include "utility/ripple_StringUtilities.cpp"
#include "utility/ripple_Sustain.cpp"
#include "utility/ripple_ThreadName.cpp"

View File

@@ -74,6 +74,11 @@ namespace boost {
#include <boost/foreach.hpp>
#include <boost/icl/interval_set.hpp> // oof this one is ugly
// InstanceCounter
//#include <string>
//#include <vector>
//#include <boost/thread/mutex.hpp>
// TaggedCache
#include <boost/thread/recursive_mutex.hpp>
#include <boost/unordered_map.hpp>
@@ -126,6 +131,7 @@ namespace boost {
#include "utility/ripple_ByteOrder.h"
#include "utility/ripple_DiffieHellmanUtil.h"
#include "utility/ripple_InstanceCounter.h"
#include "utility/ripple_PlatformMacros.h"
#include "utility/ripple_RandomNumbers.h"
#include "utility/ripple_ScopedLock.h"

View File

@@ -1,4 +1,3 @@
#include "InstanceCounter.h"
InstanceType* InstanceType::sHeadInstance = NULL;
bool InstanceType::sMultiThreaded = false;

View File

@@ -1,10 +1,9 @@
#ifndef INSTANCE_COUNTER__H
#define INSTANCE_COUNTER__H
#ifndef RIPPLE_INSTANCECOUNTER_H
#define RIPPLE_INSTANCECOUNTER_H
#include <string>
#include <vector>
#include <boost/thread/mutex.hpp>
// VFALCO: TODO Clean up this junk, remove the macros, replace
// with a robust leak checker when we have atomics.
//
#define DEFINE_INSTANCE(x) \
extern InstanceType IT_##x; \
@@ -23,6 +22,7 @@
#define IS_INSTANCE(x) Instance_##x
// VFALCO: NOTE, that this is just a glorified leak checker with an awkward API
class InstanceType
{
protected:
@@ -64,6 +64,7 @@ public:
{
if (sMultiThreaded)
{
// VFALCO: NOTE, Junk that will go away with atomics
mLock.lock();
++mInstances;
mLock.unlock();

View File

@@ -36,7 +36,6 @@
#include "src/cpp/ripple/Application.cpp"
#include "src/cpp/ripple/Config.cpp" // no log
#include "src/cpp/ripple/InstanceCounter.cpp" // no log
#include "src/cpp/ripple/JobQueue.cpp"
#include "src/cpp/ripple/LoadManager.cpp"
#include "src/cpp/ripple/LoadMonitor.cpp"

View File

@@ -192,6 +192,12 @@
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="modules\ripple_basics\utility\ripple_InstanceCounter.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="modules\ripple_basics\utility\ripple_Log.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
@@ -766,12 +772,6 @@
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="src\cpp\ripple\InstanceCounter.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="src\cpp\ripple\Interpreter.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
@@ -1235,6 +1235,7 @@
<ClInclude Include="modules\ripple_basics\utility\ripple_ByteOrder.h" />
<ClInclude Include="modules\ripple_basics\utility\ripple_DiffieHellmanUtil.h" />
<ClInclude Include="modules\ripple_basics\utility\ripple_HashUtilities.h" />
<ClInclude Include="modules\ripple_basics\utility\ripple_InstanceCounter.h" />
<ClInclude Include="modules\ripple_basics\utility\ripple_IntegerTypes.h" />
<ClInclude Include="modules\ripple_basics\utility\ripple_Log.h" />
<ClInclude Include="modules\ripple_basics\utility\ripple_PlatformMacros.h" />
@@ -1599,7 +1600,6 @@
<ClInclude Include="src\cpp\ripple\HashPrefixes.h" />
<ClInclude Include="src\cpp\ripple\HTTPRequest.h" />
<ClInclude Include="src\cpp\ripple\HttpsClient.h" />
<ClInclude Include="src\cpp\ripple\InstanceCounter.h" />
<ClInclude Include="src\cpp\ripple\Interpreter.h" />
<ClInclude Include="src\cpp\ripple\JobQueue.h" />
<ClInclude Include="src\cpp\ripple\Ledger.h" />

View File

@@ -609,9 +609,6 @@
<ClCompile Include="src\cpp\ripple\Config.cpp">
<Filter>1. Modules\ripple_main\_old</Filter>
</ClCompile>
<ClCompile Include="src\cpp\ripple\InstanceCounter.cpp">
<Filter>1. Modules\ripple_main\_old</Filter>
</ClCompile>
<ClCompile Include="src\cpp\ripple\JobQueue.cpp">
<Filter>1. Modules\ripple_main\_old</Filter>
</ClCompile>
@@ -786,6 +783,9 @@
<ClCompile Include="modules\ripple_data\crypto\ripple_CKeyDeterministic.cpp">
<Filter>1. Modules\ripple_data\types</Filter>
</ClCompile>
<ClCompile Include="modules\ripple_basics\utility\ripple_InstanceCounter.cpp">
<Filter>1. Modules\ripple_basics\utility</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="database\sqlite3ext.h">
@@ -1247,9 +1247,6 @@
<ClInclude Include="src\cpp\ripple\Config.h">
<Filter>1. Modules\ripple_main\_old</Filter>
</ClInclude>
<ClInclude Include="src\cpp\ripple\InstanceCounter.h">
<Filter>1. Modules\ripple_main\_old</Filter>
</ClInclude>
<ClInclude Include="src\cpp\ripple\JobQueue.h">
<Filter>1. Modules\ripple_main\_old</Filter>
</ClInclude>
@@ -1460,6 +1457,9 @@
<ClInclude Include="modules\ripple_basics\utility\ripple_ScopedLock.h">
<Filter>1. Modules\ripple_basics\utility</Filter>
</ClInclude>
<ClInclude Include="modules\ripple_basics\utility\ripple_InstanceCounter.h">
<Filter>1. Modules\ripple_basics\utility</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="SConstruct" />

View File

@@ -8,8 +8,6 @@
#include "modules/ripple_main/misc/ripple_HashValue.h"
#include "InstanceCounter.h"
// VFALCO: TODO, Move this to someplace sensible!!
// Adapter to furnish uptime information to KeyCache via UptimeTimer singleton

View File

@@ -13,7 +13,6 @@
#include "AccountState.h"
#include "NicknameState.h"
#include "SHAMap.h"
#include "InstanceCounter.h"
#include "LoadMonitor.h"
#include "JobQueue.h"

View File

@@ -15,7 +15,6 @@
#include "Ledger.h"
#include "Peer.h"
#include "InstanceCounter.h"
#include "ripple.pb.h"
// How long before we try again to acquire the same ledger

View File

@@ -14,7 +14,6 @@
#include "Peer.h"
#include "CanonicalTXSet.h"
#include "TransactionEngine.h"
#include "InstanceCounter.h"
#include "LoadMonitor.h"
DEFINE_INSTANCE(LedgerConsensus);

View File

@@ -7,7 +7,6 @@
#include "TransactionMeta.h"
#include "Ledger.h"
#include "TransactionErr.h"
#include "InstanceCounter.h"
DEFINE_INSTANCE(LedgerEntrySetEntry);
DEFINE_INSTANCE(LedgerEntrySet);

View File

@@ -6,7 +6,6 @@
#include <boost/shared_ptr.hpp>
#include "InstanceCounter.h"
DEFINE_INSTANCE(LedgerProposal);

View File

@@ -12,7 +12,6 @@
#include "PackedMessage.h"
#include "Ledger.h"
#include "Transaction.h"
#include "InstanceCounter.h"
#include "JobQueue.h"
#include "ProofOfWork.h"
#include "LoadManager.h"

View File

@@ -18,7 +18,6 @@
#include "RPCErr.h"
#include "AccountState.h"
#include "NicknameState.h"
#include "InstanceCounter.h"
#include "Offer.h"
#include "PFRequest.h"
#include "ProofOfWork.h"

View File

@@ -10,7 +10,6 @@
#include <boost/unordered_map.hpp>
#include "HashedObject.h"
#include "InstanceCounter.h"
DEFINE_INSTANCE(SHAMap);
DEFINE_INSTANCE(SHAMapItem);

View File

@@ -3,7 +3,6 @@
#include "SerializedObject.h"
#include "LedgerFormats.h"
#include "InstanceCounter.h"
DEFINE_INSTANCE(SerializedLedgerEntry);

View File

@@ -6,7 +6,6 @@
#include <boost/ptr_container/ptr_vector.hpp>
#include "SerializedTypes.h"
#include "InstanceCounter.h"
DEFINE_INSTANCE(SerializedObject);
DEFINE_INSTANCE(SerializedArray);

View File

@@ -7,7 +7,6 @@
#include "SerializedObject.h"
#include "TransactionFormats.h"
#include "InstanceCounter.h"
#define TXN_SQL_NEW 'N'
#define TXN_SQL_CONFLICT 'C'

View File

@@ -4,8 +4,6 @@
#include <vector>
#include <string>
#include "InstanceCounter.h"
// CAUTION: Do not create a vector (or similar container) of any object derived from
// SerializedType. Use Boost ptr_* containers. The copy assignment operator of
// SerializedType has semantics that will cause contained types to change their names

View File

@@ -2,7 +2,6 @@
#define __VALIDATION__
#include "SerializedObject.h"
#include "InstanceCounter.h"
DEFINE_INSTANCE(SerializedValidation);

View File

@@ -8,8 +8,6 @@
#include <boost/unordered_map.hpp>
#include <boost/thread/mutex.hpp>
#include "InstanceCounter.h"
DEFINE_INSTANCE(Suppression);
#define SF_RELAYED 0x01 // Has already been relayed to other nodes

View File

@@ -15,7 +15,6 @@
#include "SHAMap.h"
#include "SerializedTransaction.h"
#include "TransactionErr.h"
#include "InstanceCounter.h"
class Database;

View File

@@ -12,7 +12,6 @@
#include "SerializedLedger.h"
#include "LedgerEntrySet.h"
#include "TransactionErr.h"
#include "InstanceCounter.h"
DEFINE_INSTANCE(TransactionEngine);

View File

@@ -11,7 +11,6 @@
#include "Application.h"
#include "NetworkOPs.h"
#include "CallRPC.h"
#include "InstanceCounter.h"
#include "LoadManager.h"
#include "RPCErr.h"