18 #include "pandabase.h"
19 #include "linkedListNode.h"
21 #include "lightMutex.h"
22 #include "lightMutexHolder.h"
54 INLINE
size_t get_total_size()
const;
55 INLINE
size_t get_max_size()
const;
56 INLINE
void set_max_size(
size_t max_size);
57 size_t count_active_size()
const;
59 INLINE
void consider_evict();
60 INLINE
void evict_to(
size_t target_size);
63 INLINE
bool validate();
65 void output(ostream &out)
const;
66 void write(ostream &out,
int indent_level)
const;
72 INLINE
void set_weight(PN_stdfloat weight);
73 INLINE PN_stdfloat get_weight()
const;
75 INLINE
void set_max_updates_per_frame(
int max_updates_per_frame);
76 INLINE
int get_max_updates_per_frame()
const;
80 enum LruPagePriority {
85 LPP_Intermediate = 30,
87 LPP_TotalPriorities = 50,
90 INLINE PN_stdfloat calculate_exponential_moving_average(PN_stdfloat value, PN_stdfloat average)
const;
92 void do_partial_lru_update(
int num_updates);
99 void do_evict_to(
size_t target_size,
bool hard_evict);
107 unsigned int _current_frame_identifier;
109 int _max_updates_per_frame;
156 INLINE
void dequeue_lru();
158 INLINE
void mark_used_lru()
const;
161 INLINE
size_t get_lru_size()
const;
162 INLINE
void set_lru_size(
size_t lru_size);
164 virtual void evict_lru();
166 virtual void output(ostream &out)
const;
167 virtual void write(ostream &out,
int indent_level)
const;
170 unsigned int get_num_frames()
const;
171 unsigned int get_num_inactive_frames()
const;
179 unsigned int _first_frame_identifier;
180 unsigned int _current_frame_identifier;
181 unsigned int _update_frame_identifier;
183 int _current_frame_usage;
184 int _last_frame_usage;
186 int _update_total_usage;
188 PN_stdfloat _average_frame_utilization;
193 inline ostream &operator << (ostream &out,
const AdaptiveLru &lru) {
198 inline ostream &operator << (ostream &out,
const AdaptiveLruPage &page) {
205 void test_adaptive_lru();
209 #include "adaptiveLru.I"
This just stores the pointers to implement a doubly-linked list of some kind of object.
A base class for all things which can have a name.
One atomic piece that may be managed by a AdaptiveLru chain.
A basic LRU-type algorithm, except that it is adaptive and attempts to avoid evicting pages that have...
void output(ostream &out) const
Outputs the Namable.
This is a standard, non-reentrant mutex, similar to the Mutex class.