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