rambrain
rambrain::managedDummySwap Class Reference

A dummy swap that just copies swapped out chunks to a different location in ram. More...

#include <managedDummySwap.h>

Inheritance diagram for rambrain::managedDummySwap:
rambrain::managedSwap

Public Member Functions

 managedDummySwap (rambrain::global_bytesize size)
 
virtual ~managedDummySwap ()
 
virtual global_bytesize swapIn (managedMemoryChunk **chunklist, unsigned int nchunks)
 Trigger swap in of the chunks pointed to by chunklist. More...
 
virtual global_bytesize swapIn (managedMemoryChunk *chunk)
 Trigger swap in of the chunk pointed to by chunk. More...
 
virtual global_bytesize swapOut (managedMemoryChunk **chunklist, unsigned int nchunks)
 Trigger swap out of the chunks pointed to by chunklist. More...
 
virtual global_bytesize swapOut (managedMemoryChunk *chunk)
 Trigger swap out of the chunk pointed to by chunk. More...
 
virtual void swapDelete (managedMemoryChunk *chunk)
 Mark chunk as deleted. More...
 
virtual void close ()
 Close the swap if not already closed. More...
 
- Public Member Functions inherited from rambrain::managedSwap
 managedSwap (global_bytesize size)
 
virtual ~managedSwap ()
 
virtual bool extendSwapByPolicy (global_bytesize min_size)
 extend swap by policy More...
 
virtual bool extendSwap (global_bytesize size)
 extend swap by size number of bytes More...
 
virtual global_bytesize getSwapSize () const
 Simple getter. More...
 
virtual global_bytesize getUsedSwap () const
 Simple getter. More...
 
virtual global_bytesize getFreeSwap () const
 Simple getter. More...
 
virtual swapPolicy getSwapPolicy () const
 
virtual swapPolicy setSwapPolicy (swapPolicy newPolicy)
 
size_t getMemoryAlignment () const
 Returns possible memory alignment restrictions. More...
 
void claimUsageof (global_bytesize bytes, bool rambytes, bool used)
 account for memory usage change More...
 
void waitForCleanExit ()
 Function waits for all asynchronous IO to complete. The wait is implemented non-performant as a normal user does not have to wait for this. Implementing this with a _cond just destroys performance in the respective swapIn/out procedures without increasing any user space functionality. More...
 
virtual bool checkForAIO ()
 
virtual bool cleanupCachedElements (rambrain::global_bytesize minimum_size=0)
 throws out cached elements still in ram but also resident on disk. This makes space in situations of low swap memory More...
 
virtual void invalidateCacheFor (managedMemoryChunk &chunk)
 tells managedFileSwap that the chunk under consideration might have been changed by user and needs to be copied out freshly More...
 

Additional Inherited Members

- Protected Attributes inherited from rambrain::managedSwap
global_bytesize swapSize
 
global_bytesize swapUsed
 
global_bytesize swapFree
 
unsigned int totalSwapActionsQueued = 0
 
size_t memoryAlignment = 1
 
swapPolicy policy = swapPolicy::fixed
 
bool closed = false
 

Detailed Description

A dummy swap that just copies swapped out chunks to a different location in ram.

Note
there is no productive use of this class, it simly serves testing purpuses for the managedMemory derivated classes

Definition at line 31 of file managedDummySwap.h.

Constructor & Destructor Documentation

rambrain::managedDummySwap::managedDummySwap ( rambrain::global_bytesize  size)

Definition at line 29 of file managedDummySwap.cpp.

virtual rambrain::managedDummySwap::~managedDummySwap ( )
inlinevirtual

Definition at line 35 of file managedDummySwap.h.

Member Function Documentation

virtual void rambrain::managedDummySwap::close ( )
inlinevirtual

Close the swap if not already closed.

Note
Not automatically done by destructor
Warning
Swap can not be used anymore afterwards

Implements rambrain::managedSwap.

Definition at line 45 of file managedDummySwap.h.

void rambrain::managedDummySwap::swapDelete ( managedMemoryChunk chunk)
virtual

Mark chunk as deleted.

Note
this is only called when deleting a chunk in managedMemory if chunk->swapBuf is not NULL
this function must be called having stateChangeMutex acquired.

Implements rambrain::managedSwap.

Definition at line 111 of file managedDummySwap.cpp.

global_bytesize rambrain::managedDummySwap::swapIn ( managedMemoryChunk **  chunklist,
unsigned int  nchunks 
)
virtual

Trigger swap in of the chunks pointed to by chunklist.

Note
this function must be called having stateChangeMutex acquired.

Implements rambrain::managedSwap.

Definition at line 101 of file managedDummySwap.cpp.

global_bytesize rambrain::managedDummySwap::swapIn ( managedMemoryChunk chunk)
virtual

Trigger swap in of the chunk pointed to by chunk.

Note
this function must be called having stateChangeMutex acquired.

We are not writing asynchronous, thus, we have to signal that we're done reading...

We are not writing asynchronous, thus, we have to signal that we're done reading...

Implements rambrain::managedSwap.

Definition at line 75 of file managedDummySwap.cpp.

global_bytesize rambrain::managedDummySwap::swapOut ( managedMemoryChunk **  chunklist,
unsigned int  nchunks 
)
virtual

Trigger swap out of the chunks pointed to by chunklist.

Note
this function must be called having stateChangeMutex acquired.

Implements rambrain::managedSwap.

Definition at line 65 of file managedDummySwap.cpp.

global_bytesize rambrain::managedDummySwap::swapOut ( managedMemoryChunk chunk)
virtual

Trigger swap out of the chunk pointed to by chunk.

Note
this function must be called having stateChangeMutex acquired.

We are not writing asynchronous, thus, we have to signal that we're done writing...

We are not writing asynchronous, thus, we have to signal that we're done writing...

Implements rambrain::managedSwap.

Definition at line 35 of file managedDummySwap.cpp.


The documentation for this class was generated from the following files: