00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef CACHESTATS_H
00016 #define CACHESTATS_H
00017
00018 #include "pandabase.h"
00019 #include "clockObject.h"
00020 #include "pnotify.h"
00021
00022
00023
00024
00025
00026
00027
00028 class EXPCL_PANDA_PGRAPH CacheStats {
00029 public:
00030 void init();
00031 void reset(double now);
00032 void write(ostream &out, const char *name) const;
00033 INLINE void maybe_report(const char *name);
00034
00035 INLINE void inc_hits();
00036 INLINE void inc_misses();
00037 INLINE void inc_adds(bool is_new);
00038 INLINE void inc_dels();
00039 INLINE void add_total_size(int count);
00040 INLINE void add_num_states(int count);
00041
00042 private:
00043 #ifndef NDEBUG
00044 int _cache_hits;
00045 int _cache_misses;
00046 int _cache_adds;
00047 int _cache_new_adds;
00048 int _cache_dels;
00049 int _total_cache_size;
00050 int _num_states;
00051 double _last_reset;
00052
00053 bool _cache_report;
00054 double _cache_report_interval;
00055 #endif // NDEBUG
00056 };
00057
00058 #include "cacheStats.I"
00059
00060 #endif