00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #ifndef COH_CLASS_BASED_HEAP_ANALYZER_HPP
00017 #define COH_CLASS_BASED_HEAP_ANALYZER_HPP
00018
00019 #include "coherence/lang/compatibility.hpp"
00020
00021 #include "coherence/lang/Comparable.hpp"
00022 #include "coherence/lang/AbstractHeapAnalyzer.hpp"
00023
00024 #include <ostream>
00025
00026 COH_OPEN_NAMESPACE2(coherence,util)
00027 class Map;
00028 COH_CLOSE_NAMESPACE2
00029
00030 COH_OPEN_NAMESPACE2(coherence,lang)
00031
00032 using coherence::util::Map;
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048 class COH_EXPORT ClassBasedHeapAnalyzer
00049 : public class_spec<ClassBasedHeapAnalyzer,
00050 extends<AbstractHeapAnalyzer> >
00051 {
00052 friend class factory<ClassBasedHeapAnalyzer>;
00053
00054
00055
00056 protected:
00057
00058
00059
00060 ClassBasedHeapAnalyzer();
00061
00062
00063
00064
00065 public:
00066
00067
00068
00069 class COH_EXPORT ClassStats
00070 : public class_spec<ClassStats,
00071 extends<Object>,
00072 implements<Comparable> >
00073 {
00074 friend class factory<ClassStats>;
00075
00076 protected:
00077
00078
00079
00080
00081
00082 ClassStats(int64_t cObjs, int64_t cBytes);
00083
00084
00085
00086 public:
00087
00088
00089
00090 virtual int64_t getObjectCount() const;
00091
00092
00093
00094
00095 virtual int64_t getByteCount() const;
00096
00097
00098
00099 public:
00100
00101
00102
00103 int32_t compareTo(Object::View v) const;
00104
00105
00106
00107 public:
00108
00109
00110
00111 virtual void toStream(std::ostream& out) const;
00112
00113
00114
00115 protected:
00116
00117
00118
00119 int64_t m_cInstanceCount;
00120
00121
00122
00123
00124 int64_t m_cByteCount;
00125 };
00126
00127
00128
00129 public:
00130
00131
00132
00133 class COH_EXPORT Snapshot
00134 : public class_spec<Snapshot,
00135 extends<Object>,
00136 implements<HeapAnalyzer::Snapshot> >
00137 {
00138 friend class factory<Snapshot>;
00139
00140
00141
00142 protected:
00143
00144
00145
00146 Snapshot(TypedHandle<const Map> vMap);
00147
00148
00149
00150 public:
00151
00152
00153
00154
00155
00156
00157
00158 virtual TypedHandle<const Map> getStatsMap() const;
00159
00160
00161
00162
00163 virtual int64_t getObjectCount() const;
00164
00165
00166
00167 public:
00168
00169
00170
00171 virtual void toStream(std::ostream& out) const;
00172
00173
00174
00175 protected:
00176
00177
00178
00179 Object::View m_vMapStats;
00180 };
00181
00182
00183
00184
00185 protected:
00186
00187
00188
00189 virtual void safeRegisterObject(const Object& o);
00190
00191
00192
00193
00194 virtual void safeUnregisterObject(const Object& o);
00195
00196
00197
00198
00199 public:
00200
00201
00202
00203 virtual HeapAnalyzer::Snapshot::View capture() const;
00204
00205
00206
00207
00208 virtual HeapAnalyzer::Snapshot::View delta(
00209 HeapAnalyzer::Snapshot::View vSnap) const;
00210
00211
00212
00213
00214 virtual int64_t getObjectCount() const;
00215
00216 protected:
00217
00218
00219
00220 virtual void registerObject(const Object& o);
00221
00222
00223
00224
00225 virtual void unregisterObject(const Object& o);
00226 };
00227
00228 COH_CLOSE_NAMESPACE2
00229
00230 #endif // COH_CLASS_BASED_HEAP_ANALYZER_HPP
Copyright (c) 2000-2008 Oracle. All rights reserved.