Panda3D
Public Member Functions | Static Public Member Functions

AdaptiveLru Class Reference

A basic LRU-type algorithm, except that it is adaptive and attempts to avoid evicting pages that have been used more frequently (even if less recently) than other pages. More...

Inheritance diagram for AdaptiveLru:
Namable

List of all members.

Public Member Functions

 AdaptiveLru (string name, unsigned int max_size)
 beginEpoch ()
 Marks the end of the previous epoch and the beginning of the next one.
 clearName ()
 Resets the Namable's name to empty.
 considerEvict ()
 Evicts a sequence of objects if the queue is full.
unsigned int countActiveSize ()
 Returns the total size of the pages that were enqueued since the last call to begin_epoch().
 evictTo (unsigned int target_size)
 Evicts a sequence of objects until the queue fits within the indicated target size, regardless of its normal max size.
unsigned int getMaxSize ()
 Returns the max size of all objects that are allowed to be active on the LRU.
int getMaxUpdatesPerFrame ()
 Returns the maximum number of pages the AdaptiveLru will update each frame.
string getName ()
unsigned int getTotalSize ()
 Returns the total size of all objects currently active on the LRU.
float getWeight ()
 Returns the weight value used to compute the exponential moving average.
bool hasName ()
 Returns true if the Namable has a nonempty name set, false if the name is empty.
 output (ostream out)
 Outputs the Namable.
 setMaxSize (unsigned int max_size)
 Changes the max size of all objects that are allowed to be active on the LRU.
 setMaxUpdatesPerFrame (int max_updates_per_frame)
 Specifies the maximum number of pages the AdaptiveLru will update each frame.
 setName (string name)
 setWeight (float weight)
 Specifies the weight value used to compute the exponential moving average.
bool validate ()
 Checks that the LRU is internally self-consistent.
 write (ostream out, int indent_level)

Static Public Member Functions

static TypeHandle getClassType ()

Detailed Description

A basic LRU-type algorithm, except that it is adaptive and attempts to avoid evicting pages that have been used more frequently (even if less recently) than other pages.

The interface is designed to be identical to that for SimpleLru, so that it may be used as a drop-in replacement.


Constructor & Destructor Documentation

AdaptiveLru ( string  name,
unsigned int  max_size 
)

Member Function Documentation

beginEpoch ( )

Marks the end of the previous epoch and the beginning of the next one.

This will evict any objects that are pending eviction, and also update any internal bookkeeping.

clearName ( ) [inherited]

Resets the Namable's name to empty.

Reimplemented in AsyncTask.

considerEvict ( )

Evicts a sequence of objects if the queue is full.

unsigned int countActiveSize ( )

Returns the total size of the pages that were enqueued since the last call to begin_epoch().

evictTo ( unsigned int  target_size)

Evicts a sequence of objects until the queue fits within the indicated target size, regardless of its normal max size.

static TypeHandle getClassType ( ) [static, inherited]

Reimplemented in PGItem, PandaNode, PGButton, PGTop, PGEntry, PGMouseWatcherBackground, MouseWatcherRegion, PGVirtualFrame, PGSliderBar, PGScrollFrame, PGWaitBar, ButtonThrower, DataNode, MouseInterfaceNode, DriveInterface, MouseSubregion, MouseWatcher, Trackball, Transform2SG, TextFont, DynamicTextPage, Texture, DynamicTextFont, StaticTextFont, TextNode, ParametricCurve, CubicCurveseg, PiecewiseCurve, HermiteCurve, NurbsCurve, RopeNode, SheetNode, AnimateVerticesRequest, AsyncTask, Material, TextureReloadRequest, VideoTexture, AsyncTaskBase, AsyncTaskChain, AsyncTaskManager, AsyncTaskPause, AsyncTaskSequence, PythonTask, Thread, ExternalThread, MainThread, PythonThread, AnalogNode, ButtonNode, DialNode, MouseAndKeyboard, TrackerNode, VirtualMouse, CollisionNode, CollisionTraverser, CollisionVisualizer, CharacterJoint, MovingPartMatrix, CharacterSlider, MovingPartScalar, Character, PartBundleNode, CharacterJointBundle, PartBundle, AnimGroup, AnimBundle, AnimBundleNode, PartGroup, AnimControl, AnimChannelBase, AnimChannelACMatrixSwitchType, AnimChannelACScalarSwitchType, AnimChannelMatrixDynamic, AnimChannelMatrixXfmTable, AnimChannelScalarDynamic, AnimChannelScalarTable, BindAnimRequest, ModelLoadRequest, MovingPartBase, MovingPartACMatrixSwitchType, MovingPartACScalarSwitchType, FFMpegTexture, FrameRateMeter, SceneGraphAnalyzerMeter, MovieTexture, RigidBodyCombiner, MovieVideo, MovieAudio, InkblotVideo, FfmpegVideo, FfmpegAudio, MicrophoneAudio, UserDataAudio, LensNode, Camera, PlaneNode, GeomNode, Fog, PandaLoader, ModelFlattenRequest, ModelNode, ModelRoot, PolylightNode, PortalNode, UvScrollNode, LightNode, AmbientLight, CallbackNode, LightLensNode, DirectionalLight, LODNode, FadeLODNode, PointLight, SelectiveChildNode, SequenceNode, Spotlight, SwitchNode, and MouseRecorder.

unsigned int getMaxSize ( )

Returns the max size of all objects that are allowed to be active on the LRU.

int getMaxUpdatesPerFrame ( )

Returns the maximum number of pages the AdaptiveLru will update each frame.

string getName ( ) [inherited]

Reimplemented in DynamicTextFont.

unsigned int getTotalSize ( )

Returns the total size of all objects currently active on the LRU.

float getWeight ( )

Returns the weight value used to compute the exponential moving average.

bool hasName ( ) [inherited]

Returns true if the Namable has a nonempty name set, false if the name is empty.

output ( ostream  out)

Outputs the Namable.

This function simply writes the name to the output stream; most Namable derivatives will probably redefine this.

Reimplemented from Namable.

setMaxSize ( unsigned int  max_size)

Changes the max size of all objects that are allowed to be active on the LRU.

If the size is (size_t)-1, there is no limit.

setMaxUpdatesPerFrame ( int  max_updates_per_frame)

Specifies the maximum number of pages the AdaptiveLru will update each frame.

This is a performance optimization: keeping this number low limits the impact of the AdaptiveLru's adaptive algorithm.

setName ( string  name) [inherited]

Reimplemented in PGItem, and AsyncTask.

setWeight ( float  weight)

Specifies the weight value used to compute the exponential moving average.

bool validate ( )

Checks that the LRU is internally self-consistent.

Returns true if successful, false if there is some problem.

write ( ostream  out,
int  indent_level 
)
 All Classes Namespaces Functions Variables Enumerations Enumerator Properties