public abstract

Inheritance Graph

graph BT
	CacheLevel
	CacheLevelFiles --> CacheLevel
	CacheLevelFileSystem --> CacheLevel
	CacheLevelGraphicsMemory --> CacheLevel
	CacheLevelMainMemory --> CacheLevel
	click CacheLevel "classMinSG_1_1OutOfCore_1_1CacheLevel"
	click CacheLevelFiles "classMinSG_1_1OutOfCore_1_1CacheLevelFiles"
	click CacheLevelFileSystem "classMinSG_1_1OutOfCore_1_1CacheLevelFileSystem"
	click CacheLevelGraphicsMemory "classMinSG_1_1OutOfCore_1_1CacheLevelGraphicsMemory"
	click CacheLevelMainMemory "classMinSG_1_1OutOfCore_1_1CacheLevelMainMemory"

Description

Representation of one cache level inside the cache hierarchy.

Author: Benjamin Eikel

Date: 2011-02-21

Protected Attributes

   
   
const cacheLevelId_t levelId
Identifier of this level that is unique inside the cache hierarchy.

Protected Functions

   
   
  CacheLevel(uint64_t cacheSize, CacheContext & cacheContext)
   
CacheLevel * getLower()
   
CacheContext & getContext()
   
const CacheContext & getContext() const
   
uint64_t getCacheObjectSize( CacheObject * object) const
   
void removeUnimportantCacheObjects(uint64_t maximumMemory)

Public Functions

   
   
  ~CacheLevel()
   
cacheLevelId_t getLevelId() const
   
uint64_t getOverallMemory() const
   
uint64_t getUsedMemory() const
   
uint64_t getFreeMemory() const
   
void addCacheObject( CacheObject * object)
   
void removeCacheObject( CacheObject * object)
   
bool loadCacheObject( CacheObject * object)
   
std::size_t getNumObjects() const
Return the number of cache objects that are stored inside this cache level.
   
void lockContainer() const
LockcontainerMutex. Must be used only by CacheContext .
   
void unlockContainer() const
UnlockcontainerMutex. Must be used only by CacheContext .
   
double getLastWorkDuration() const
Return the duration in milliseconds of the last call towork.
   
void setUpper( CacheLevel * newUpper)
   
void work()
   
void init()

Documentation

variable
MinSG::OutOfCore::CacheLevel::levelId

protected
 
 
const cacheLevelId_t levelId

Identifier of this level that is unique inside the cache hierarchy.

Defined in MinSG/Ext/OutOfCore/CacheLevel.h:125


function
MinSG::OutOfCore::CacheLevel::CacheLevel

protected
     
     
CacheLevel( uint64_t cacheSize,
  CacheContext & cacheContext
)    

Defined in MinSG/Ext/OutOfCore/CacheLevel.h:127


function
MinSG::OutOfCore::CacheLevel::getLower

protected inline
   
   
CacheLevel * getLower( )

Defined in MinSG/Ext/OutOfCore/CacheLevel.h:129


function
MinSG::OutOfCore::CacheLevel::getContext

protected inline
   
   
CacheContext & getContext( )

Defined in MinSG/Ext/OutOfCore/CacheLevel.h:133


function
MinSG::OutOfCore::CacheLevel::getContext

protected const inline
   
   
const CacheContext & getContext( ) const

Defined in MinSG/Ext/OutOfCore/CacheLevel.h:136


function
MinSG::OutOfCore::CacheLevel::getCacheObjectSize

protected const virtual
     
     
uint64_t getCacheObjectSize( CacheObject * object ) const

Return the size of the given cache object for this cache level (e.g. size in memory, file size).

Parameters

object
Cache object to retrieve the size of.

Returns

The size of the requested cache object in bytes or zero if the size is not known.

Defined in MinSG/Ext/OutOfCore/CacheLevel.h:146


function
MinSG::OutOfCore::CacheLevel::removeUnimportantCacheObjects

protected
     
     
void removeUnimportantCacheObjects( uint64_t maximumMemory )

Remove unimportant cache objects until the given maximum memory usage is reached.

Parameters

maximumMemory
Maximum amount of memory in bytes that is to be used

Defined in MinSG/Ext/OutOfCore/CacheLevel.h:155


function
MinSG::OutOfCore::CacheLevel::~CacheLevel

public virtual
   
   
~CacheLevel( )

Defined in MinSG/Ext/OutOfCore/CacheLevel.h:158


function
MinSG::OutOfCore::CacheLevel::getLevelId

public const inline
   
   
cacheLevelId_t getLevelId( ) const

Defined in MinSG/Ext/OutOfCore/CacheLevel.h:160


function
MinSG::OutOfCore::CacheLevel::getOverallMemory

public const inline
   
   
uint64_t getOverallMemory( ) const

Defined in MinSG/Ext/OutOfCore/CacheLevel.h:164


function
MinSG::OutOfCore::CacheLevel::getUsedMemory

public const
   
   
uint64_t getUsedMemory( ) const

Defined in MinSG/Ext/OutOfCore/CacheLevel.h:168


function
MinSG::OutOfCore::CacheLevel::getFreeMemory

public const inline
   
   
uint64_t getFreeMemory( ) const

Defined in MinSG/Ext/OutOfCore/CacheLevel.h:170


function
MinSG::OutOfCore::CacheLevel::addCacheObject

public
     
     
void addCacheObject( CacheObject * object )

Add the given cache object to this cache level. Update the internal data structures of this cache level with the new status.

Parameters

object
Cache object to add

Exceptions

std::exception
if an error occurred

Defined in MinSG/Ext/OutOfCore/CacheLevel.h:181


function
MinSG::OutOfCore::CacheLevel::removeCacheObject

public
     
     
void removeCacheObject( CacheObject * object )

Remove the given cache object from this cache level. Update the internal data structures of this cache level with the new status.

Parameters

object
Cache object to remove

Exceptions

std::exception
if an error occurred

Defined in MinSG/Ext/OutOfCore/CacheLevel.h:190


function
MinSG::OutOfCore::CacheLevel::loadCacheObject

public
     
     
bool loadCacheObject( CacheObject * object )

Load a given cache object stored in this cache level into main memory.

Parameters

object
Cache object to load

Exceptions

std::exception
if an error occurred

Defined in MinSG/Ext/OutOfCore/CacheLevel.h:198


function
MinSG::OutOfCore::CacheLevel::getNumObjects

public const
   
   
std::size_t getNumObjects( ) const

Return the number of cache objects that are stored inside this cache level.

Defined in MinSG/Ext/OutOfCore/CacheLevel.h:201


function
MinSG::OutOfCore::CacheLevel::lockContainer

public const
   
   
void lockContainer( ) const

LockcontainerMutex. Must be used only by CacheContext .

Defined in MinSG/Ext/OutOfCore/CacheLevel.h:204


function
MinSG::OutOfCore::CacheLevel::unlockContainer

public const
   
   
void unlockContainer( ) const

UnlockcontainerMutex. Must be used only by CacheContext .

Defined in MinSG/Ext/OutOfCore/CacheLevel.h:207


function
MinSG::OutOfCore::CacheLevel::getLastWorkDuration

public const inline
   
   
double getLastWorkDuration( ) const

Return the duration in milliseconds of the last call towork.

Defined in MinSG/Ext/OutOfCore/CacheLevel.h:210


function
MinSG::OutOfCore::CacheLevel::setUpper

public inline
     
     
void setUpper( CacheLevel * newUpper )

Associate a cache level above this object. This is only possible if the given cache level has not been associated before and this object has no upper cache level yet.

Note: There is no setLower function. The cache level given as upper level to this function is modified so that its lower pointer points to this object. Therefore the cache hierarchy has to be built from bottom to top.

Parameters

newUpper
Cache level that is placed directly above this object. Note that the given cache level is also modified.

Exceptions

std::logic_error
in case of an error (e.g. one of the cache levels was already associated)

Defined in MinSG/Ext/OutOfCore/CacheLevel.h:224


function
MinSG::OutOfCore::CacheLevel::work

public
   
   
void work( )

Do all work that has to be done:

  • check the deliveries and add them to this cache level

  • handle requests from the upper cache level

  • prefetch cache objects if possible

This function is called by the cache manager once every frame. Therefore this function should not consume much time.

Exceptions

std::exception
if an error occurred

Defined in MinSG/Ext/OutOfCore/CacheLevel.h:243


function
MinSG::OutOfCore::CacheLevel::init

public inline virtual
   
   
void init( )

Function called once at the beginning. This function can be overwritten by subclasses to perform work that cannot be done in the constructor (e.g. starting an additional thread).

Defined in MinSG/Ext/OutOfCore/CacheLevel.h:251