All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
SOP_CacheManager Class Reference

#include <SOP_CacheManager.h>

Public Member Functions

 SOP_CacheManager ()
 ~SOP_CacheManager ()
void registerSOP (SOP_Node *node)
 When a new SOP is created we alert the cache manager through this. More...
void unregisterSOP (SOP_Node *node)
 When a SOP is destroyed, we alert the cache manager through this. More...
bool isLoaded (const SOP_Node *node)
 Returns whether we think the given SOP is loaded in memory or not. More...
void alertLockSOP (SOP_Node *locker, SOP_Node *lockee)
 When a SOP locks another SOP, this is used. More...
void alertUnlockSOP (SOP_Node *unlocker, SOP_Node *unlockee)
 When a SOP is unlocked, we are alerted through this. More...
void alertCookStartSOP (SOP_Node *node, float time)
void alertCookEndSOP (SOP_Node *node)
void alertGeometryChangedSOP (SOP_Node *node)
void alertUnloadSOP (SOP_Node *node)
 When a SOP is unloaded, we are alerted through this. More...
void alertTouchedSOP (SOP_Node *node)
void setCheckpoint (const char *mark)
void unloadToCheckpoint (const char *mark)
bool hasNewCheckpoint (const char *mark)
void cullToMemory (int64 amount)
void cullToMaxMemory ()
SOP_CacheData * getData (int idx) const
 Used internally to get the data. More...
void parseCommand (CMD_Args &args)
SOP_CacheUnloadState getUnloadState () const
int64 getTotalMem () const
 Returns total used cache memory in bytes. More...
SOP_CacheMemoryState getMemoryState () const
 Returns the current memory state. More...
int64 getMaxMemory () const
 Returns maximum allowed memory. More...
void setMaxMemory (int64 size)
int clearCache ()

Static Public Member Functions

static SOP_CacheManagergetManager ()

Detailed Description

The SOP_CacheManager tracks all active SOPs and what their current memory usage is.

It can then examine the network to determine if they are cullable. It can also watch memory usage to see what SOPs should be removed when.

Definition at line 45 of file SOP_CacheManager.h.

Constructor & Destructor Documentation

SOP_CacheManager::SOP_CacheManager ( )
SOP_CacheManager::~SOP_CacheManager ( )

Member Function Documentation

void SOP_CacheManager::alertCookEndSOP ( SOP_Node node)
void SOP_CacheManager::alertCookStartSOP ( SOP_Node node,
float  time 

When a SOP is recooked, we are alerted through this. These must occur in matched pairs. The cache manager uses these to determine when all cooking is done so it can clean up any orphaned checkpoints.

void SOP_CacheManager::alertGeometryChangedSOP ( SOP_Node node)

Trigger this alert when the gdp of a node has changed without going through the normal cook or unload mechanism. This is mostly for handling locked sops. If we ever bring back the modeler, it's operations would also trigger this. The cache then knows to recalculate the memory usage of the SOP.

void SOP_CacheManager::alertLockSOP ( SOP_Node locker,
SOP_Node lockee 

When a SOP locks another SOP, this is used.

void SOP_CacheManager::alertTouchedSOP ( SOP_Node node)

Whenever a SOP's data is accessed (view getCookedGeoHandle) we are alerted by this mechanism.

void SOP_CacheManager::alertUnloadSOP ( SOP_Node node)

When a SOP is unloaded, we are alerted through this.

void SOP_CacheManager::alertUnlockSOP ( SOP_Node unlocker,
SOP_Node unlockee 

When a SOP is unlocked, we are alerted through this.

int SOP_CacheManager::clearCache ( )

Clears the cache, freeing everything that can be freed. Returns the number of nodes that have been cleared.

void SOP_CacheManager::cullToMaxMemory ( )

Culls to the maximum memory setting of the cache. Only does anything if myMemoryState is set to always.

void SOP_CacheManager::cullToMemory ( int64  amount)

Unloads all nodes until the used memory drops below the given amount. Nodes are culled from oldest to newest. Nodes are not culled if currently in use (much like the checkpoint code)

SOP_CacheData* SOP_CacheManager::getData ( int  idx) const

Used internally to get the data.

static SOP_CacheManager* SOP_CacheManager::getManager ( )
int64 SOP_CacheManager::getMaxMemory ( ) const

Returns maximum allowed memory.

Definition at line 140 of file SOP_CacheManager.h.

SOP_CacheMemoryState SOP_CacheManager::getMemoryState ( ) const

Returns the current memory state.

Definition at line 136 of file SOP_CacheManager.h.

int64 SOP_CacheManager::getTotalMem ( ) const

Returns total used cache memory in bytes.

Definition at line 132 of file SOP_CacheManager.h.

SOP_CacheUnloadState SOP_CacheManager::getUnloadState ( ) const

Definition at line 128 of file SOP_CacheManager.h.

bool SOP_CacheManager::hasNewCheckpoint ( const char *  mark)

Returns true if the checkpoints have changed since the last unloadToCheckpoint.

bool SOP_CacheManager::isLoaded ( const SOP_Node node)

Returns whether we think the given SOP is loaded in memory or not.

void SOP_CacheManager::parseCommand ( CMD_Args args)

Used as the interface to sopcache, which is installed in MOT_Command.C

void SOP_CacheManager::registerSOP ( SOP_Node node)

When a new SOP is created we alert the cache manager through this.

void SOP_CacheManager::setCheckpoint ( const char *  mark)

These manage the checkpoints associated with the cache. These are epochal time periods, nodes which are older than myLastCheckpoint have not been touched recently enough so are candidates for unloading. This marks the current time as a checkpoint. To avoid deletion, nodes must keep above the last two checkpoint. (Last two, or the act of setting the checkpoint would implicitly delete all current nodes)

void SOP_CacheManager::setMaxMemory ( int64  size)

Sets the maximum memory limit. This will trigger another cull pass, so may result in memory being freed.

void SOP_CacheManager::unloadToCheckpoint ( const char *  mark)

This unloads all nodes that don't reside above myLastCheckpoint. It will also adjust myLastCheckpoint to be myCurrentCheckpoint, thus allowing hasNewCheckpoint to detect if there is a new operation pending.

void SOP_CacheManager::unregisterSOP ( SOP_Node node)

When a SOP is destroyed, we alert the cache manager through this.

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