mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-19 10:35:50 +00:00
Replace obsolete OncePerSecond with DeadlineTimer
This commit is contained in:
@@ -275,7 +275,6 @@
|
||||
<ClInclude Include="..\..\modules\beast_core\thread\beast_InterruptibleThread.h" />
|
||||
<ClInclude Include="..\..\modules\beast_core\thread\beast_Listeners.h" />
|
||||
<ClInclude Include="..\..\modules\beast_core\thread\beast_ManualCallQueue.h" />
|
||||
<ClInclude Include="..\..\modules\beast_core\thread\beast_OncePerSecond.h" />
|
||||
<ClInclude Include="..\..\modules\beast_core\thread\beast_ParallelFor.h" />
|
||||
<ClInclude Include="..\..\modules\beast_core\thread\beast_Semaphore.h" />
|
||||
<ClInclude Include="..\..\modules\beast_core\thread\beast_SerialFor.h" />
|
||||
@@ -1017,12 +1016,6 @@
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\modules\beast_core\thread\beast_OncePerSecond.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\beast_core\thread\beast_ParallelFor.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
|
||||
@@ -809,9 +809,6 @@
|
||||
<ClInclude Include="..\..\modules\beast_core\thread\beast_DeadlineTimer.h">
|
||||
<Filter>beast_core\thread</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\modules\beast_core\thread\beast_OncePerSecond.h">
|
||||
<Filter>beast_core\thread</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\modules\beast_core\thread\beast_CallQueue.h">
|
||||
<Filter>beast_core\thread</Filter>
|
||||
</ClInclude>
|
||||
@@ -1405,9 +1402,6 @@
|
||||
<ClCompile Include="..\..\modules\beast_core\thread\beast_DeadlineTimer.cpp">
|
||||
<Filter>beast_core\thread</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\modules\beast_core\thread\beast_OncePerSecond.cpp">
|
||||
<Filter>beast_core\thread</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\modules\beast_core\thread\beast_CallQueue.cpp">
|
||||
<Filter>beast_core\thread</Filter>
|
||||
</ClCompile>
|
||||
|
||||
@@ -213,7 +213,6 @@ namespace beast
|
||||
|
||||
#include "thread/impl/TrackedMutex.cpp"
|
||||
#include "thread/beast_DeadlineTimer.cpp"
|
||||
#include "thread/beast_OncePerSecond.cpp"
|
||||
#include "thread/beast_InterruptibleThread.cpp"
|
||||
#include "thread/beast_Semaphore.cpp"
|
||||
#include "thread/beast_CallQueue.cpp"
|
||||
|
||||
@@ -409,7 +409,6 @@ extern BEAST_API void BEAST_CALLTYPE logAssertion (char const* file, int line) n
|
||||
#include "functional/beast_Function.h"
|
||||
|
||||
#include "thread/beast_DeadlineTimer.h"
|
||||
#include "thread/beast_OncePerSecond.h"
|
||||
|
||||
#include "memory/beast_AllocatedBy.h"
|
||||
#include "memory/beast_PagedFreeStore.h"
|
||||
|
||||
@@ -81,7 +81,8 @@ inline PagedFreeStore::Page* PagedFreeStore::toPage (void* const p)
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
PagedFreeStore::PagedFreeStore (const size_t pageBytes)
|
||||
: m_pageBytes (pageBytes)
|
||||
: m_timer (this)
|
||||
, m_pageBytes (pageBytes)
|
||||
, m_pageBytesAvailable (pageBytes - Memory::sizeAdjustedForAlignment (sizeof (Page)))
|
||||
, m_newPagesLeft (int ((hardLimitMegaBytes * 1024 * 1024) / m_pageBytes))
|
||||
#if LOG_GC
|
||||
@@ -91,12 +92,12 @@ PagedFreeStore::PagedFreeStore (const size_t pageBytes)
|
||||
m_hot = m_pool1;
|
||||
m_cold = m_pool2;
|
||||
|
||||
startOncePerSecond ();
|
||||
m_timer.setExpiration (1.0);
|
||||
}
|
||||
|
||||
PagedFreeStore::~PagedFreeStore ()
|
||||
{
|
||||
endOncePerSecond ();
|
||||
m_timer.reset ();
|
||||
|
||||
#if LOG_GC
|
||||
bassert (!m_used.isSignaled ());
|
||||
@@ -162,7 +163,7 @@ void PagedFreeStore::deallocate (void* const p)
|
||||
//
|
||||
// Perform garbage collection.
|
||||
//
|
||||
void PagedFreeStore::doOncePerSecond ()
|
||||
void PagedFreeStore::onDeadlineTimer (DeadlineTimer&)
|
||||
{
|
||||
// Physically free one page.
|
||||
// This will reduce the working set over time after a spike.
|
||||
@@ -195,6 +196,8 @@ void PagedFreeStore::doOncePerSecond ()
|
||||
<< String (m_newPagesLeft.get ()) << ")";
|
||||
Logger::outputDebugString (s);
|
||||
#endif
|
||||
|
||||
m_timer.setExpiration (1.0);
|
||||
}
|
||||
|
||||
void PagedFreeStore::dispose (Pages& pages)
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
|
||||
@ingroup beast_concurrent
|
||||
*/
|
||||
class BEAST_API PagedFreeStore : private OncePerSecond
|
||||
class BEAST_API PagedFreeStore : private DeadlineTimer::Listener
|
||||
{
|
||||
public:
|
||||
explicit PagedFreeStore (const size_t pageBytes);
|
||||
@@ -56,7 +56,7 @@ public:
|
||||
|
||||
private:
|
||||
void* newPage ();
|
||||
void doOncePerSecond ();
|
||||
void onDeadlineTimer (DeadlineTimer&);
|
||||
|
||||
private:
|
||||
struct Page;
|
||||
@@ -75,6 +75,7 @@ private:
|
||||
void dispose (Pool& pool);
|
||||
|
||||
private:
|
||||
DeadlineTimer m_timer;
|
||||
const size_t m_pageBytes;
|
||||
const size_t m_pageBytesAvailable;
|
||||
CacheLine::Aligned <Pool> m_pool1; // pair of pools
|
||||
|
||||
Reference in New Issue
Block a user