Panda3D
 All Classes Functions Variables Enumerations
cacheStats.h
1 // Filename: cacheStats.h
2 // Created by: drose (24Jul07)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 #ifndef CACHESTATS_H
16 #define CACHESTATS_H
17 
18 #include "pandabase.h"
19 #include "clockObject.h"
20 #include "pnotify.h"
21 
22 ////////////////////////////////////////////////////////////////////
23 // Class : CacheStats
24 // Description : This is used to track the utilization of the
25 // TransformState and RenderState caches, for low-level
26 // performance tuning information.
27 ////////////////////////////////////////////////////////////////////
28 class EXPCL_PANDA_PGRAPH CacheStats {
29 public:
30  void init();
31  void reset(double now);
32  void write(ostream &out, const char *name) const;
33  INLINE void maybe_report(const char *name);
34 
35  INLINE void inc_hits();
36  INLINE void inc_misses();
37  INLINE void inc_adds(bool is_new);
38  INLINE void inc_dels();
39  INLINE void add_total_size(int count);
40  INLINE void add_num_states(int count);
41 
42 private:
43 #ifndef NDEBUG
44  int _cache_hits;
45  int _cache_misses;
46  int _cache_adds;
47  int _cache_new_adds;
48  int _cache_dels;
49  int _total_cache_size;
50  int _num_states;
51  double _last_reset;
52 
53  bool _cache_report;
54  double _cache_report_interval;
55 #endif // NDEBUG
56 };
57 
58 #include "cacheStats.I"
59 
60 #endif
This is used to track the utilization of the TransformState and RenderState caches, for low-level performance tuning information.
Definition: cacheStats.h:28