00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef PSTATCOLLECTOR_H
00020 #define PSTATCOLLECTOR_H
00021
00022 #include <pandabase.h>
00023
00024 #include "pStatThread.h"
00025 #include "pStatClient.h"
00026
00027 #include <luse.h>
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053 class EXPCL_PANDA PStatCollector {
00054 #ifdef DO_PSTATS
00055
00056 private:
00057 INLINE PStatCollector();
00058 INLINE PStatCollector(PStatClient *client, int index);
00059
00060 PUBLISHED:
00061 INLINE PStatCollector(const string &name,
00062 PStatClient *client = NULL);
00063 INLINE PStatCollector(const PStatCollector &parent,
00064 const string &name);
00065
00066 INLINE PStatCollector(const PStatCollector ©);
00067 INLINE void operator = (const PStatCollector ©);
00068
00069 INLINE bool is_active();
00070 INLINE void start();
00071 INLINE void stop();
00072
00073 INLINE void clear_level();
00074 INLINE void set_level(float level);
00075 INLINE void add_level(float increment);
00076 INLINE void sub_level(float decrement);
00077 INLINE float get_level();
00078
00079 public:
00080 INLINE bool is_active(const PStatThread &thread);
00081 INLINE void start(const PStatThread &thread);
00082 INLINE void start(const PStatThread &thread, float as_of);
00083 INLINE void stop(const PStatThread &thread);
00084 INLINE void stop(const PStatThread &thread, float as_of);
00085
00086 INLINE void clear_level(const PStatThread &thread);
00087 INLINE void set_level(const PStatThread &thread, float level);
00088 INLINE void add_level(const PStatThread &thread, float increment);
00089 INLINE void sub_level(const PStatThread &thread, float decrement);
00090 INLINE float get_level(const PStatThread &thread);
00091
00092 private:
00093 PStatClient *_client;
00094 int _index;
00095
00096 friend class PStatClient;
00097
00098 #else // DO_PSTATS
00099 PUBLISHED:
00100 INLINE PStatCollector(const string &name,
00101 PStatClient *client = NULL);
00102 INLINE PStatCollector(const PStatCollector &parent,
00103 const string &name);
00104
00105 INLINE bool is_active() { return false; }
00106 INLINE void start() { }
00107 INLINE void stop() { }
00108
00109 INLINE void clear_level() { }
00110 INLINE void set_level(float) { }
00111 INLINE void add_level(float) { }
00112 INLINE void sub_level(float) { }
00113 INLINE float get_level() { return 0.0; }
00114
00115 public:
00116 INLINE bool is_active(const PStatThread &) { return false; }
00117 INLINE void start(const PStatThread &) { }
00118 INLINE void start(const PStatThread &, float) { }
00119 INLINE void stop(const PStatThread &) { }
00120 INLINE void stop(const PStatThread &, float) { }
00121
00122 INLINE void clear_level(const PStatThread &) { }
00123 INLINE void set_level(const PStatThread &, float) { }
00124 INLINE void add_level(const PStatThread &, float) { }
00125 INLINE void sub_level(const PStatThread &, float) { }
00126 INLINE float get_level(const PStatThread &) { return 0.0; }
00127
00128 #endif // DO_PSTATS
00129 };
00130
00131 #include "pStatCollector.I"
00132
00133 #endif
00134