33 // Classes referenced |
33 // Classes referenced |
34 class CActiveScheduler; |
34 class CActiveScheduler; |
35 class CTrapCleanup; |
35 class CTrapCleanup; |
36 |
36 |
37 |
37 |
38 |
|
39 class TMemSpyHeapObjectDataRHeap |
|
40 { |
|
41 public: |
|
42 inline TMemSpyHeapObjectDataRHeap() |
|
43 : iAccessCount( 0 ), |
|
44 iHandleCount( 0 ), |
|
45 iHandles( NULL ), |
|
46 iFlags( 0 ), |
|
47 iCellCount( 0 ), |
|
48 iTotalAllocSize ( 0 ), |
|
49 // |
|
50 iMinLength( 0 ), |
|
51 iMaxLength( 0 ), |
|
52 iOffset ( 0 ), |
|
53 iGrowBy( 0 ), |
|
54 iChunkHandle ( 0 ), |
|
55 iBase( NULL ), |
|
56 iTop( NULL ), |
|
57 iAlign( 0 ), |
|
58 iMinCell( 0 ), |
|
59 iPageSize( 0 ), |
|
60 iNestingLevel( 0 ), |
|
61 iAllocCount( 0 ), |
|
62 iFailRate( 0 ), |
|
63 iFailed( EFalse ), |
|
64 iFailAllocCount( 0 ), |
|
65 iRand( 0 ), |
|
66 iTestData( NULL ) |
|
67 { |
|
68 } |
|
69 |
|
70 public: // API |
|
71 inline TUint8* Base() const { return iBase; } |
|
72 inline TUint Size() const { return iTop - iBase; } |
|
73 |
|
74 public: // From RAllocator |
|
75 TInt iAccessCount; |
|
76 TInt iHandleCount; |
|
77 TInt* iHandles; |
|
78 TUint32 iFlags; |
|
79 TInt iCellCount; |
|
80 TInt iTotalAllocSize; |
|
81 |
|
82 public: // From RHeap |
|
83 TInt iMinLength; |
|
84 TInt iMaxLength; |
|
85 TInt iOffset; |
|
86 TInt iGrowBy; |
|
87 TInt iChunkHandle; |
|
88 RFastLock iLock; |
|
89 TUint8* iBase; |
|
90 TUint8* iTop; |
|
91 TInt iAlign; |
|
92 TInt iMinCell; |
|
93 TInt iPageSize; |
|
94 #ifdef __SYMBIAN_KERNEL_HYBRID_HEAP__ |
|
95 struct SCell { TInt len; SCell* next }; |
|
96 SCell iFree; |
|
97 #else |
|
98 RHeap::SCell iFree; |
|
99 #endif |
|
100 TInt iNestingLevel; |
|
101 TInt iAllocCount; |
|
102 RAllocator::TAllocFail iFailType; |
|
103 TInt iFailRate; |
|
104 TBool iFailed; |
|
105 TInt iFailAllocCount; |
|
106 TInt iRand; |
|
107 TAny* iTestData; |
|
108 }; |
|
109 |
|
110 |
|
111 |
|
112 /** |
38 /** |
113 * Base class for MemSpy RHeap statistics |
39 * Base class for MemSpy RHeap statistics |
114 */ |
40 */ |
115 class TMemSpyHeapStatisticsRHeapBase |
41 class TMemSpyHeapStatisticsRHeapBase |
116 { |
42 { |
203 TUint iSlackSpace; |
129 TUint iSlackSpace; |
204 TAny* iSlackSpaceCellAddress; |
130 TAny* iSlackSpaceCellAddress; |
205 TUint32 iChecksum; |
131 TUint32 iChecksum; |
206 }; |
132 }; |
207 |
133 |
208 |
|
209 |
|
210 |
|
211 |
|
212 /** |
|
213 * RHeap statistics for common cell types |
|
214 */ |
|
215 class TMemSpyHeapStatisticsRHeapCommon |
|
216 { |
|
217 public: // Constructors |
|
218 inline TMemSpyHeapStatisticsRHeapCommon() |
|
219 : iTotalCellCount( 0 ) |
|
220 { |
|
221 } |
|
222 |
|
223 public: |
|
224 inline TUint TotalCellCount() const { return iTotalCellCount; } |
|
225 inline void SetTotalCellCount( TUint aValue ) { iTotalCellCount = aValue; } |
|
226 |
|
227 private: |
|
228 TUint iTotalCellCount; |
|
229 }; |
|
230 |
|
231 |
|
232 |
|
233 |
|
234 |
|
235 /** |
134 /** |
236 * RHeap statistics class |
135 * RHeap statistics class |
237 */ |
136 */ |
238 class TMemSpyHeapStatisticsRHeap |
137 class TMemSpyHeapStatisticsRHeap |
239 { |
138 { |
240 public: // Constructors |
139 public: // Constructors |
241 inline TMemSpyHeapStatisticsRHeap() |
140 inline TMemSpyHeapStatisticsRHeap() |
|
141 : iCommittedFreeSpace(0) |
242 { |
142 { |
243 } |
143 } |
244 |
144 |
245 public: // API |
145 public: // API |
246 inline TMemSpyHeapStatisticsRHeapFree& StatsFree() { return iStatisticsFree; } |
146 inline TMemSpyHeapStatisticsRHeapFree& StatsFree() { return iStatisticsFree; } |
247 inline const TMemSpyHeapStatisticsRHeapFree& StatsFree() const { return iStatisticsFree; } |
147 inline const TMemSpyHeapStatisticsRHeapFree& StatsFree() const { return iStatisticsFree; } |
248 // |
148 // |
249 inline TMemSpyHeapStatisticsRHeapAllocated& StatsAllocated() { return iStatisticsAllocated; } |
149 inline TMemSpyHeapStatisticsRHeapAllocated& StatsAllocated() { return iStatisticsAllocated; } |
250 inline const TMemSpyHeapStatisticsRHeapAllocated& StatsAllocated() const { return iStatisticsAllocated; } |
150 inline const TMemSpyHeapStatisticsRHeapAllocated& StatsAllocated() const { return iStatisticsAllocated; } |
251 // |
151 |
252 inline TMemSpyHeapStatisticsRHeapCommon& StatsCommon() { return iStatisticsCommon; } |
|
253 inline const TMemSpyHeapStatisticsRHeapCommon& StatsCommon() const { return iStatisticsCommon; } |
|
254 |
152 |
255 private: // Data members |
153 private: // Data members |
256 TMemSpyHeapStatisticsRHeapCommon iStatisticsCommon; |
|
257 TMemSpyHeapStatisticsRHeapFree iStatisticsFree; |
154 TMemSpyHeapStatisticsRHeapFree iStatisticsFree; |
258 TMemSpyHeapStatisticsRHeapAllocated iStatisticsAllocated; |
155 TMemSpyHeapStatisticsRHeapAllocated iStatisticsAllocated; |
|
156 |
|
157 public: // I am fed up of all these pointless inline accessors... |
|
158 TInt iCommittedFreeSpace; // The amount of committed memory that isn't payload data in allocated or free cells |
259 }; |
159 }; |
260 |
160 |
261 |
161 |
262 |
162 |
263 |
163 |
273 inline TMemSpyHeapMetaDataRHeap() |
173 inline TMemSpyHeapMetaDataRHeap() |
274 : iChunkSize( 0 ), |
174 : iChunkSize( 0 ), |
275 iChunkHandle( NULL ), |
175 iChunkHandle( NULL ), |
276 iChunkBaseAddress( NULL ), |
176 iChunkBaseAddress( NULL ), |
277 iDebugAllocator( EFalse ), |
177 iDebugAllocator( EFalse ), |
278 iHeaderSizeFree( 0 ), |
178 //iHeaderSizeFree( 0 ), |
279 iHeaderSizeAllocated( 0 ), |
179 //iHeaderSizeAllocated( 0 ), |
280 iIsUserThread( ETrue ), |
180 iIsUserThread( ETrue ), |
281 iSharedHeap( EFalse ) |
181 iVTable(0), |
|
182 iSharedHeap( EFalse ), |
|
183 iHeapSize(0), |
|
184 iAllocatorAddress(NULL), |
|
185 iMinHeapSize(0), |
|
186 iMaxHeapSize(0) |
282 { |
187 { |
283 } |
188 } |
284 |
189 |
285 public: // API |
190 public: // API |
286 #ifndef __KERNEL_MODE__ |
191 #ifndef __KERNEL_MODE__ |
356 inline void SetChunkHandle( TAny* aValue ) { iChunkHandle = aValue; } |
261 inline void SetChunkHandle( TAny* aValue ) { iChunkHandle = aValue; } |
357 // |
262 // |
358 inline TAny* ChunkBaseAddress() const { return iChunkBaseAddress; } |
263 inline TAny* ChunkBaseAddress() const { return iChunkBaseAddress; } |
359 inline void SetChunkBaseAddress( TAny* aValue ) { iChunkBaseAddress = aValue; } |
264 inline void SetChunkBaseAddress( TAny* aValue ) { iChunkBaseAddress = aValue; } |
360 // |
265 // |
361 inline TUint HeaderSizeFree() const { return iHeaderSizeFree; } |
|
362 inline void SetHeaderSizeFree( TUint aValue ) { iHeaderSizeFree = aValue; } |
|
363 // |
|
364 inline TUint HeaderSizeAllocated() const { return iHeaderSizeAllocated; } |
|
365 inline void SetHeaderSizeAllocated( TUint aValue ) { iHeaderSizeAllocated = aValue; } |
|
366 // |
|
367 inline TBool IsDebugAllocator() const { return iDebugAllocator; } |
266 inline TBool IsDebugAllocator() const { return iDebugAllocator; } |
368 inline void SetDebugAllocator( TBool aValue ) { iDebugAllocator = aValue; } |
267 inline void SetDebugAllocator( TBool aValue ) { iDebugAllocator = aValue; } |
369 // |
268 // |
370 inline TBool IsUserThread() const { return iIsUserThread; } |
269 inline TBool IsUserThread() const { return iIsUserThread; } |
371 inline void SetUserThread( TBool aValue ) { iIsUserThread = aValue; } |
270 inline void SetUserThread( TBool aValue ) { iIsUserThread = aValue; } |
373 inline TBool IsSharedHeap() const { return iSharedHeap; } |
272 inline TBool IsSharedHeap() const { return iSharedHeap; } |
374 inline void SetSharedHeap( TBool aValue ) { iSharedHeap = aValue; } |
273 inline void SetSharedHeap( TBool aValue ) { iSharedHeap = aValue; } |
375 // |
274 // |
376 inline TUint VTable() const { return iVTable; } |
275 inline TUint VTable() const { return iVTable; } |
377 inline void SetVTable( TUint aValue ) { iVTable = aValue; } |
276 inline void SetVTable( TUint aValue ) { iVTable = aValue; } |
378 // |
|
379 inline TUint ClassSize() const { return iClassSize; } |
|
380 inline void SetClassSize( TUint aValue ) { iClassSize = aValue; } |
|
381 |
277 |
382 private: // Data members |
278 private: // Data members |
383 TBuf8< KMaxFullName * 2 > iChunkName; |
279 TBuf8< KMaxFullName * 2 > iChunkName; |
|
280 public: |
384 TUint iChunkSize; |
281 TUint iChunkSize; |
385 TAny* iChunkHandle; |
282 TAny* iChunkHandle; |
386 TAny* iChunkBaseAddress; |
283 TAny* iChunkBaseAddress; |
387 TBool iDebugAllocator; |
284 TBool iDebugAllocator; |
388 TUint iHeaderSizeFree; |
|
389 TUint iHeaderSizeAllocated; |
|
390 TBool iSharedHeap; |
285 TBool iSharedHeap; |
391 TBool iIsUserThread; |
286 TBool iIsUserThread; |
392 TUint iVTable; |
287 TUint iVTable; |
393 TUint iClassSize; |
288 TUint iHeapSize; // Committed size - generally the same as iChunkSize (except maybe for kernel heap) |
394 }; |
289 TAny* iAllocatorAddress; // replacement for things using the RHeap base address |
395 |
290 TUint iMinHeapSize; // Minimum committed size |
396 |
291 TUint iMaxHeapSize; // Max committed size |
397 |
292 }; |
398 |
|
399 |
|
400 |
293 |
401 |
294 |
402 /** |
295 /** |
403 * |
296 * |
404 */ |
297 */ |
411 |
304 |
412 public: // API |
305 public: // API |
413 inline TMemSpyHeapMetaDataRHeap& MetaData() { return iMetaData; } |
306 inline TMemSpyHeapMetaDataRHeap& MetaData() { return iMetaData; } |
414 inline const TMemSpyHeapMetaDataRHeap& MetaData() const { return iMetaData; } |
307 inline const TMemSpyHeapMetaDataRHeap& MetaData() const { return iMetaData; } |
415 // |
308 // |
416 inline TMemSpyHeapObjectDataRHeap& ObjectData() { return iObjectData; } |
309 //inline TMemSpyHeapObjectDataRHeap& ObjectData() { return iObjectData; } |
417 inline const TMemSpyHeapObjectDataRHeap& ObjectData() const { return iObjectData; } |
310 //inline const TMemSpyHeapObjectDataRHeap& ObjectData() const { return iObjectData; } |
418 // |
311 // |
419 inline TMemSpyHeapStatisticsRHeap& Statistics() { return iStatistics; } |
312 inline TMemSpyHeapStatisticsRHeap& Statistics() { return iStatistics; } |
420 inline const TMemSpyHeapStatisticsRHeap& Statistics() const { return iStatistics; } |
313 inline const TMemSpyHeapStatisticsRHeap& Statistics() const { return iStatistics; } |
421 |
314 |
|
315 inline TInt Overhead() const { return iMetaData.iHeapSize - iStatistics.StatsAllocated().TypeSize() - iStatistics.iCommittedFreeSpace; } |
|
316 |
422 private: // Data members |
317 private: // Data members |
423 TMemSpyHeapMetaDataRHeap iMetaData; |
318 TMemSpyHeapMetaDataRHeap iMetaData; |
424 TMemSpyHeapObjectDataRHeap iObjectData; |
319 //TMemSpyHeapObjectDataRHeap iObjectData; |
425 TMemSpyHeapStatisticsRHeap iStatistics; |
320 TMemSpyHeapStatisticsRHeap iStatistics; |
426 }; |
321 }; |
427 |
322 |
428 |
323 |
429 |
324 |