1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 #include <memspy/engine/memspyengineobjectthreadinfoobjects.h> |
|
19 |
|
20 // System includes |
|
21 #include <f32file.h> |
|
22 #include <hal.h> |
|
23 #include <kernel/arm/arm_types.h> |
|
24 #include <memspy/driver/memspydriverclient.h> |
|
25 #include <memspy/engine/memspyengine.h> |
|
26 #include <memspy/engine/memspyengineutils.h> |
|
27 #include <memspy/engine/memspyengineoutputlist.h> |
|
28 #include <memspy/engine/memspyenginehelpercodesegment.h> |
|
29 #include <memspy/engine/memspyenginehelperactiveobject.h> |
|
30 #include <memspy/engine/memspyenginehelperchunk.h> |
|
31 #include <memspy/engine/memspyenginehelperheap.h> |
|
32 #include <memspy/engine/memspyenginehelperprocess.h> |
|
33 #include <memspy/engine/memspyengineobjectprocess.h> |
|
34 #include <memspy/engine/memspyengineobjectthread.h> |
|
35 #include <memspy/engine/memspyengineobjectthreadinfocontainer.h> |
|
36 #include <memspy/engine/memspyengineoutputsink.h> |
|
37 |
|
38 // User includes |
|
39 #include "MemSpyEngineOutputListItem.h" |
|
40 |
|
41 // Constants |
|
42 const TInt KMemSpyNumericFormatBufferSize = 20; |
|
43 |
|
44 // Literal constants |
|
45 _LIT( KMemSpyNumericHexFormat, "0x%08x" ); |
|
46 _LIT( KMemSpyNumericDecFormat, "%d" ); |
|
47 _LIT( KMemSpyNumericLongFormat, "%Ld" ); |
|
48 _LIT( KMemSpyCaptionYes, "Yes" ); |
|
49 _LIT( KMemSpyCaptionNo, "No" ); |
|
50 _LIT( KMemSpyCaptionOn, "On" ); |
|
51 _LIT( KMemSpyCaptionOff, "Off" ); |
|
52 _LIT( KMemSpyUnavailable, "Unavailable" ); |
|
53 _LIT( KMemSpyDead, "Dead" ); |
|
54 _LIT( KMemSpyNoItems, "(No items)" ); |
|
55 |
|
56 |
|
57 |
|
58 CMemSpyThreadInfoItemBase::CMemSpyThreadInfoItemBase( CMemSpyThreadInfoContainer& aContainer, TMemSpyThreadInfoItemType aType, TBool aAsyncConstruction ) |
|
59 : CMemSpyEngineObject( aContainer ), iContainer( aContainer ), iCallBack( CActive::EPriorityLow ), iType( aType ) |
|
60 { |
|
61 if ( aAsyncConstruction ) |
|
62 { |
|
63 TCallBack callBackMethod( CallConstructL, this ); |
|
64 iCallBack.Set( callBackMethod ); |
|
65 iCallBack.CallBack(); |
|
66 } |
|
67 } |
|
68 |
|
69 |
|
70 CMemSpyThreadInfoItemBase::~CMemSpyThreadInfoItemBase() |
|
71 { |
|
72 TRAP_IGNORE( iContainer.NotifyObserverL( MMemSpyThreadInfoContainerObserver::EInfoItemDestroyed, iType ) ); |
|
73 // |
|
74 iItems.ResetAndDestroy(); |
|
75 iItems.Close(); |
|
76 } |
|
77 |
|
78 |
|
79 TInt CMemSpyThreadInfoItemBase::CallConstructL( TAny* aSelf ) |
|
80 { |
|
81 CMemSpyThreadInfoItemBase* self = reinterpret_cast< CMemSpyThreadInfoItemBase* >( aSelf ); |
|
82 self->iReady = EFalse; |
|
83 |
|
84 // Don't try to refresh dead thread |
|
85 TInt err = KErrNone; |
|
86 if ( !self->Container().Thread().IsDead() ) |
|
87 { |
|
88 TRAP(err, self->ConstructL()); |
|
89 if ( err != KErrNone ) |
|
90 { |
|
91 #ifdef _DEBUG |
|
92 RDebug::Printf( "CMemSpyThreadInfoItemBase::CallConstructL() - construction err: %d, iType: %d", err, self->iType ); |
|
93 #endif |
|
94 self->AddItemL( KMemSpyUnavailable, KNullDesC ); |
|
95 self->iIsEmpty = ETrue; |
|
96 } |
|
97 else if ( self->MdcaCount() == 0 ) |
|
98 { |
|
99 self->AddItemL( KMemSpyNoItems, KNullDesC ); |
|
100 self->iIsEmpty = ETrue; |
|
101 } |
|
102 } |
|
103 else |
|
104 { |
|
105 self->AddItemL( KMemSpyDead, KNullDesC ); |
|
106 self->iIsEmpty = ETrue; |
|
107 } |
|
108 // |
|
109 self->iReady = ETrue; |
|
110 return KErrNone; |
|
111 } |
|
112 |
|
113 |
|
114 EXPORT_C TInt CMemSpyThreadInfoItemBase::MdcaCount() const |
|
115 { |
|
116 return iItems.Count(); |
|
117 } |
|
118 |
|
119 |
|
120 EXPORT_C TPtrC CMemSpyThreadInfoItemBase::MdcaPoint( TInt aIndex ) const |
|
121 { |
|
122 CItem* item = iItems[ aIndex ]; |
|
123 return TPtrC( item->Combined() ); |
|
124 } |
|
125 |
|
126 EXPORT_C TPtrC CMemSpyThreadInfoItemBase::Caption(TInt aIndex ) const |
|
127 { |
|
128 CItem* item = iItems[ aIndex ]; |
|
129 return TPtrC( item->Caption() ); |
|
130 } |
|
131 |
|
132 EXPORT_C TPtrC CMemSpyThreadInfoItemBase::Value(TInt aIndex ) const |
|
133 { |
|
134 CItem* item = iItems[ aIndex ]; |
|
135 return TPtrC( item->Value() ); |
|
136 } |
|
137 |
|
138 EXPORT_C CMemSpyEngine& CMemSpyThreadInfoItemBase::Engine() const |
|
139 { |
|
140 return iContainer.Engine(); |
|
141 } |
|
142 |
|
143 |
|
144 EXPORT_C void CMemSpyThreadInfoItemBase::PrintL() |
|
145 { |
|
146 const TInt count = iItems.Count(); |
|
147 if ( count > 0 && !iIsEmpty ) |
|
148 { |
|
149 CMemSpyEngine& engine = Engine(); |
|
150 CMemSpyEngineOutputSink& sink = engine.Sink(); |
|
151 |
|
152 HBufC* name = MemSpyEngineUtils::CleanupTextLC( Name() ); |
|
153 sink.OutputSectionHeadingL( *name, TChar('-') ); |
|
154 CleanupStack::PopAndDestroy( name ); |
|
155 sink.OutputPrefixSetLC( _L(" ") ); // Slight insertion |
|
156 |
|
157 // First pass to get max lengths |
|
158 TInt maxLengthCaption = 0; |
|
159 TInt maxLengthValue = 0; |
|
160 |
|
161 for( TInt j=0; j<count; j++ ) |
|
162 { |
|
163 const CItem* item = iItems[ j ]; |
|
164 maxLengthCaption = Max( maxLengthCaption, item->Caption().Length() ); |
|
165 maxLengthValue = Max( maxLengthValue, item->Value().Length() ); |
|
166 } |
|
167 |
|
168 // Second pass - real this time - to print the values |
|
169 HBufC* line = HBufC::NewLC( ( maxLengthCaption + maxLengthValue ) + 20 ); |
|
170 TPtr pLine( line->Des() ); |
|
171 // |
|
172 for( TInt i=0; i<count; i++ ) |
|
173 { |
|
174 const CItem* item = iItems[ i ]; |
|
175 |
|
176 // Remove initial tabs in caption |
|
177 HBufC* caption = MemSpyEngineUtils::CleanupTextLC( item->Caption() ); |
|
178 |
|
179 // Create value item & replace any further tabs |
|
180 HBufC* value = MemSpyEngineUtils::CleanupTextLC( item->Value() ); |
|
181 |
|
182 // Now format the final line, with padding. |
|
183 pLine.Justify( *caption, maxLengthCaption + 3, ELeft, TChar(' ') ); |
|
184 pLine.Append( *value ); |
|
185 CleanupStack::PopAndDestroy( 2, caption ); |
|
186 |
|
187 // Sink output |
|
188 sink.OutputLineL( pLine ); |
|
189 } |
|
190 // |
|
191 CleanupStack::PopAndDestroy( line ); |
|
192 sink.OutputBlankLineL(); |
|
193 CleanupStack::PopAndDestroy(); // clear prefix |
|
194 } |
|
195 } |
|
196 |
|
197 |
|
198 |
|
199 void CMemSpyThreadInfoItemBase::AddItemL( const TDesC& aCaption, const TDesC& aValue ) |
|
200 { |
|
201 CItem* item = CItem::NewLC( aCaption, aValue ); |
|
202 iItems.AppendL( item ); |
|
203 CleanupStack::Pop( item ); |
|
204 } |
|
205 |
|
206 |
|
207 void CMemSpyThreadInfoItemBase::AddItemHexL( const TDesC& aCaption, TUint aValue ) |
|
208 { |
|
209 TBuf<KMemSpyNumericFormatBufferSize> val; |
|
210 val.Format( KMemSpyNumericHexFormat, aValue ); |
|
211 AddItemL( aCaption, val ); |
|
212 } |
|
213 |
|
214 |
|
215 void CMemSpyThreadInfoItemBase::AddItemDecimalL( const TDesC& aCaption, TInt aValue ) |
|
216 { |
|
217 TBuf<KMemSpyNumericFormatBufferSize> val; |
|
218 val.Format( KMemSpyNumericDecFormat, aValue ); |
|
219 AddItemL( aCaption, val ); |
|
220 } |
|
221 |
|
222 |
|
223 void CMemSpyThreadInfoItemBase::AddItemLongL( const TDesC& aCaption, const TInt64& aValue ) |
|
224 { |
|
225 TBuf<KMemSpyNumericFormatBufferSize> val; |
|
226 val.Format( KMemSpyNumericLongFormat, aValue ); |
|
227 AddItemL( aCaption, val ); |
|
228 } |
|
229 |
|
230 |
|
231 void CMemSpyThreadInfoItemBase::AddItemYesNoL( const TDesC& aCaption, TBool aYes ) |
|
232 { |
|
233 CItem* item = CItem::NewYesNoLC( aCaption, aYes ); |
|
234 iItems.AppendL( item ); |
|
235 CleanupStack::Pop( item ); |
|
236 } |
|
237 |
|
238 |
|
239 void CMemSpyThreadInfoItemBase::AddItemOnOffL( const TDesC& aCaption, TBool aOn ) |
|
240 { |
|
241 CItem* item = CItem::NewOnOffLC( aCaption, aOn ); |
|
242 iItems.AppendL( item ); |
|
243 CleanupStack::Pop( item ); |
|
244 } |
|
245 |
|
246 |
|
247 void CMemSpyThreadInfoItemBase::AddItemPercentageL( const TDesC& aCaption, TInt aOneHundredPercentValue, TInt aValue ) |
|
248 { |
|
249 const TMemSpyPercentText val( MemSpyEngineUtils::FormatPercentage( TReal( aOneHundredPercentValue ), TReal( aValue ) ) ); |
|
250 AddItemL( aCaption, val ); |
|
251 } |
|
252 |
|
253 |
|
254 EXPORT_C void CMemSpyThreadInfoItemBase::RebuildL() |
|
255 { |
|
256 Reset(); |
|
257 CallConstructL( this ); |
|
258 } |
|
259 |
|
260 |
|
261 EXPORT_C TBool CMemSpyThreadInfoItemBase::IsReady() const |
|
262 { |
|
263 return iReady; |
|
264 } |
|
265 |
|
266 |
|
267 EXPORT_C TMemSpyThreadInfoItemType CMemSpyThreadInfoItemBase::Type() const |
|
268 { |
|
269 return iType; |
|
270 } |
|
271 |
|
272 |
|
273 void CMemSpyThreadInfoItemBase::Reset() |
|
274 { |
|
275 iItems.ResetAndDestroy(); |
|
276 } |
|
277 |
|
278 |
|
279 void CMemSpyThreadInfoItemBase::StripProcessAndThreadNames( TDes& aText ) |
|
280 { |
|
281 StripProcessName( aText ); |
|
282 StripThreadName( aText ); |
|
283 } |
|
284 |
|
285 |
|
286 void CMemSpyThreadInfoItemBase::StripProcessName( TDes& aText ) |
|
287 { |
|
288 CMemSpyProcess& process = Container().Thread().Process(); |
|
289 const TPtrC processName( process.Name() ); |
|
290 TFullName temp; |
|
291 // |
|
292 _LIT( KProcessNameUidFormat1, "%S.exe[%08x]" ); |
|
293 temp.Format( KProcessNameUidFormat1, &processName, process.SID() ); |
|
294 const TBool stripped = MemSpyEngineUtils::StripText( aText, temp ); |
|
295 // |
|
296 if ( stripped == EFalse ) |
|
297 { |
|
298 _LIT( KProcessNameUidFormat2, "%S[%08x]" ); |
|
299 temp.Format( KProcessNameUidFormat2, &processName, process.SID() ); |
|
300 MemSpyEngineUtils::StripText( aText, temp ); |
|
301 } |
|
302 } |
|
303 |
|
304 |
|
305 void CMemSpyThreadInfoItemBase::StripThreadName( TDes& aText ) |
|
306 { |
|
307 CMemSpyThread& thread = Container().Thread(); |
|
308 const TPtrC threadName( thread.Name() ); |
|
309 const TBool stripped = MemSpyEngineUtils::StripText( aText, threadName ); |
|
310 (void) stripped; |
|
311 } |
|
312 |
|
313 |
|
314 CMemSpyThreadInfoItemBase::CItem& CMemSpyThreadInfoItemBase::Item( TInt aIndex ) |
|
315 { |
|
316 CItem* item = iItems[ aIndex ]; |
|
317 return *item; |
|
318 } |
|
319 |
|
320 |
|
321 const CMemSpyThreadInfoItemBase::CItem& CMemSpyThreadInfoItemBase::Item( TInt aIndex ) const |
|
322 { |
|
323 const CItem* item = iItems[ aIndex ]; |
|
324 return *item; |
|
325 } |
|
326 |
|
327 |
|
328 |
|
329 |
|
330 |
|
331 |
|
332 |
|
333 |
|
334 |
|
335 |
|
336 |
|
337 |
|
338 |
|
339 |
|
340 |
|
341 |
|
342 |
|
343 |
|
344 |
|
345 |
|
346 CMemSpyThreadInfoItemBase::CItem::CItem() |
|
347 { |
|
348 } |
|
349 |
|
350 |
|
351 CMemSpyThreadInfoItemBase::CItem::~CItem() |
|
352 { |
|
353 delete iCaption; |
|
354 delete iValue; |
|
355 delete iCombined; |
|
356 } |
|
357 |
|
358 |
|
359 void CMemSpyThreadInfoItemBase::CItem::ConstructL( const TDesC& aCaption, const TDesC& aValue ) |
|
360 { |
|
361 iCaption = aCaption.AllocL(); |
|
362 iValue = aValue.AllocL(); |
|
363 // |
|
364 UpdateCombinedL(); |
|
365 } |
|
366 |
|
367 |
|
368 CMemSpyThreadInfoItemBase::CItem* CMemSpyThreadInfoItemBase::CItem::NewLC( const CItem& aCopyMe ) |
|
369 { |
|
370 CItem* self = new(ELeave) CItem(); |
|
371 CleanupStack::PushL( self ); |
|
372 self->ConstructL( aCopyMe.Caption(), aCopyMe.Value() ); |
|
373 return self; |
|
374 } |
|
375 |
|
376 |
|
377 CMemSpyThreadInfoItemBase::CItem* CMemSpyThreadInfoItemBase::CItem::NewLC( const TDesC& aCaption ) |
|
378 { |
|
379 CItem* self = new(ELeave) CItem(); |
|
380 CleanupStack::PushL( self ); |
|
381 self->ConstructL( aCaption, KNullDesC ); |
|
382 return self; |
|
383 } |
|
384 |
|
385 |
|
386 CMemSpyThreadInfoItemBase::CItem* CMemSpyThreadInfoItemBase::CItem::NewLC( const TDesC& aCaption, const TDesC& aValue ) |
|
387 { |
|
388 CItem* self = new(ELeave) CItem(); |
|
389 CleanupStack::PushL( self ); |
|
390 self->ConstructL( aCaption, aValue ); |
|
391 return self; |
|
392 } |
|
393 |
|
394 |
|
395 CMemSpyThreadInfoItemBase::CItem* CMemSpyThreadInfoItemBase::CItem::NewHexLC( const TDesC& aCaption, TUint aValue ) |
|
396 { |
|
397 CItem* ret = CItem::NewLC( aCaption ); |
|
398 ret->SetHexL( aValue ); |
|
399 return ret; |
|
400 } |
|
401 |
|
402 |
|
403 CMemSpyThreadInfoItemBase::CItem* CMemSpyThreadInfoItemBase::CItem::NewDecimalLC( const TDesC& aCaption, TInt aValue ) |
|
404 { |
|
405 CItem* ret = CItem::NewLC( aCaption ); |
|
406 ret->SetDecimalL( aValue ); |
|
407 return ret; |
|
408 } |
|
409 |
|
410 |
|
411 CMemSpyThreadInfoItemBase::CItem* CMemSpyThreadInfoItemBase::CItem::NewLongLC( const TDesC& aCaption, const TInt64& aValue ) |
|
412 { |
|
413 CItem* ret = CItem::NewLC( aCaption ); |
|
414 ret->SetLongL( aValue ); |
|
415 return ret; |
|
416 } |
|
417 |
|
418 |
|
419 CMemSpyThreadInfoItemBase::CItem* CMemSpyThreadInfoItemBase::CItem::NewYesNoLC( const TDesC& aCaption, TBool aYes ) |
|
420 { |
|
421 CItem* ret = CItem::NewLC( aCaption ); |
|
422 ret->SetYesNoL( aYes ); |
|
423 return ret; |
|
424 } |
|
425 |
|
426 |
|
427 CMemSpyThreadInfoItemBase::CItem* CMemSpyThreadInfoItemBase::CItem::NewOnOffLC( const TDesC& aCaption, TBool aOn ) |
|
428 { |
|
429 CItem* ret = CItem::NewLC( aCaption ); |
|
430 ret->SetOnOffL( aOn ); |
|
431 return ret; |
|
432 } |
|
433 |
|
434 |
|
435 CMemSpyThreadInfoItemBase::CItem* CMemSpyThreadInfoItemBase::CItem::NewPercentageLC( const TDesC& aCaption, TInt aOneHundredPercentValue, TInt aValue ) |
|
436 { |
|
437 CItem* ret = CItem::NewLC( aCaption ); |
|
438 ret->SetPercentageL( aOneHundredPercentValue, aValue ); |
|
439 return ret; |
|
440 } |
|
441 |
|
442 |
|
443 void CMemSpyThreadInfoItemBase::CItem::SetValueL( const TDesC& aValue ) |
|
444 { |
|
445 if ( iValue == NULL ) |
|
446 { |
|
447 iValue = aValue.AllocL(); |
|
448 } |
|
449 else |
|
450 { |
|
451 if ( iValue->Des().MaxLength() < aValue.Length() ) |
|
452 { |
|
453 iValue = iValue->ReAllocL( aValue.Length() ); |
|
454 } |
|
455 |
|
456 // Now its safe to assign new content |
|
457 *iValue = aValue; |
|
458 } |
|
459 |
|
460 UpdateCombinedL(); |
|
461 } |
|
462 |
|
463 |
|
464 void CMemSpyThreadInfoItemBase::CItem::SetHexL( TUint aValue ) |
|
465 { |
|
466 TBuf<KMemSpyNumericFormatBufferSize> val; |
|
467 val.Format( KMemSpyNumericHexFormat, aValue ); |
|
468 SetValueL( val ); |
|
469 } |
|
470 |
|
471 |
|
472 void CMemSpyThreadInfoItemBase::CItem::SetDecimalL( TInt aValue ) |
|
473 { |
|
474 TBuf<KMemSpyNumericFormatBufferSize> val; |
|
475 val.Format( KMemSpyNumericDecFormat, aValue ); |
|
476 SetValueL( val ); |
|
477 } |
|
478 |
|
479 |
|
480 void CMemSpyThreadInfoItemBase::CItem::SetLongL( const TInt64& aValue ) |
|
481 { |
|
482 TBuf<KMemSpyNumericFormatBufferSize> val; |
|
483 val.Format( KMemSpyNumericLongFormat, aValue ); |
|
484 SetValueL( val ); |
|
485 } |
|
486 |
|
487 |
|
488 void CMemSpyThreadInfoItemBase::CItem::SetYesNoL( TBool aYes ) |
|
489 { |
|
490 if ( aYes ) |
|
491 { |
|
492 SetValueL( KMemSpyCaptionYes ); |
|
493 } |
|
494 else |
|
495 { |
|
496 SetValueL( KMemSpyCaptionNo ); |
|
497 } |
|
498 } |
|
499 |
|
500 |
|
501 void CMemSpyThreadInfoItemBase::CItem::SetOnOffL( TBool aOn ) |
|
502 { |
|
503 if ( aOn ) |
|
504 { |
|
505 SetValueL( KMemSpyCaptionOn ); |
|
506 } |
|
507 else |
|
508 { |
|
509 SetValueL( KMemSpyCaptionOff ); |
|
510 } |
|
511 } |
|
512 |
|
513 |
|
514 void CMemSpyThreadInfoItemBase::CItem::SetPercentageL( TInt aOneHundredPercentValue, TInt aValue ) |
|
515 { |
|
516 const TMemSpyPercentText val( MemSpyEngineUtils::FormatPercentage( TReal( aOneHundredPercentValue ), TReal( aValue ) ) ); |
|
517 SetValueL( val ); |
|
518 } |
|
519 |
|
520 |
|
521 void CMemSpyThreadInfoItemBase::CItem::UpdateCombinedL() |
|
522 { |
|
523 const TInt requiredLength = Caption().Length() + Value().Length() + 10; |
|
524 // |
|
525 if ( iCombined == NULL ) |
|
526 { |
|
527 iCombined = HBufC::NewL( requiredLength ); |
|
528 } |
|
529 else if ( iCombined->Des().MaxLength() < requiredLength ) |
|
530 { |
|
531 iCombined = iCombined->ReAllocL( requiredLength ); |
|
532 } |
|
533 |
|
534 TPtr pCombined( iCombined->Des() ); |
|
535 pCombined.Zero(); |
|
536 pCombined.Append( _L("\t") ); |
|
537 pCombined.Append( Caption() ); |
|
538 pCombined.Append( _L("\t\t") ); |
|
539 pCombined.Append( Value() ); |
|
540 } |
|
541 |
|
542 |
|
543 |
|
544 |
|
545 |
|
546 |
|
547 |
|
548 |
|
549 |
|
550 |
|
551 |
|
552 |
|
553 |
|
554 |
|
555 |
|
556 |
|
557 |
|
558 |
|
559 |
|
560 |
|
561 |
|
562 |
|
563 |
|
564 |
|
565 |
|
566 |
|
567 |
|
568 |
|
569 |
|
570 |
|
571 |
|
572 |
|
573 |
|
574 |
|
575 |
|
576 |
|
577 |
|
578 |
|
579 |
|
580 CMemSpyThreadInfoGeneral::CMemSpyThreadInfoGeneral( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction ) |
|
581 : CMemSpyThreadInfoItemBase( aContainer, EMemSpyThreadInfoItemTypeGeneralInfo, aAsyncConstruction ) |
|
582 { |
|
583 } |
|
584 |
|
585 |
|
586 void CMemSpyThreadInfoGeneral::ConstructL() |
|
587 { |
|
588 TBuf<50> temp; |
|
589 RThread thread; |
|
590 Container().Thread().OpenLC( thread ); |
|
591 const CMemSpyProcess& process = Container().Thread().Process(); |
|
592 |
|
593 _LIT( KItem1, "Thread Id" ); |
|
594 AddItemLongL( KItem1, thread.Id() ); |
|
595 |
|
596 _LIT( KItem1a, "Process Id" ); |
|
597 AddItemLongL( KItem1a, (TUint) process.Id() ); |
|
598 |
|
599 _LIT( KItem1b, "SID" ); |
|
600 AddItemHexL( KItem1b, process.SID() ); |
|
601 |
|
602 _LIT( KItem1c, "VID" ); |
|
603 AddItemHexL( KItem1c, process.VID() ); |
|
604 |
|
605 _LIT( KItem2, "Thread Priority" ); |
|
606 CMemSpyThread::AppendPriority( temp, thread.Priority() ); |
|
607 AddItemL( KItem2, temp ); |
|
608 temp.Zero(); |
|
609 |
|
610 _LIT( KItem3, "Process Priority" ); |
|
611 CMemSpyProcess::AppendPriority( temp, thread.ProcessPriority() ); |
|
612 AddItemL( KItem3, temp ); |
|
613 temp.Zero(); |
|
614 |
|
615 _LIT( KItem4, "Request Count" ); |
|
616 AddItemDecimalL( KItem4, thread.RequestCount() ); |
|
617 |
|
618 TInt processHandleCount = 0; |
|
619 TInt threadHandleCount = 0; |
|
620 thread.HandleCount( processHandleCount, threadHandleCount ); |
|
621 |
|
622 _LIT( KItem5a, "Process Handles" ); |
|
623 AddItemDecimalL( KItem5a, processHandleCount ); |
|
624 |
|
625 _LIT( KItem5b, "Thread Handles" ); |
|
626 AddItemDecimalL( KItem5b, threadHandleCount ); |
|
627 |
|
628 // Thread handle info |
|
629 THandleInfo handleInfo; |
|
630 thread.HandleInfo( &handleInfo ); |
|
631 |
|
632 _LIT( KItem5c, "Num. Proc. (Using)" ); |
|
633 AddItemDecimalL( KItem5c, handleInfo.iNumProcesses ); |
|
634 |
|
635 _LIT( KItem5d, "Num. Thread (Using)" ); |
|
636 AddItemDecimalL( KItem5d, handleInfo.iNumThreads ); |
|
637 |
|
638 _LIT( KItem5e, "Attributes" ); |
|
639 AddItemDecimalL( KItem5e, thread.Attributes() ); |
|
640 |
|
641 // CPU time (request special kernel build) |
|
642 TTimeIntervalMicroSeconds cpuTime; |
|
643 if ( thread.GetCpuTime( cpuTime ) == KErrNone ) |
|
644 { |
|
645 _LIT( KItem5f, "CPU Time (us)" ); |
|
646 const TInt64 time = cpuTime.Int64(); |
|
647 AddItemLongL( KItem5f, time ); |
|
648 } |
|
649 |
|
650 // Exit info |
|
651 _LIT( KItem6, "Exit Type" ); |
|
652 CMemSpyThread::AppendExitType( temp, thread.ExitType() ); |
|
653 AddItemL( KItem6, temp ); |
|
654 temp.Zero(); |
|
655 |
|
656 if ( thread.ExitType() != EExitPending ) |
|
657 { |
|
658 _LIT( KItem7, "Exit Reason" ); |
|
659 AddItemDecimalL( KItem7, thread.ExitReason() ); |
|
660 |
|
661 _LIT( KItem8, "Exit Category" ); |
|
662 const TExitCategoryName cat( thread.ExitCategory() ); |
|
663 AddItemL( KItem8, cat ); |
|
664 } |
|
665 |
|
666 // Registers |
|
667 MakeRegisterListingL( thread ); |
|
668 |
|
669 CleanupStack::PopAndDestroy( &thread ); |
|
670 |
|
671 Container().NotifyObserverL( MMemSpyThreadInfoContainerObserver::EInfoItemChanged, Type() ); |
|
672 } |
|
673 |
|
674 |
|
675 CMemSpyThreadInfoGeneral* CMemSpyThreadInfoGeneral::NewLC( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction ) |
|
676 { |
|
677 CMemSpyThreadInfoGeneral* self = new(ELeave) CMemSpyThreadInfoGeneral( aContainer, aAsyncConstruction ); |
|
678 CleanupStack::PushL( self ); |
|
679 if ( !aAsyncConstruction ) |
|
680 { |
|
681 self->ConstructL(); |
|
682 } |
|
683 return self; |
|
684 } |
|
685 |
|
686 |
|
687 EXPORT_C TPtrC CMemSpyThreadInfoGeneral::Name() const |
|
688 { |
|
689 _LIT(KName, "\tGeneral"); |
|
690 return TPtrC( KName ); |
|
691 } |
|
692 |
|
693 |
|
694 void CMemSpyThreadInfoGeneral::MakeRegisterListingL( RThread& aThread ) |
|
695 { |
|
696 #ifndef __WINS__ |
|
697 _LIT(KRegFormatGeneral, "R%02d"); |
|
698 _LIT(KRegFormatSP, "SP"); |
|
699 _LIT(KRegFormatLR, "LR"); |
|
700 _LIT(KRegFormatPC, "PC"); |
|
701 _LIT(KRegFormatFlags, "Flags"); |
|
702 _LIT(KRegFormatDACR, "DACR"); // Data access control register |
|
703 // |
|
704 TArmRegSet regList; |
|
705 TPckg<TArmRegSet> pRegList( regList ); |
|
706 // |
|
707 aThread.Context( pRegList ); |
|
708 TArmReg* pReg = reinterpret_cast<TArmReg*>( ®List ); |
|
709 // |
|
710 for( TInt i=0; i<KArmRegisterCount; i++ ) |
|
711 { |
|
712 const TArmReg regValue = pReg[ i ]; |
|
713 // |
|
714 if ( i <= EArmR12 ) |
|
715 { |
|
716 TBuf<128> buf; |
|
717 buf.Format( KRegFormatGeneral, i ); |
|
718 AddItemHexL( buf, regValue ); |
|
719 } |
|
720 else |
|
721 { |
|
722 TPtrC pCaption( KRegFormatGeneral ); |
|
723 // |
|
724 if ( i == EArmSp ) |
|
725 { |
|
726 pCaption.Set( KRegFormatSP ); |
|
727 } |
|
728 else if ( i == EArmLr ) |
|
729 { |
|
730 pCaption.Set( KRegFormatLR ); |
|
731 } |
|
732 else if ( i == EArmPc ) |
|
733 { |
|
734 pCaption.Set( KRegFormatPC ); |
|
735 } |
|
736 else if ( i == EArmFlags ) |
|
737 { |
|
738 pCaption.Set( KRegFormatFlags ); |
|
739 } |
|
740 else if ( i == EArmDacr ) |
|
741 { |
|
742 pCaption.Set( KRegFormatDACR ); |
|
743 } |
|
744 // |
|
745 AddItemHexL( pCaption, regValue ); |
|
746 } |
|
747 } |
|
748 #else |
|
749 (void) aThread; |
|
750 #endif |
|
751 } |
|
752 |
|
753 |
|
754 |
|
755 |
|
756 |
|
757 |
|
758 |
|
759 |
|
760 |
|
761 |
|
762 |
|
763 |
|
764 |
|
765 |
|
766 CMemSpyThreadInfoHeap::CMemSpyThreadInfoHeap( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction ) |
|
767 : CMemSpyThreadInfoItemBase( aContainer, EMemSpyThreadInfoItemTypeHeap, aAsyncConstruction ) |
|
768 { |
|
769 } |
|
770 |
|
771 |
|
772 void CMemSpyThreadInfoHeap::ConstructL() |
|
773 { |
|
774 CMemSpyEngineHelperHeap& heapHelper = Engine().HelperHeap(); |
|
775 |
|
776 // Get heap info first of all |
|
777 TMemSpyHeapInfo info; |
|
778 heapHelper.GetHeapInfoUserL( Container().Thread().Process().Id(), Container().Thread().Id(), info ); |
|
779 CMemSpyEngineOutputList* list = heapHelper.NewHeapSummaryShortLC( info ); |
|
780 |
|
781 // Now add each item to our view |
|
782 const TInt count = list->Count(); |
|
783 for( TInt i=0; i<count; i++ ) |
|
784 { |
|
785 const CMemSpyEngineOutputListItem& item = list->Item( i ); |
|
786 // |
|
787 AddItemL( item.Caption(), item.Value() ); |
|
788 } |
|
789 |
|
790 // Tidy up |
|
791 CleanupStack::PopAndDestroy( list ); |
|
792 Container().NotifyObserverL( MMemSpyThreadInfoContainerObserver::EInfoItemChanged, Type() ); |
|
793 } |
|
794 |
|
795 |
|
796 CMemSpyThreadInfoHeap* CMemSpyThreadInfoHeap::NewLC( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction ) |
|
797 { |
|
798 CMemSpyThreadInfoHeap* self = new(ELeave) CMemSpyThreadInfoHeap( aContainer, aAsyncConstruction ); |
|
799 CleanupStack::PushL( self ); |
|
800 if ( !aAsyncConstruction ) |
|
801 { |
|
802 self->ConstructL(); |
|
803 } |
|
804 return self; |
|
805 } |
|
806 |
|
807 |
|
808 EXPORT_C TPtrC CMemSpyThreadInfoHeap::Name() const |
|
809 { |
|
810 _LIT(KName, "\tHeap"); |
|
811 return TPtrC( KName ); |
|
812 } |
|
813 |
|
814 |
|
815 |
|
816 |
|
817 |
|
818 |
|
819 |
|
820 |
|
821 |
|
822 |
|
823 |
|
824 |
|
825 |
|
826 |
|
827 |
|
828 |
|
829 CMemSpyThreadInfoActiveObjects::CMemSpyThreadInfoActiveObjects( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction ) |
|
830 : CMemSpyThreadInfoItemBase( aContainer, EMemSpyThreadInfoItemTypeActiveObject, aAsyncConstruction ) |
|
831 { |
|
832 } |
|
833 |
|
834 |
|
835 CMemSpyThreadInfoActiveObjects::~CMemSpyThreadInfoActiveObjects() |
|
836 { |
|
837 delete iItems; |
|
838 } |
|
839 |
|
840 |
|
841 void CMemSpyThreadInfoActiveObjects::ConstructL() |
|
842 { |
|
843 CMemSpyEngine& engine = Container().Thread().Process().Engine(); |
|
844 engine.ProcessSuspendLC( Container().Thread().Process().Id() ); |
|
845 // |
|
846 CMemSpyEngineActiveObjectArray* activeObjects = engine.HelperActiveObject().ActiveObjectListL( Container().Thread() ); |
|
847 delete iItems; |
|
848 iItems = activeObjects; |
|
849 // |
|
850 CleanupStack::PopAndDestroy(); // ProcessSuspendLC |
|
851 |
|
852 Container().NotifyObserverL( MMemSpyThreadInfoContainerObserver::EInfoItemChanged, Type() ); |
|
853 } |
|
854 |
|
855 |
|
856 CMemSpyThreadInfoActiveObjects* CMemSpyThreadInfoActiveObjects::NewLC( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction ) |
|
857 { |
|
858 CMemSpyThreadInfoActiveObjects* self = new(ELeave) CMemSpyThreadInfoActiveObjects( aContainer, aAsyncConstruction ); |
|
859 CleanupStack::PushL( self ); |
|
860 if ( !aAsyncConstruction ) |
|
861 { |
|
862 self->ConstructL(); |
|
863 } |
|
864 return self; |
|
865 } |
|
866 |
|
867 |
|
868 EXPORT_C TPtrC CMemSpyThreadInfoActiveObjects::Name() const |
|
869 { |
|
870 _LIT(KName, "\tActive Objects"); |
|
871 return TPtrC( KName ); |
|
872 } |
|
873 |
|
874 |
|
875 EXPORT_C TInt CMemSpyThreadInfoActiveObjects::MdcaCount() const |
|
876 { |
|
877 TInt count = 0; |
|
878 // |
|
879 if ( iItems ) |
|
880 { |
|
881 count = iItems->MdcaCount(); |
|
882 } |
|
883 // |
|
884 return count; |
|
885 } |
|
886 |
|
887 |
|
888 EXPORT_C TPtrC CMemSpyThreadInfoActiveObjects::MdcaPoint(TInt aIndex) const |
|
889 { |
|
890 TPtrC ret( KNullDesC ); |
|
891 // |
|
892 if ( iItems ) |
|
893 { |
|
894 ret.Set( iItems->MdcaPoint( aIndex ) ); |
|
895 } |
|
896 // |
|
897 return ret; |
|
898 } |
|
899 |
|
900 |
|
901 |
|
902 |
|
903 |
|
904 |
|
905 |
|
906 |
|
907 |
|
908 |
|
909 |
|
910 |
|
911 CMemSpyThreadInfoOpenFiles::CMemSpyThreadInfoOpenFiles( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction ) |
|
912 : CMemSpyThreadInfoItemBase( aContainer, EMemSpyThreadInfoItemTypeOpenFiles, aAsyncConstruction ) |
|
913 { |
|
914 } |
|
915 |
|
916 |
|
917 void CMemSpyThreadInfoOpenFiles::ConstructL() |
|
918 { |
|
919 _LIT(KSpace, " "); |
|
920 // |
|
921 const TThreadId myThreadId = Container().Thread().Id(); |
|
922 CMemSpyEngine& engine = Container().Thread().Process().Engine(); |
|
923 RFs& fsSession = engine.FsSession(); |
|
924 // |
|
925 TMemSpySizeText valueBuf; |
|
926 TBuf<128> timeBuf; |
|
927 TOpenFileScan scanner( fsSession ); |
|
928 // |
|
929 CFileList* list = NULL; |
|
930 scanner.NextL( list ); |
|
931 |
|
932 while( list != NULL ) |
|
933 { |
|
934 if ( scanner.ThreadId() == myThreadId ) |
|
935 { |
|
936 CleanupStack::PushL( list ); |
|
937 |
|
938 const TInt entryCount = list->Count(); |
|
939 for(TInt i=0; i<entryCount; i++) |
|
940 { |
|
941 const TEntry& entry = (*list)[ i ]; |
|
942 |
|
943 // Get time and size format strings |
|
944 valueBuf = MemSpyEngineUtils::FormatSizeText( entry.iSize ); |
|
945 MemSpyEngineUtils::FormatTimeL( timeBuf, entry.iModified ); |
|
946 timeBuf.Insert( 0, KSpace ); |
|
947 timeBuf.Insert( 0, valueBuf ); |
|
948 |
|
949 // Get just file name |
|
950 TParsePtrC parser( entry.iName ); |
|
951 const TPtrC pJustName( parser.NameAndExt() ); |
|
952 |
|
953 // Create item |
|
954 AddItemL( pJustName, timeBuf ); |
|
955 } |
|
956 |
|
957 CleanupStack::Pop( list ); |
|
958 } |
|
959 |
|
960 delete list; |
|
961 list = NULL; |
|
962 scanner.NextL( list ); |
|
963 } |
|
964 |
|
965 Container().NotifyObserverL( MMemSpyThreadInfoContainerObserver::EInfoItemChanged, Type() ); |
|
966 } |
|
967 |
|
968 |
|
969 CMemSpyThreadInfoOpenFiles* CMemSpyThreadInfoOpenFiles::NewLC( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction ) |
|
970 { |
|
971 CMemSpyThreadInfoOpenFiles* self = new(ELeave) CMemSpyThreadInfoOpenFiles( aContainer, aAsyncConstruction ); |
|
972 CleanupStack::PushL( self ); |
|
973 if ( !aAsyncConstruction ) |
|
974 { |
|
975 self->ConstructL(); |
|
976 } |
|
977 return self; |
|
978 } |
|
979 |
|
980 |
|
981 EXPORT_C TPtrC CMemSpyThreadInfoOpenFiles::Name() const |
|
982 { |
|
983 _LIT(KName, "\tOpen Files"); |
|
984 return TPtrC( KName ); |
|
985 } |
|
986 |
|
987 |
|
988 |
|
989 |
|
990 |
|
991 |
|
992 |
|
993 |
|
994 |
|
995 |
|
996 |
|
997 |
|
998 |
|
999 |
|
1000 |
|
1001 |
|
1002 CMemSpyThreadInfoStack::CMemSpyThreadInfoStack( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction ) |
|
1003 : CMemSpyThreadInfoItemBase( aContainer, EMemSpyThreadInfoItemTypeStack, aAsyncConstruction ) |
|
1004 { |
|
1005 } |
|
1006 |
|
1007 |
|
1008 void CMemSpyThreadInfoStack::ConstructL() |
|
1009 { |
|
1010 CMemSpyEngine& engine = Container().Thread().Process().Engine(); |
|
1011 engine.ProcessSuspendLC( Container().Thread().Process().Id() ); |
|
1012 // |
|
1013 TMemSpyDriverStackInfo info; |
|
1014 const TInt error = engine.Driver().GetStackInfo( Container().Thread().Id(), info ); |
|
1015 User::LeaveIfError( error ); |
|
1016 |
|
1017 _LIT( KItem1, "Size" ); |
|
1018 AddItemDecimalL( KItem1, info.iUserStackSize ); |
|
1019 |
|
1020 #ifndef __WINS__ |
|
1021 const TInt userStackUsage = (TInt) ( info.iUserStackBase + info.iUserStackSize ) - info.iUserStackPointer; |
|
1022 const TInt userStackHighWaterMarkUsage = (TInt) ( info.iUserStackBase + info.iUserStackSize ) - info.iUserStackHighWatermark; |
|
1023 |
|
1024 _LIT( KItem2, "Stack used" ); |
|
1025 AddItemDecimalL( KItem2, userStackUsage ); |
|
1026 |
|
1027 _LIT( KItem3, "(percentage)" ); |
|
1028 AddItemPercentageL( KItem3, info.iUserStackSize, userStackUsage ); |
|
1029 |
|
1030 _LIT( KItem4, "High watermark" ); |
|
1031 AddItemDecimalL( KItem4, userStackHighWaterMarkUsage ); |
|
1032 |
|
1033 _LIT( KItem5, "(percentage)" ); |
|
1034 AddItemPercentageL( KItem5, info.iUserStackSize, userStackHighWaterMarkUsage ); |
|
1035 #endif |
|
1036 |
|
1037 _LIT( KItem6, "Base address" ); |
|
1038 AddItemHexL( KItem6, info.iUserStackBase ); |
|
1039 |
|
1040 #ifndef __WINS__ |
|
1041 _LIT( KItem7, "Current pointer" ); |
|
1042 AddItemHexL( KItem7, info.iUserStackPointer ); |
|
1043 #endif |
|
1044 // |
|
1045 CleanupStack::PopAndDestroy(); // ProcessSuspendLC |
|
1046 |
|
1047 Container().NotifyObserverL( MMemSpyThreadInfoContainerObserver::EInfoItemChanged, Type() ); |
|
1048 } |
|
1049 |
|
1050 |
|
1051 CMemSpyThreadInfoStack* CMemSpyThreadInfoStack::NewLC( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction ) |
|
1052 { |
|
1053 CMemSpyThreadInfoStack* self = new(ELeave) CMemSpyThreadInfoStack( aContainer, aAsyncConstruction ); |
|
1054 CleanupStack::PushL( self ); |
|
1055 if ( !aAsyncConstruction ) |
|
1056 { |
|
1057 self->ConstructL(); |
|
1058 } |
|
1059 return self; |
|
1060 } |
|
1061 |
|
1062 |
|
1063 EXPORT_C TPtrC CMemSpyThreadInfoStack::Name() const |
|
1064 { |
|
1065 _LIT(KName, "\tStack"); |
|
1066 return TPtrC( KName ); |
|
1067 } |
|
1068 |
|
1069 |
|
1070 |
|
1071 |
|
1072 |
|
1073 |
|
1074 |
|
1075 |
|
1076 |
|
1077 |
|
1078 |
|
1079 |
|
1080 |
|
1081 |
|
1082 |
|
1083 |
|
1084 |
|
1085 |
|
1086 |
|
1087 |
|
1088 |
|
1089 |
|
1090 |
|
1091 |
|
1092 |
|
1093 |
|
1094 |
|
1095 |
|
1096 |
|
1097 |
|
1098 CMemSpyThreadInfoChunk::CMemSpyThreadInfoChunk( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction ) |
|
1099 : CMemSpyThreadInfoItemBase( aContainer, EMemSpyThreadInfoItemTypeChunk, aAsyncConstruction ) |
|
1100 { |
|
1101 } |
|
1102 |
|
1103 |
|
1104 CMemSpyThreadInfoChunk::~CMemSpyThreadInfoChunk() |
|
1105 { |
|
1106 delete iList; |
|
1107 } |
|
1108 |
|
1109 |
|
1110 void CMemSpyThreadInfoChunk::ConstructL() |
|
1111 { |
|
1112 CMemSpyEngine& engine = Container().Thread().Process().Engine(); |
|
1113 engine.ProcessSuspendLC( Container().Thread().Process().Id() ); |
|
1114 // |
|
1115 CMemSpyEngineChunkList* list = engine.HelperChunk().ListForThreadL( Container().Thread().Id() ); |
|
1116 delete iList; |
|
1117 iList = list; |
|
1118 // |
|
1119 CleanupStack::PopAndDestroy(); // ProcessSuspendLC |
|
1120 |
|
1121 Container().NotifyObserverL( MMemSpyThreadInfoContainerObserver::EInfoItemChanged, Type() ); |
|
1122 } |
|
1123 |
|
1124 |
|
1125 CMemSpyThreadInfoChunk* CMemSpyThreadInfoChunk::NewLC( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction ) |
|
1126 { |
|
1127 CMemSpyThreadInfoChunk* self = new(ELeave) CMemSpyThreadInfoChunk( aContainer, aAsyncConstruction ); |
|
1128 CleanupStack::PushL( self ); |
|
1129 if ( !aAsyncConstruction ) |
|
1130 { |
|
1131 self->ConstructL(); |
|
1132 } |
|
1133 return self; |
|
1134 } |
|
1135 |
|
1136 |
|
1137 EXPORT_C TPtrC CMemSpyThreadInfoChunk::Name() const |
|
1138 { |
|
1139 _LIT(KName, "\tChunks"); |
|
1140 return TPtrC( KName ); |
|
1141 } |
|
1142 |
|
1143 |
|
1144 EXPORT_C TInt CMemSpyThreadInfoChunk::MdcaCount() const |
|
1145 { |
|
1146 TInt count = 0; |
|
1147 // |
|
1148 if ( iList ) |
|
1149 { |
|
1150 count = iList->MdcaCount(); |
|
1151 } |
|
1152 // |
|
1153 return count; |
|
1154 } |
|
1155 |
|
1156 |
|
1157 EXPORT_C TPtrC CMemSpyThreadInfoChunk::MdcaPoint(TInt aIndex) const |
|
1158 { |
|
1159 TPtrC ret( KNullDesC ); |
|
1160 // |
|
1161 if ( iList ) |
|
1162 { |
|
1163 ret.Set( iList->MdcaPoint( aIndex ) ); |
|
1164 } |
|
1165 // |
|
1166 return ret; |
|
1167 } |
|
1168 |
|
1169 |
|
1170 |
|
1171 |
|
1172 |
|
1173 |
|
1174 |
|
1175 |
|
1176 |
|
1177 |
|
1178 |
|
1179 |
|
1180 |
|
1181 |
|
1182 |
|
1183 |
|
1184 |
|
1185 |
|
1186 CMemSpyThreadInfoCodeSeg::CMemSpyThreadInfoCodeSeg( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction ) |
|
1187 : CMemSpyThreadInfoItemBase( aContainer, EMemSpyThreadInfoItemTypeCodeSeg, aAsyncConstruction ) |
|
1188 { |
|
1189 } |
|
1190 |
|
1191 |
|
1192 CMemSpyThreadInfoCodeSeg::~CMemSpyThreadInfoCodeSeg() |
|
1193 { |
|
1194 delete iList; |
|
1195 } |
|
1196 |
|
1197 |
|
1198 void CMemSpyThreadInfoCodeSeg::ConstructL() |
|
1199 { |
|
1200 CMemSpyEngine& engine = Container().Thread().Process().Engine(); |
|
1201 engine.ProcessSuspendLC( Container().Thread().Process().Id() ); |
|
1202 // |
|
1203 CMemSpyEngineCodeSegList* list = engine.HelperCodeSegment().CodeSegmentListL( Container().Thread().Process().Id() ); |
|
1204 delete iList; |
|
1205 iList = list; |
|
1206 // |
|
1207 CleanupStack::PopAndDestroy(); // ProcessSuspendLC |
|
1208 |
|
1209 Container().NotifyObserverL( MMemSpyThreadInfoContainerObserver::EInfoItemChanged, Type() ); |
|
1210 } |
|
1211 |
|
1212 |
|
1213 CMemSpyThreadInfoCodeSeg* CMemSpyThreadInfoCodeSeg::NewLC( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction ) |
|
1214 { |
|
1215 CMemSpyThreadInfoCodeSeg* self = new(ELeave) CMemSpyThreadInfoCodeSeg( aContainer, aAsyncConstruction ); |
|
1216 CleanupStack::PushL( self ); |
|
1217 if ( !aAsyncConstruction ) |
|
1218 { |
|
1219 self->ConstructL(); |
|
1220 } |
|
1221 return self; |
|
1222 } |
|
1223 |
|
1224 |
|
1225 EXPORT_C TPtrC CMemSpyThreadInfoCodeSeg::Name() const |
|
1226 { |
|
1227 _LIT(KName, "\tCode Segments"); |
|
1228 return TPtrC( KName ); |
|
1229 } |
|
1230 |
|
1231 |
|
1232 EXPORT_C TInt CMemSpyThreadInfoCodeSeg::MdcaCount() const |
|
1233 { |
|
1234 TInt count = 0; |
|
1235 // |
|
1236 if ( iList ) |
|
1237 { |
|
1238 count = iList->MdcaCount(); |
|
1239 } |
|
1240 // |
|
1241 return count; |
|
1242 } |
|
1243 |
|
1244 |
|
1245 EXPORT_C TPtrC CMemSpyThreadInfoCodeSeg::MdcaPoint(TInt aIndex) const |
|
1246 { |
|
1247 TPtrC ret( KNullDesC ); |
|
1248 // |
|
1249 if ( iList ) |
|
1250 { |
|
1251 ret.Set( iList->MdcaPoint( aIndex ) ); |
|
1252 } |
|
1253 // |
|
1254 return ret; |
|
1255 } |
|
1256 |
|
1257 |
|
1258 |
|
1259 |
|
1260 |
|
1261 |
|
1262 |
|
1263 |
|
1264 |
|
1265 |
|
1266 |
|
1267 |
|
1268 |
|
1269 |
|
1270 |
|
1271 |
|
1272 |
|
1273 |
|
1274 |
|
1275 |
|
1276 |
|
1277 |
|
1278 |
|
1279 |
|
1280 |
|
1281 CMemSpyThreadInfoHandleObjectBase::CMemSpyThreadInfoHandleObjectBase( CMemSpyThreadInfoContainer& aContainer, TMemSpyThreadInfoItemType aItemType, TMemSpyDriverContainerType aContainerType, TBool aAsyncConstruction ) |
|
1282 : CMemSpyThreadInfoItemBase( aContainer, aItemType, aAsyncConstruction ), iContainerType( aContainerType ) |
|
1283 { |
|
1284 } |
|
1285 |
|
1286 |
|
1287 CMemSpyThreadInfoHandleObjectBase::~CMemSpyThreadInfoHandleObjectBase() |
|
1288 { |
|
1289 #ifdef _DEBUG |
|
1290 RDebug::Printf( "CMemSpyThreadInfoHandleObjectBase::~CMemSpyThreadInfoHandleObjectBase() - this: 0x%08x", this ); |
|
1291 #endif |
|
1292 iInfoItems.Close(); |
|
1293 } |
|
1294 |
|
1295 |
|
1296 void CMemSpyThreadInfoHandleObjectBase::ConstructL() |
|
1297 { |
|
1298 #ifdef _DEBUG |
|
1299 RDebug::Printf( "CMemSpyThreadInfoHandleObjectBase::ConstructL() - START" ); |
|
1300 #endif |
|
1301 iInfoItems.Reset(); |
|
1302 // |
|
1303 CMemSpyProcess& process = Container().Thread().Process(); |
|
1304 CMemSpyEngine& engine = process.Engine(); |
|
1305 engine.ProcessSuspendLC( process.Id() ); |
|
1306 // |
|
1307 RArray<THandleWrapper> handles; |
|
1308 CleanupClosePushL( handles ); |
|
1309 GetHandlesL( handles ); |
|
1310 #ifdef _DEBUG |
|
1311 RDebug::Printf( "CMemSpyThreadInfoHandleObjectBase::ConstructL() - got %d handle entries...", handles.Count() ); |
|
1312 #endif |
|
1313 // |
|
1314 TFullName name; |
|
1315 TMemSpyDriverHandleInfoGeneric info; |
|
1316 // |
|
1317 const TInt count = handles.Count(); |
|
1318 for (TInt i=0; i<count; i++) |
|
1319 { |
|
1320 const THandleWrapper& handleWrapper = handles[ i ]; |
|
1321 // |
|
1322 const TInt r = engine.Driver().GetGenericHandleInfo( Container().Thread().Id(), handleWrapper.iType, handleWrapper.iHandle, info ); |
|
1323 // |
|
1324 #ifdef _DEBUG |
|
1325 RDebug::Printf( "CMemSpyThreadInfoHandleObjectBase::ConstructL() - handle[%3d] 0x%08x, type: %d, refCount: %d, r: %d", i, handleWrapper.iHandle, handleWrapper.iType, handleWrapper.iRefCount, r ); |
|
1326 #endif |
|
1327 // |
|
1328 if (r == KErrNone) |
|
1329 { |
|
1330 name.Copy( info.iName ); |
|
1331 #ifdef _DEBUG |
|
1332 RDebug::Print( _L( "CMemSpyThreadInfoHandleObjectBase::ConstructL() - HANDLE [%3d] %S"), handleWrapper.iRefCount, &name ); |
|
1333 #endif |
|
1334 StripProcessAndThreadNames( name ); |
|
1335 // |
|
1336 iInfoItems.AppendL( info ); |
|
1337 HandleContainerItemL( info, handleWrapper.iRefCount, name ); |
|
1338 } |
|
1339 } |
|
1340 |
|
1341 CleanupStack::PopAndDestroy( &handles ); |
|
1342 CleanupStack::PopAndDestroy(); // ProcessSuspendLC |
|
1343 |
|
1344 HandleAllItemsLocatedL(); |
|
1345 |
|
1346 Container().NotifyObserverL( MMemSpyThreadInfoContainerObserver::EInfoItemChanged, Type() ); |
|
1347 } |
|
1348 |
|
1349 |
|
1350 TBool CMemSpyThreadInfoHandleObjectBase::THandleWrapper::Match( const THandleWrapper& aLeft, const THandleWrapper& aRight ) |
|
1351 { |
|
1352 return ( aLeft.iHandle == aRight.iHandle ); |
|
1353 } |
|
1354 |
|
1355 |
|
1356 EXPORT_C TInt CMemSpyThreadInfoHandleObjectBase::DetailsIndexByEntry( const TMemSpyDriverHandleInfoGeneric& aEntry ) const |
|
1357 { |
|
1358 #ifdef _DEBUG |
|
1359 RDebug::Printf( "CMemSpyThreadInfoHandleObjectBase::DetailsIndexByEntry() - START - this: 0x%08x, aEntry.iHandle: 0x%08x", this, aEntry.iHandle ); |
|
1360 #endif |
|
1361 // |
|
1362 const TInt ret = DetailsIndexByHandle( aEntry.iHandle ); |
|
1363 // |
|
1364 #ifdef _DEBUG |
|
1365 RDebug::Printf( "CMemSpyThreadInfoHandleObjectBase::DetailsIndexByEntry() - END - ret: %d", ret ); |
|
1366 #endif |
|
1367 return ret; |
|
1368 } |
|
1369 |
|
1370 |
|
1371 EXPORT_C TInt CMemSpyThreadInfoHandleObjectBase::DetailsIndexByHandle( TAny* aHandle ) const |
|
1372 { |
|
1373 #ifdef _DEBUG |
|
1374 RDebug::Printf( "CMemSpyThreadInfoHandleObjectBase::DetailsIndexByHandle() - START - this: 0x%08x, aHandle: 0x%08x", this, aHandle ); |
|
1375 #endif |
|
1376 TInt ret = KErrNotFound; |
|
1377 // |
|
1378 const TInt count = DetailsCount(); |
|
1379 for(TInt i=0; i<count; i++) |
|
1380 { |
|
1381 const TMemSpyDriverHandleInfoGeneric& item = DetailsAt( i ); |
|
1382 if ( item.iHandle == aHandle ) |
|
1383 { |
|
1384 ret = i; |
|
1385 break; |
|
1386 } |
|
1387 } |
|
1388 // |
|
1389 #ifdef _DEBUG |
|
1390 RDebug::Printf( "CMemSpyThreadInfoHandleObjectBase::DetailsIndexByHandle() - END - ret: %d", ret ); |
|
1391 #endif |
|
1392 return ret; |
|
1393 } |
|
1394 |
|
1395 |
|
1396 |
|
1397 |
|
1398 |
|
1399 |
|
1400 |
|
1401 |
|
1402 |
|
1403 |
|
1404 |
|
1405 |
|
1406 |
|
1407 |
|
1408 CMemSpyThreadInfoHandleByContainer::CMemSpyThreadInfoHandleByContainer( CMemSpyThreadInfoContainer& aContainer, TMemSpyThreadInfoItemType aItemType, TMemSpyDriverContainerType aContainerType, TBool aAsyncConstruction ) |
|
1409 : CMemSpyThreadInfoHandleObjectBase( aContainer, aItemType, aContainerType, aAsyncConstruction ) |
|
1410 { |
|
1411 } |
|
1412 |
|
1413 |
|
1414 void CMemSpyThreadInfoHandleByContainer::GetHandlesL( RArray<THandleWrapper>& aArray ) |
|
1415 { |
|
1416 #ifdef _DEBUG |
|
1417 RDebug::Printf( "CMemSpyThreadInfoHandleByContainer::GetHandlesL() - START - container: %d", ContainerType() ); |
|
1418 #endif |
|
1419 |
|
1420 aArray.Reset(); |
|
1421 |
|
1422 // Our handles will be stored here... duplicates are filtered out |
|
1423 TInt r = KErrNone; |
|
1424 TInt c = KMemSpyDefaultMaxHandleCount; |
|
1425 TAny* handles[ KMemSpyDefaultMaxHandleCount ]; |
|
1426 |
|
1427 CMemSpyProcess& process = Container().Thread().Process(); |
|
1428 CMemSpyEngine& engine = process.Engine(); |
|
1429 TIdentityRelation<CMemSpyThreadInfoHandleObjectBase::THandleWrapper> finder( THandleWrapper::Match ); |
|
1430 |
|
1431 // First get the handles for the process |
|
1432 if ( r == KErrNone ) |
|
1433 { |
|
1434 c = KMemSpyDefaultMaxHandleCount; |
|
1435 r = engine.Driver().GetProcessHandlesByType( process.Id(), ContainerType(), handles, c ); |
|
1436 if ( r == KErrNone && c > 0 ) |
|
1437 { |
|
1438 c = Min( c, KMemSpyDefaultMaxHandleCount ); |
|
1439 for( TInt i=0; i<c; i++ ) |
|
1440 { |
|
1441 TAny* handle = handles[ i ]; |
|
1442 |
|
1443 // Create temporary entry that we'll use as the key in our array... |
|
1444 CMemSpyThreadInfoHandleObjectBase::THandleWrapper entry( handle, ContainerType() ); |
|
1445 |
|
1446 // Find existing duplicate entry (if there is one...) |
|
1447 const TInt errorOrIndex = aArray.Find( entry, finder ); |
|
1448 #ifdef _DEBUG |
|
1449 RDebug::Printf( "CMemSpyThreadInfoHandleByContainer::GetHandlesL() - PROC[%03d/%03d] - handle: 0x%08x, foundIndex: %d", i+1, c, handle, errorOrIndex ); |
|
1450 #endif |
|
1451 |
|
1452 if ( errorOrIndex == KErrNotFound ) |
|
1453 { |
|
1454 // Not a duplicate handle, so keep it |
|
1455 aArray.AppendL( entry ); |
|
1456 #ifdef _DEBUG |
|
1457 RDebug::Printf( " new entry: 0x%08x", handle ); |
|
1458 #endif |
|
1459 } |
|
1460 else if ( errorOrIndex >= 0 ) |
|
1461 { |
|
1462 // Increment reference count for duplicates... |
|
1463 CMemSpyThreadInfoHandleObjectBase::THandleWrapper& existingEntry = aArray[ errorOrIndex ]; |
|
1464 ++existingEntry.iRefCount; |
|
1465 #ifdef _DEBUG |
|
1466 RDebug::Printf( " dupe entry - count is now: %d", existingEntry.iRefCount ); |
|
1467 #endif |
|
1468 } |
|
1469 } |
|
1470 } |
|
1471 } |
|
1472 |
|
1473 // Next get the handles for the thread |
|
1474 if ( r == KErrNone ) |
|
1475 { |
|
1476 c = KMemSpyDefaultMaxHandleCount; |
|
1477 r = engine.Driver().GetThreadHandlesByType( Container().Thread().Id(), ContainerType(), handles, c ); |
|
1478 if ( r == KErrNone && c > 0 ) |
|
1479 { |
|
1480 c = Min( c, KMemSpyDefaultMaxHandleCount ); |
|
1481 for( TInt i=0; i<c; i++ ) |
|
1482 { |
|
1483 TAny* handle = handles[ i ]; |
|
1484 |
|
1485 // Create temporary entry that we'll use as the key in our array... |
|
1486 CMemSpyThreadInfoHandleObjectBase::THandleWrapper entry( handle, ContainerType() ); |
|
1487 |
|
1488 // Find existing duplicate entry (if there is one...) |
|
1489 const TInt errorOrIndex = aArray.Find( entry, finder ); |
|
1490 #ifdef _DEBUG |
|
1491 RDebug::Printf( "CMemSpyThreadInfoHandleByContainer::GetHandlesL() - THRD[%03d/%03d] - handle: 0x%08x, foundIndex: %d", i+1, c, handle, errorOrIndex ); |
|
1492 #endif |
|
1493 |
|
1494 if ( errorOrIndex == KErrNotFound ) |
|
1495 { |
|
1496 // Not a duplicate handle, so keep it |
|
1497 aArray.AppendL( entry ); |
|
1498 #ifdef _DEBUG |
|
1499 RDebug::Printf( " new entry: 0x%08x", handle ); |
|
1500 #endif |
|
1501 } |
|
1502 else if ( errorOrIndex >= 0 ) |
|
1503 { |
|
1504 // Increment reference count for duplicates... |
|
1505 CMemSpyThreadInfoHandleObjectBase::THandleWrapper& existingEntry = aArray[ errorOrIndex ]; |
|
1506 ++existingEntry.iRefCount; |
|
1507 #ifdef _DEBUG |
|
1508 RDebug::Printf( " dupe entry - count is now: %d", existingEntry.iRefCount ); |
|
1509 #endif |
|
1510 } |
|
1511 } |
|
1512 } |
|
1513 } |
|
1514 |
|
1515 #ifdef _DEBUG |
|
1516 RDebug::Printf( "CMemSpyThreadInfoHandleByContainer::GetHandlesL() - final handle listing: " ); |
|
1517 |
|
1518 const TInt finalCount = aArray.Count(); |
|
1519 for( TInt i=0; i<finalCount; i++ ) |
|
1520 { |
|
1521 const THandleWrapper& handle = aArray[ i ]; |
|
1522 RDebug::Printf( "entry[%03d/%03d] - handle: 0x%08x, type: %d, refCount: %d", i+1, finalCount, handle.iHandle, handle.iType, handle.iRefCount ); |
|
1523 } |
|
1524 |
|
1525 RDebug::Printf( "CMemSpyThreadInfoHandleByContainer::GetHandlesL() - END - container: %d, finalCount: %d", ContainerType(), finalCount ); |
|
1526 #endif |
|
1527 } |
|
1528 |
|
1529 |
|
1530 |
|
1531 |
|
1532 |
|
1533 |
|
1534 |
|
1535 |
|
1536 |
|
1537 |
|
1538 |
|
1539 |
|
1540 |
|
1541 |
|
1542 |
|
1543 |
|
1544 |
|
1545 |
|
1546 |
|
1547 |
|
1548 |
|
1549 |
|
1550 |
|
1551 |
|
1552 |
|
1553 |
|
1554 |
|
1555 |
|
1556 |
|
1557 |
|
1558 |
|
1559 |
|
1560 |
|
1561 |
|
1562 |
|
1563 |
|
1564 |
|
1565 |
|
1566 |
|
1567 |
|
1568 |
|
1569 |
|
1570 |
|
1571 |
|
1572 |
|
1573 |
|
1574 |
|
1575 |
|
1576 |
|
1577 CMemSpyThreadInfoServer::CMemSpyThreadInfoServer( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction ) |
|
1578 : CMemSpyThreadInfoHandleByContainer( aContainer, EMemSpyThreadInfoItemTypeServer, EMemSpyDriverContainerTypeServer, aAsyncConstruction ) |
|
1579 { |
|
1580 } |
|
1581 |
|
1582 |
|
1583 CMemSpyThreadInfoServer* CMemSpyThreadInfoServer::NewLC( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction ) |
|
1584 { |
|
1585 CMemSpyThreadInfoServer* self = new(ELeave) CMemSpyThreadInfoServer( aContainer, aAsyncConstruction ); |
|
1586 CleanupStack::PushL( self ); |
|
1587 if ( !aAsyncConstruction ) |
|
1588 { |
|
1589 self->ConstructL(); |
|
1590 } |
|
1591 return self; |
|
1592 } |
|
1593 |
|
1594 |
|
1595 EXPORT_C TPtrC CMemSpyThreadInfoServer::Name() const |
|
1596 { |
|
1597 _LIT(KName, "\tServers Running in Thread"); |
|
1598 return TPtrC( KName ); |
|
1599 } |
|
1600 |
|
1601 |
|
1602 void CMemSpyThreadInfoServer::HandleContainerItemL( TMemSpyDriverHandleInfoGeneric& /*aItem*/, TInt /*aRefCount*/, TDes& aFullName ) |
|
1603 { |
|
1604 AddItemL( aFullName, KNullDesC ); |
|
1605 } |
|
1606 |
|
1607 |
|
1608 EXPORT_C TPtrC CMemSpyThreadInfoServer::SessionType( TIpcSessionType aType ) |
|
1609 { |
|
1610 _LIT( KUnsharable, "Unsharable" ); |
|
1611 _LIT( KSharable, "Sharable" ); |
|
1612 _LIT( KGlobalSharable, "Global Sharable" ); |
|
1613 // |
|
1614 TPtrC pType(KNullDesC); |
|
1615 switch( aType ) |
|
1616 { |
|
1617 case EIpcSession_Unsharable: |
|
1618 pType.Set( KUnsharable ); |
|
1619 break; |
|
1620 case EIpcSession_Sharable: |
|
1621 pType.Set( KSharable ); |
|
1622 break; |
|
1623 case EIpcSession_GlobalSharable: |
|
1624 pType.Set( KGlobalSharable ); |
|
1625 break; |
|
1626 default: |
|
1627 pType.Set( KMemSpyUnavailable ); |
|
1628 break; |
|
1629 } |
|
1630 // |
|
1631 return pType; |
|
1632 } |
|
1633 |
|
1634 |
|
1635 |
|
1636 |
|
1637 |
|
1638 |
|
1639 |
|
1640 |
|
1641 |
|
1642 |
|
1643 |
|
1644 |
|
1645 |
|
1646 |
|
1647 |
|
1648 |
|
1649 |
|
1650 |
|
1651 |
|
1652 |
|
1653 |
|
1654 |
|
1655 |
|
1656 |
|
1657 CMemSpyThreadInfoSession::CMemSpyThreadInfoSession( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction ) |
|
1658 : CMemSpyThreadInfoHandleByContainer( aContainer, EMemSpyThreadInfoItemTypeSession, EMemSpyDriverContainerTypeSession, aAsyncConstruction ) |
|
1659 { |
|
1660 } |
|
1661 |
|
1662 |
|
1663 CMemSpyThreadInfoSession::~CMemSpyThreadInfoSession() |
|
1664 { |
|
1665 iServerNames.ResetAndDestroy(); |
|
1666 iServerNames.Close(); |
|
1667 } |
|
1668 |
|
1669 |
|
1670 CMemSpyThreadInfoSession* CMemSpyThreadInfoSession::NewLC( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction ) |
|
1671 { |
|
1672 CMemSpyThreadInfoSession* self = new(ELeave) CMemSpyThreadInfoSession( aContainer, aAsyncConstruction ); |
|
1673 CleanupStack::PushL( self ); |
|
1674 if ( !aAsyncConstruction ) |
|
1675 { |
|
1676 self->ConstructL(); |
|
1677 } |
|
1678 return self; |
|
1679 } |
|
1680 |
|
1681 |
|
1682 EXPORT_C TPtrC CMemSpyThreadInfoSession::Name() const |
|
1683 { |
|
1684 _LIT(KName, "\tClient <-> Server\nConnections"); |
|
1685 return TPtrC( KName ); |
|
1686 } |
|
1687 |
|
1688 |
|
1689 void CMemSpyThreadInfoSession::Reset() |
|
1690 { |
|
1691 CMemSpyThreadInfoHandleByContainer::Reset(); |
|
1692 iServerNames.ResetAndDestroy(); |
|
1693 } |
|
1694 |
|
1695 |
|
1696 EXPORT_C TInt CMemSpyThreadInfoSession::ConnectionCount( const TDesC& aName ) const |
|
1697 { |
|
1698 TInt ret = 0; |
|
1699 |
|
1700 #ifdef _DEBUG |
|
1701 RDebug::Print( _L("CMemSpyThreadInfoSession::ConnectionCount() - START - aName: %S"), &aName ); |
|
1702 #endif |
|
1703 |
|
1704 // See if we have an entry with that name... |
|
1705 TIdentityRelation<CSessionInfoEntry> comparer( CompareEntries ); |
|
1706 HBufC* name = aName.AllocLC(); |
|
1707 CSessionInfoEntry* entry = new(ELeave) CSessionInfoEntry( name ); |
|
1708 CleanupStack::Pop( name ); |
|
1709 CleanupStack::PushL( entry ); |
|
1710 const TInt foundIndex = iServerNames.Find( entry, comparer ); |
|
1711 CleanupStack::PopAndDestroy( entry ); |
|
1712 |
|
1713 // If we did, get the count |
|
1714 if ( foundIndex >=0 && foundIndex < iServerNames.Count() ) |
|
1715 { |
|
1716 ret = iServerNames[ foundIndex ]->iCount; |
|
1717 } |
|
1718 // |
|
1719 #ifdef _DEBUG |
|
1720 RDebug::Printf( "CMemSpyThreadInfoSession::ConnectionCount() - END - ret: %d", ret ); |
|
1721 #endif |
|
1722 // |
|
1723 return ret; |
|
1724 } |
|
1725 |
|
1726 |
|
1727 void CMemSpyThreadInfoSession::HandleContainerItemL( TMemSpyDriverHandleInfoGeneric& aItem, TInt /*aRefCount*/, TDes& aFullName ) |
|
1728 { |
|
1729 // Check whether we have the item already? |
|
1730 TIdentityRelation<CSessionInfoEntry> comparer( CompareEntries ); |
|
1731 |
|
1732 // Prepare object, just in case we don't find it... |
|
1733 HBufC* name = aFullName.AllocLC(); |
|
1734 |
|
1735 #ifdef _DEBUG |
|
1736 TBuf<KMaxName> origName; origName.Copy( aItem.iName ); |
|
1737 RDebug::Print( _L("CMemSpyThreadInfoSession::HandleContainerItemL() - START - handle: 0x%08x, type: %d, origName: %S, modName: %S"), aItem.iHandle, aItem.iType, &origName, name ); |
|
1738 #else |
|
1739 (void) aItem; |
|
1740 #endif |
|
1741 |
|
1742 CSessionInfoEntry* entry = new(ELeave) CSessionInfoEntry( name ); |
|
1743 CleanupStack::Pop( name ); |
|
1744 CleanupStack::PushL( entry ); |
|
1745 |
|
1746 // Search |
|
1747 const TInt foundIndex = iServerNames.Find( entry, comparer ); |
|
1748 if ( foundIndex == KErrNotFound ) |
|
1749 { |
|
1750 // Make new entry |
|
1751 iServerNames.AppendL( entry ); |
|
1752 CleanupStack::Pop( entry ); |
|
1753 } |
|
1754 else if ( foundIndex >= 0 ) |
|
1755 { |
|
1756 // Existing entry, increment count |
|
1757 CleanupStack::PopAndDestroy( entry ); |
|
1758 entry = iServerNames[ foundIndex ]; |
|
1759 ++entry->iCount; |
|
1760 } |
|
1761 else |
|
1762 { |
|
1763 CleanupStack::PopAndDestroy( entry ); |
|
1764 } |
|
1765 |
|
1766 #ifdef _DEBUG |
|
1767 RDebug::Printf( "CMemSpyThreadInfoSession::HandleContainerItemL() - END - foundIndex: %d", foundIndex ); |
|
1768 #endif |
|
1769 } |
|
1770 |
|
1771 |
|
1772 void CMemSpyThreadInfoSession::HandleAllItemsLocatedL() |
|
1773 { |
|
1774 _LIT(KSecondLineFormatStringCount1, "1 connection"); |
|
1775 _LIT(KSecondLineFormatStringCountMoreThanOne, "%d connections"); |
|
1776 TBuf<50> buf; |
|
1777 |
|
1778 // All items have been found, now create listbox entries |
|
1779 const TInt count = iServerNames.Count(); |
|
1780 for( TInt i=0; i<count; i++ ) |
|
1781 { |
|
1782 CSessionInfoEntry* entry = iServerNames[ i ]; |
|
1783 |
|
1784 if ( entry->iCount == 1 ) |
|
1785 { |
|
1786 buf.Copy( KSecondLineFormatStringCount1 ); |
|
1787 } |
|
1788 else |
|
1789 { |
|
1790 buf.Format( KSecondLineFormatStringCountMoreThanOne, entry->iCount ); |
|
1791 } |
|
1792 |
|
1793 AddItemL( *entry->iName, buf ); |
|
1794 } |
|
1795 } |
|
1796 |
|
1797 |
|
1798 TBool CMemSpyThreadInfoSession::CompareEntries( const CSessionInfoEntry& aLeft, const CSessionInfoEntry& aRight ) |
|
1799 { |
|
1800 return ( aLeft.iName->CompareF( *aRight.iName ) == 0 ); |
|
1801 } |
|
1802 |
|
1803 |
|
1804 |
|
1805 |
|
1806 |
|
1807 |
|
1808 |
|
1809 |
|
1810 |
|
1811 |
|
1812 |
|
1813 |
|
1814 |
|
1815 |
|
1816 |
|
1817 |
|
1818 |
|
1819 |
|
1820 |
|
1821 |
|
1822 |
|
1823 |
|
1824 |
|
1825 |
|
1826 |
|
1827 |
|
1828 CMemSpyThreadInfoSemaphore::CMemSpyThreadInfoSemaphore( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction ) |
|
1829 : CMemSpyThreadInfoHandleByContainer( aContainer, EMemSpyThreadInfoItemTypeSemaphore, EMemSpyDriverContainerTypeSemaphore, aAsyncConstruction ) |
|
1830 { |
|
1831 } |
|
1832 |
|
1833 |
|
1834 CMemSpyThreadInfoSemaphore* CMemSpyThreadInfoSemaphore::NewLC( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction ) |
|
1835 { |
|
1836 CMemSpyThreadInfoSemaphore* self = new(ELeave) CMemSpyThreadInfoSemaphore( aContainer, aAsyncConstruction ); |
|
1837 CleanupStack::PushL( self ); |
|
1838 if ( !aAsyncConstruction ) |
|
1839 { |
|
1840 self->ConstructL(); |
|
1841 } |
|
1842 return self; |
|
1843 } |
|
1844 |
|
1845 |
|
1846 EXPORT_C TPtrC CMemSpyThreadInfoSemaphore::Name() const |
|
1847 { |
|
1848 _LIT(KName, "\tSemaphores"); |
|
1849 return TPtrC( KName ); |
|
1850 } |
|
1851 |
|
1852 |
|
1853 void CMemSpyThreadInfoSemaphore::HandleContainerItemL( TMemSpyDriverHandleInfoGeneric& aItem, TInt /*aRefCount*/, TDes& aFullName ) |
|
1854 { |
|
1855 _LIT( KFormatSpec, "Count: %d" ); |
|
1856 TBuf<50> buf; |
|
1857 buf.AppendFormat( KFormatSpec, aItem.iCount ); |
|
1858 |
|
1859 AddItemL( aFullName, buf ); |
|
1860 } |
|
1861 |
|
1862 |
|
1863 |
|
1864 |
|
1865 |
|
1866 |
|
1867 |
|
1868 |
|
1869 |
|
1870 |
|
1871 |
|
1872 |
|
1873 |
|
1874 |
|
1875 |
|
1876 |
|
1877 |
|
1878 |
|
1879 |
|
1880 |
|
1881 |
|
1882 |
|
1883 |
|
1884 |
|
1885 CMemSpyThreadInfoMutex::CMemSpyThreadInfoMutex( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction ) |
|
1886 : CMemSpyThreadInfoHandleByContainer( aContainer, EMemSpyThreadInfoItemTypeMutex, EMemSpyDriverContainerTypeMutex, aAsyncConstruction ) |
|
1887 { |
|
1888 } |
|
1889 |
|
1890 |
|
1891 CMemSpyThreadInfoMutex* CMemSpyThreadInfoMutex::NewLC( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction ) |
|
1892 { |
|
1893 CMemSpyThreadInfoMutex* self = new(ELeave) CMemSpyThreadInfoMutex( aContainer, aAsyncConstruction ); |
|
1894 CleanupStack::PushL( self ); |
|
1895 if ( !aAsyncConstruction ) |
|
1896 { |
|
1897 self->ConstructL(); |
|
1898 } |
|
1899 return self; |
|
1900 } |
|
1901 |
|
1902 |
|
1903 EXPORT_C TPtrC CMemSpyThreadInfoMutex::Name() const |
|
1904 { |
|
1905 _LIT(KName, "\tMutexes"); |
|
1906 return TPtrC( KName ); |
|
1907 } |
|
1908 |
|
1909 |
|
1910 void CMemSpyThreadInfoMutex::HandleContainerItemL( TMemSpyDriverHandleInfoGeneric& aItem, TInt /*aRefCount*/, TDes& aFullName ) |
|
1911 { |
|
1912 _LIT( KFormatSpec, "Count: %d" ); |
|
1913 TBuf<50> buf; |
|
1914 buf.AppendFormat( KFormatSpec, aItem.iCount ); |
|
1915 |
|
1916 AddItemL( aFullName, buf ); |
|
1917 } |
|
1918 |
|
1919 |
|
1920 |
|
1921 |
|
1922 |
|
1923 |
|
1924 |
|
1925 |
|
1926 |
|
1927 |
|
1928 |
|
1929 |
|
1930 |
|
1931 |
|
1932 |
|
1933 |
|
1934 |
|
1935 |
|
1936 |
|
1937 |
|
1938 |
|
1939 |
|
1940 |
|
1941 |
|
1942 CMemSpyThreadInfoTimer::CMemSpyThreadInfoTimer( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction ) |
|
1943 : CMemSpyThreadInfoHandleByContainer( aContainer, EMemSpyThreadInfoItemTypeTimer, EMemSpyDriverContainerTypeTimer, aAsyncConstruction ) |
|
1944 { |
|
1945 } |
|
1946 |
|
1947 |
|
1948 CMemSpyThreadInfoTimer* CMemSpyThreadInfoTimer::NewLC( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction ) |
|
1949 { |
|
1950 CMemSpyThreadInfoTimer* self = new(ELeave) CMemSpyThreadInfoTimer( aContainer, aAsyncConstruction ); |
|
1951 CleanupStack::PushL( self ); |
|
1952 if ( !aAsyncConstruction ) |
|
1953 { |
|
1954 self->ConstructL(); |
|
1955 } |
|
1956 return self; |
|
1957 } |
|
1958 |
|
1959 |
|
1960 EXPORT_C TPtrC CMemSpyThreadInfoTimer::Name() const |
|
1961 { |
|
1962 _LIT(KName, "\tTimers"); |
|
1963 return TPtrC( KName ); |
|
1964 } |
|
1965 |
|
1966 |
|
1967 void CMemSpyThreadInfoTimer::HandleContainerItemL( TMemSpyDriverHandleInfoGeneric& aItem, TInt /*aRefCount*/, TDes& /*aFullName*/ ) |
|
1968 { |
|
1969 // Get useful strings |
|
1970 TBuf<20> state; |
|
1971 GetTimerState( aItem.iTimerState, state ); |
|
1972 TBuf<20> type; |
|
1973 GetTimerType( aItem.iTimerType, type ); |
|
1974 |
|
1975 AddItemL( type, state ); |
|
1976 } |
|
1977 |
|
1978 |
|
1979 void CMemSpyThreadInfoTimer::GetTimerState( TMemSpyDriverTimerState aState, TDes& aBuf ) |
|
1980 { |
|
1981 switch( aState ) |
|
1982 { |
|
1983 default: |
|
1984 case EMemSpyDriverTimerStateUnknown: |
|
1985 { |
|
1986 _LIT(KStateUnknown, "Unknown"); |
|
1987 aBuf.Copy( KStateUnknown ); |
|
1988 } |
|
1989 break; |
|
1990 case EMemSpyDriverTimerStateIdle: |
|
1991 { |
|
1992 _LIT(KStateIdle, "Idle"); |
|
1993 aBuf.Copy( KStateIdle ); |
|
1994 } |
|
1995 break; |
|
1996 case EMemSpyDriverTimerStateWaiting: |
|
1997 { |
|
1998 _LIT(KStateWaiting, "Waiting"); |
|
1999 aBuf.Copy( KStateWaiting ); |
|
2000 } |
|
2001 break; |
|
2002 case EMemSpyDriverTimerStateWaitHighRes: |
|
2003 { |
|
2004 _LIT(KStateWaitHighRes, "Waiting, High Res."); |
|
2005 aBuf.Copy( KStateWaitHighRes ); |
|
2006 } |
|
2007 break; |
|
2008 } |
|
2009 } |
|
2010 |
|
2011 |
|
2012 void CMemSpyThreadInfoTimer::GetTimerType( TMemSpyDriverTimerType aType, TDes& aBuf ) |
|
2013 { |
|
2014 switch( aType ) |
|
2015 { |
|
2016 case EMemSpyDriverTimerTypeRelative: |
|
2017 { |
|
2018 _LIT( KType, "Relative" ); |
|
2019 aBuf.Copy( KType ); |
|
2020 } |
|
2021 break; |
|
2022 case EMemSpyDriverTimerTypeAbsolute: |
|
2023 { |
|
2024 _LIT( KType, "Absolute" ); |
|
2025 aBuf.Copy( KType ); |
|
2026 } |
|
2027 break; |
|
2028 case EMemSpyDriverTimerTypeHighRes: |
|
2029 { |
|
2030 _LIT( KType, "High Res." ); |
|
2031 aBuf.Copy( KType ); |
|
2032 } |
|
2033 break; |
|
2034 case EMemSpyDriverTimerTypeInactivity: |
|
2035 { |
|
2036 _LIT( KType, "Inactivity" ); |
|
2037 aBuf.Copy( KType ); |
|
2038 } |
|
2039 break; |
|
2040 default: |
|
2041 { |
|
2042 _LIT( KType, "Unknown" ); |
|
2043 aBuf.Copy( KType ); |
|
2044 } |
|
2045 break; |
|
2046 } |
|
2047 } |
|
2048 |
|
2049 |
|
2050 |
|
2051 |
|
2052 |
|
2053 |
|
2054 |
|
2055 |
|
2056 |
|
2057 |
|
2058 |
|
2059 |
|
2060 |
|
2061 |
|
2062 |
|
2063 |
|
2064 |
|
2065 |
|
2066 |
|
2067 CMemSpyThreadInfoLDD::CMemSpyThreadInfoLDD( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction ) |
|
2068 : CMemSpyThreadInfoHandleByContainer( aContainer, EMemSpyThreadInfoItemTypeLDD, EMemSpyDriverContainerTypeLogicalDevice, aAsyncConstruction ) |
|
2069 { |
|
2070 } |
|
2071 |
|
2072 |
|
2073 CMemSpyThreadInfoLDD* CMemSpyThreadInfoLDD::NewLC( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction ) |
|
2074 { |
|
2075 CMemSpyThreadInfoLDD* self = new(ELeave) CMemSpyThreadInfoLDD( aContainer, aAsyncConstruction ); |
|
2076 CleanupStack::PushL( self ); |
|
2077 if ( !aAsyncConstruction ) |
|
2078 { |
|
2079 self->ConstructL(); |
|
2080 } |
|
2081 return self; |
|
2082 } |
|
2083 |
|
2084 |
|
2085 EXPORT_C TPtrC CMemSpyThreadInfoLDD::Name() const |
|
2086 { |
|
2087 _LIT(KName, "\tLogical Device Drivers"); |
|
2088 return TPtrC( KName ); |
|
2089 } |
|
2090 |
|
2091 |
|
2092 void CMemSpyThreadInfoLDD::HandleContainerItemL( TMemSpyDriverHandleInfoGeneric& aItem, TInt /*aRefCount*/, TDes& aFullName ) |
|
2093 { |
|
2094 _LIT( KFormatSpec, "Open channels: %d" ); |
|
2095 TBuf<50> buf; |
|
2096 buf.AppendFormat( KFormatSpec, aItem.iOpenChannels ); |
|
2097 |
|
2098 AddItemL( aFullName, buf ); |
|
2099 } |
|
2100 |
|
2101 |
|
2102 |
|
2103 |
|
2104 |
|
2105 |
|
2106 |
|
2107 |
|
2108 |
|
2109 |
|
2110 |
|
2111 |
|
2112 |
|
2113 |
|
2114 |
|
2115 |
|
2116 |
|
2117 |
|
2118 |
|
2119 |
|
2120 |
|
2121 |
|
2122 |
|
2123 |
|
2124 |
|
2125 CMemSpyThreadInfoPDD::CMemSpyThreadInfoPDD( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction ) |
|
2126 : CMemSpyThreadInfoHandleByContainer( aContainer, EMemSpyThreadInfoItemTypePDD, EMemSpyDriverContainerTypePhysicalDevice, aAsyncConstruction ) |
|
2127 { |
|
2128 } |
|
2129 |
|
2130 |
|
2131 CMemSpyThreadInfoPDD* CMemSpyThreadInfoPDD::NewLC( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction ) |
|
2132 { |
|
2133 CMemSpyThreadInfoPDD* self = new(ELeave) CMemSpyThreadInfoPDD( aContainer, aAsyncConstruction ); |
|
2134 CleanupStack::PushL( self ); |
|
2135 if ( !aAsyncConstruction ) |
|
2136 { |
|
2137 self->ConstructL(); |
|
2138 } |
|
2139 return self; |
|
2140 } |
|
2141 |
|
2142 |
|
2143 EXPORT_C TPtrC CMemSpyThreadInfoPDD::Name() const |
|
2144 { |
|
2145 _LIT(KName, "\tPhysical Device Drivers"); |
|
2146 return TPtrC( KName ); |
|
2147 } |
|
2148 |
|
2149 |
|
2150 void CMemSpyThreadInfoPDD::HandleContainerItemL( TMemSpyDriverHandleInfoGeneric& /*aItem*/, TInt /*aRefCount*/, TDes& aFullName ) |
|
2151 { |
|
2152 AddItemL( aFullName, KNullDesC ); |
|
2153 } |
|
2154 |
|
2155 |
|
2156 |
|
2157 |
|
2158 |
|
2159 |
|
2160 |
|
2161 |
|
2162 |
|
2163 |
|
2164 |
|
2165 |
|
2166 |
|
2167 |
|
2168 |
|
2169 |
|
2170 |
|
2171 |
|
2172 |
|
2173 |
|
2174 |
|
2175 |
|
2176 CMemSpyThreadInfoLogicalChannel::CMemSpyThreadInfoLogicalChannel( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction ) |
|
2177 : CMemSpyThreadInfoHandleByContainer( aContainer, EMemSpyThreadInfoItemTypeLogicalChannel, EMemSpyDriverContainerTypeLogicalChannel, aAsyncConstruction ) |
|
2178 { |
|
2179 } |
|
2180 |
|
2181 |
|
2182 CMemSpyThreadInfoLogicalChannel* CMemSpyThreadInfoLogicalChannel::NewLC( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction ) |
|
2183 { |
|
2184 CMemSpyThreadInfoLogicalChannel* self = new(ELeave) CMemSpyThreadInfoLogicalChannel( aContainer, aAsyncConstruction ); |
|
2185 CleanupStack::PushL( self ); |
|
2186 if ( !aAsyncConstruction ) |
|
2187 { |
|
2188 self->ConstructL(); |
|
2189 } |
|
2190 return self; |
|
2191 } |
|
2192 |
|
2193 |
|
2194 EXPORT_C TPtrC CMemSpyThreadInfoLogicalChannel::Name() const |
|
2195 { |
|
2196 _LIT(KName, "\tLogical DD Channels"); |
|
2197 return TPtrC( KName ); |
|
2198 } |
|
2199 |
|
2200 |
|
2201 void CMemSpyThreadInfoLogicalChannel::HandleContainerItemL( TMemSpyDriverHandleInfoGeneric& /*aItem*/, TInt /*aRefCount*/, TDes& aFullName ) |
|
2202 { |
|
2203 AddItemL( aFullName, KNullDesC ); |
|
2204 } |
|
2205 |
|
2206 |
|
2207 |
|
2208 |
|
2209 |
|
2210 |
|
2211 |
|
2212 |
|
2213 |
|
2214 |
|
2215 |
|
2216 |
|
2217 |
|
2218 |
|
2219 |
|
2220 |
|
2221 |
|
2222 |
|
2223 |
|
2224 |
|
2225 |
|
2226 CMemSpyThreadInfoChangeNotifier::CMemSpyThreadInfoChangeNotifier( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction ) |
|
2227 : CMemSpyThreadInfoHandleByContainer( aContainer, EMemSpyThreadInfoItemTypeChangeNotifier, EMemSpyDriverContainerTypeChangeNotifier, aAsyncConstruction ) |
|
2228 { |
|
2229 } |
|
2230 |
|
2231 |
|
2232 CMemSpyThreadInfoChangeNotifier* CMemSpyThreadInfoChangeNotifier::NewLC( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction ) |
|
2233 { |
|
2234 CMemSpyThreadInfoChangeNotifier* self = new(ELeave) CMemSpyThreadInfoChangeNotifier( aContainer, aAsyncConstruction ); |
|
2235 CleanupStack::PushL( self ); |
|
2236 if ( !aAsyncConstruction ) |
|
2237 { |
|
2238 self->ConstructL(); |
|
2239 } |
|
2240 return self; |
|
2241 } |
|
2242 |
|
2243 |
|
2244 EXPORT_C TPtrC CMemSpyThreadInfoChangeNotifier::Name() const |
|
2245 { |
|
2246 _LIT(KName, "\tChange Notifiers"); |
|
2247 return TPtrC( KName ); |
|
2248 } |
|
2249 |
|
2250 |
|
2251 void CMemSpyThreadInfoChangeNotifier::HandleContainerItemL( TMemSpyDriverHandleInfoGeneric& /*aItem*/, TInt /*aRefCount*/, TDes& aFullName ) |
|
2252 { |
|
2253 AddItemL( aFullName, KNullDesC ); |
|
2254 } |
|
2255 |
|
2256 |
|
2257 |
|
2258 |
|
2259 |
|
2260 |
|
2261 |
|
2262 |
|
2263 |
|
2264 |
|
2265 |
|
2266 |
|
2267 |
|
2268 |
|
2269 |
|
2270 |
|
2271 |
|
2272 |
|
2273 |
|
2274 |
|
2275 |
|
2276 CMemSpyThreadInfoUndertaker::CMemSpyThreadInfoUndertaker( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction ) |
|
2277 : CMemSpyThreadInfoHandleByContainer( aContainer, EMemSpyThreadInfoItemTypeUndertaker, EMemSpyDriverContainerTypeUndertaker, aAsyncConstruction ) |
|
2278 { |
|
2279 } |
|
2280 |
|
2281 |
|
2282 CMemSpyThreadInfoUndertaker* CMemSpyThreadInfoUndertaker::NewLC( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction ) |
|
2283 { |
|
2284 CMemSpyThreadInfoUndertaker* self = new(ELeave) CMemSpyThreadInfoUndertaker( aContainer, aAsyncConstruction ); |
|
2285 CleanupStack::PushL( self ); |
|
2286 if ( !aAsyncConstruction ) |
|
2287 { |
|
2288 self->ConstructL(); |
|
2289 } |
|
2290 return self; |
|
2291 } |
|
2292 |
|
2293 |
|
2294 EXPORT_C TPtrC CMemSpyThreadInfoUndertaker::Name() const |
|
2295 { |
|
2296 _LIT(KName, "\tUndertakers"); |
|
2297 return TPtrC( KName ); |
|
2298 } |
|
2299 |
|
2300 |
|
2301 void CMemSpyThreadInfoUndertaker::HandleContainerItemL( TMemSpyDriverHandleInfoGeneric& /*aItem*/, TInt /*aRefCount*/, TDes& aFullName ) |
|
2302 { |
|
2303 AddItemL( aFullName, KNullDesC ); |
|
2304 } |
|
2305 |
|
2306 |
|
2307 |
|
2308 |
|
2309 |
|
2310 |
|
2311 |
|
2312 |
|
2313 |
|
2314 |
|
2315 |
|
2316 |
|
2317 |
|
2318 |
|
2319 |
|
2320 |
|
2321 |
|
2322 CMemSpyThreadInfoOwnedThreadHandles::CMemSpyThreadInfoOwnedThreadHandles( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction ) |
|
2323 : CMemSpyThreadInfoHandleByContainer( aContainer, EMemSpyThreadInfoItemTypeOwnedThreadHandles, EMemSpyDriverContainerTypeThread, aAsyncConstruction ) |
|
2324 { |
|
2325 } |
|
2326 |
|
2327 |
|
2328 CMemSpyThreadInfoOwnedThreadHandles* CMemSpyThreadInfoOwnedThreadHandles::NewLC( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction ) |
|
2329 { |
|
2330 CMemSpyThreadInfoOwnedThreadHandles* self = new(ELeave) CMemSpyThreadInfoOwnedThreadHandles( aContainer, aAsyncConstruction ); |
|
2331 CleanupStack::PushL( self ); |
|
2332 if ( !aAsyncConstruction ) |
|
2333 { |
|
2334 self->ConstructL(); |
|
2335 } |
|
2336 return self; |
|
2337 } |
|
2338 |
|
2339 |
|
2340 EXPORT_C TPtrC CMemSpyThreadInfoOwnedThreadHandles::Name() const |
|
2341 { |
|
2342 _LIT(KName, "\tHandles to other\nThreads"); |
|
2343 return TPtrC( KName ); |
|
2344 } |
|
2345 |
|
2346 |
|
2347 void CMemSpyThreadInfoOwnedThreadHandles::HandleContainerItemL( TMemSpyDriverHandleInfoGeneric& aItem, TInt aRefCount, TDes& aFullName ) |
|
2348 { |
|
2349 const TInt bracketPosStart = aFullName.LocateF( TChar('[') ); |
|
2350 const TInt doubleColonPos = aFullName.FindF( _L("::" ) ); |
|
2351 // |
|
2352 if ( bracketPosStart >= 0 && doubleColonPos > bracketPosStart && doubleColonPos < aFullName.Length() - 2 ) |
|
2353 { |
|
2354 // Process |
|
2355 TPtrC pProcessName( aFullName.Left( bracketPosStart ) ); |
|
2356 HBufC* caption = HBufC::NewLC( KMaxName + 10 ); |
|
2357 TPtr pCaption( caption->Des() ); |
|
2358 pCaption.AppendFormat( _L("[%2d] %S"), aRefCount, &pProcessName ); |
|
2359 |
|
2360 // Thread id & thread name |
|
2361 TPtrC pThreadName( aFullName.Mid( doubleColonPos + 2 ) ); |
|
2362 HBufC* value = HBufC::NewLC( KMaxName + 10 ); |
|
2363 TPtr pValue( value->Des() ); |
|
2364 pValue.AppendFormat( _L("[%3d] %S"), aItem.iId, &pThreadName ); |
|
2365 |
|
2366 // Add it & tidy up |
|
2367 AddItemL( pCaption, pValue ); |
|
2368 CleanupStack::PopAndDestroy( 2, caption ); |
|
2369 } |
|
2370 else |
|
2371 { |
|
2372 AddItemL( aFullName, KNullDesC ); |
|
2373 } |
|
2374 } |
|
2375 |
|
2376 |
|
2377 |
|
2378 |
|
2379 |
|
2380 |
|
2381 |
|
2382 |
|
2383 |
|
2384 CMemSpyThreadInfoOwnedProcessHandles::CMemSpyThreadInfoOwnedProcessHandles( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction ) |
|
2385 : CMemSpyThreadInfoHandleByContainer( aContainer, EMemSpyThreadInfoItemTypeOwnedProcessHandles, EMemSpyDriverContainerTypeProcess, aAsyncConstruction ) |
|
2386 { |
|
2387 } |
|
2388 |
|
2389 |
|
2390 CMemSpyThreadInfoOwnedProcessHandles* CMemSpyThreadInfoOwnedProcessHandles::NewLC( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction ) |
|
2391 { |
|
2392 CMemSpyThreadInfoOwnedProcessHandles* self = new(ELeave) CMemSpyThreadInfoOwnedProcessHandles( aContainer, aAsyncConstruction ); |
|
2393 CleanupStack::PushL( self ); |
|
2394 if ( !aAsyncConstruction ) |
|
2395 { |
|
2396 self->ConstructL(); |
|
2397 } |
|
2398 return self; |
|
2399 } |
|
2400 |
|
2401 |
|
2402 EXPORT_C TPtrC CMemSpyThreadInfoOwnedProcessHandles::Name() const |
|
2403 { |
|
2404 _LIT(KName, "\tHandles to other\nProcesses"); |
|
2405 return TPtrC( KName ); |
|
2406 } |
|
2407 |
|
2408 |
|
2409 void CMemSpyThreadInfoOwnedProcessHandles::HandleContainerItemL( TMemSpyDriverHandleInfoGeneric& aItem, TInt aRefCount, TDes& aFullName ) |
|
2410 { |
|
2411 const TInt bracketPosStart = aFullName.LocateF( TChar('[') ); |
|
2412 const TInt doubleColonPos = aFullName.FindF( _L("::" ) ); |
|
2413 // |
|
2414 if ( bracketPosStart >= 0 && doubleColonPos > bracketPosStart && doubleColonPos < aFullName.Length() - 2 ) |
|
2415 { |
|
2416 // Process |
|
2417 TPtrC pProcessName( aFullName.Left( bracketPosStart ) ); |
|
2418 HBufC* caption = HBufC::NewLC( KMaxName + 10 ); |
|
2419 TPtr pCaption( caption->Des() ); |
|
2420 pCaption.AppendFormat( _L("[%2d] %S"), aRefCount, &pProcessName ); |
|
2421 |
|
2422 // Thread id & thread name |
|
2423 TPtrC pThreadName( aFullName.Mid( doubleColonPos + 2 ) ); |
|
2424 HBufC* value = HBufC::NewLC( KMaxName + 10 ); |
|
2425 TPtr pValue( value->Des() ); |
|
2426 pValue.AppendFormat( _L("[%3d] %S"), aItem.iId, &pThreadName ); |
|
2427 |
|
2428 // Add it & tidy up |
|
2429 AddItemL( pCaption, pValue ); |
|
2430 CleanupStack::PopAndDestroy( 2, caption ); |
|
2431 } |
|
2432 else |
|
2433 { |
|
2434 AddItemL( aFullName, KNullDesC ); |
|
2435 } |
|
2436 } |
|
2437 |
|
2438 |
|
2439 |
|
2440 |
|
2441 |
|
2442 |
|
2443 |
|
2444 |
|
2445 |
|
2446 |
|
2447 |
|
2448 |
|
2449 |
|
2450 |
|
2451 |
|
2452 |
|
2453 |
|
2454 |
|
2455 |
|
2456 |
|
2457 |
|
2458 |
|
2459 |
|
2460 |
|
2461 |
|
2462 |
|
2463 |
|
2464 |
|
2465 |
|
2466 |
|
2467 |
|
2468 |
|
2469 |
|
2470 |
|
2471 |
|
2472 |
|
2473 |
|
2474 |
|
2475 |
|
2476 |
|
2477 CMemSpyThreadInfoReferencedBy::CMemSpyThreadInfoReferencedBy( CMemSpyThreadInfoContainer& aContainer, TMemSpyThreadInfoItemType aItemType, TMemSpyDriverContainerType aContainerType, TBool aAsyncConstruction ) |
|
2478 : CMemSpyThreadInfoHandleObjectBase( aContainer, aItemType, aContainerType, aAsyncConstruction ) |
|
2479 { |
|
2480 } |
|
2481 |
|
2482 |
|
2483 void CMemSpyThreadInfoReferencedBy::GetHandlesL( RArray<THandleWrapper>& aArray ) |
|
2484 { |
|
2485 aArray.Reset(); |
|
2486 // |
|
2487 TInt r = KErrNone; |
|
2488 // |
|
2489 CMemSpyProcess& process = Container().Thread().Process(); |
|
2490 CMemSpyEngine& engine = process.Engine(); |
|
2491 TIdentityRelation<CMemSpyThreadInfoHandleObjectBase::THandleWrapper> finder( THandleWrapper::Match ); |
|
2492 |
|
2493 // We need to either search through: |
|
2494 // |
|
2495 // a) all thread & process handles looking for *this thread*, or |
|
2496 // b) all thread & process handles looking for *this process* |
|
2497 // |
|
2498 // We abuse the "container type" as a means of deciding whether it is |
|
2499 // the thread or the process we are looking for. |
|
2500 // |
|
2501 RMemSpyDriverClient& driver = engine.Driver(); |
|
2502 if ( ContainerType() == EMemSpyDriverContainerTypeProcess ) |
|
2503 { |
|
2504 const TUint id = Container().Thread().Process().Id(); |
|
2505 r = driver.GetReferencesToMyProcess( id ); |
|
2506 } |
|
2507 else if ( ContainerType() == EMemSpyDriverContainerTypeThread ) |
|
2508 { |
|
2509 const TUint id = Container().Thread().Id(); |
|
2510 r = driver.GetReferencesToMyThread( id ); |
|
2511 } |
|
2512 else |
|
2513 { |
|
2514 ASSERT( EFalse ); |
|
2515 } |
|
2516 User::LeaveIfError( r ); |
|
2517 |
|
2518 RMemSpyMemStreamReader stream = driver.StreamOpenL(); |
|
2519 CleanupClosePushL( stream ); |
|
2520 |
|
2521 // Extract thread matches |
|
2522 const TInt threadCount = stream.ReadInt32L(); |
|
2523 for( TInt i=0; i<threadCount; i++ ) |
|
2524 { |
|
2525 TAny* handle = (TAny*) stream.ReadUint32L(); |
|
2526 |
|
2527 // Create temporary entry that we'll use as the key in our array... |
|
2528 CMemSpyThreadInfoHandleObjectBase::THandleWrapper entry( handle, EMemSpyDriverContainerTypeThread ); |
|
2529 |
|
2530 // Find existing duplicate entry (if there is one...) |
|
2531 const TInt errorOrIndex = aArray.Find( entry, finder ); |
|
2532 |
|
2533 if ( errorOrIndex == KErrNotFound ) |
|
2534 { |
|
2535 // Not a duplicate handle, so keep it |
|
2536 aArray.AppendL( entry ); |
|
2537 } |
|
2538 else if ( errorOrIndex >= 0 ) |
|
2539 { |
|
2540 // Increment reference count for duplicates... |
|
2541 CMemSpyThreadInfoHandleObjectBase::THandleWrapper& existingEntry = aArray[ errorOrIndex ]; |
|
2542 ++existingEntry.iRefCount; |
|
2543 } |
|
2544 } |
|
2545 |
|
2546 // Extract process matches |
|
2547 const TInt processCount = stream.ReadInt32L(); |
|
2548 for( TInt i=0; i<processCount; i++ ) |
|
2549 { |
|
2550 TAny* handle = (TAny*) stream.ReadUint32L(); |
|
2551 |
|
2552 // Create temporary entry that we'll use as the key in our array... |
|
2553 CMemSpyThreadInfoHandleObjectBase::THandleWrapper entry( handle, EMemSpyDriverContainerTypeProcess ); |
|
2554 |
|
2555 // Find existing duplicate entry (if there is one...) |
|
2556 const TInt errorOrIndex = aArray.Find( entry, finder ); |
|
2557 |
|
2558 if ( errorOrIndex == KErrNotFound ) |
|
2559 { |
|
2560 // Not a duplicate handle, so keep it |
|
2561 aArray.AppendL( entry ); |
|
2562 } |
|
2563 else if ( errorOrIndex >= 0 ) |
|
2564 { |
|
2565 // Increment reference count for duplicates... |
|
2566 CMemSpyThreadInfoHandleObjectBase::THandleWrapper& existingEntry = aArray[ errorOrIndex ]; |
|
2567 ++existingEntry.iRefCount; |
|
2568 } |
|
2569 } |
|
2570 |
|
2571 // Tidy up |
|
2572 CleanupStack::PopAndDestroy( &stream ); |
|
2573 } |
|
2574 |
|
2575 |
|
2576 |
|
2577 |
|
2578 |
|
2579 |
|
2580 |
|
2581 |
|
2582 |
|
2583 |
|
2584 |
|
2585 |
|
2586 |
|
2587 |
|
2588 |
|
2589 |
|
2590 |
|
2591 |
|
2592 |
|
2593 |
|
2594 CMemSpyThreadInfoOtherThreads::CMemSpyThreadInfoOtherThreads( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction ) |
|
2595 : CMemSpyThreadInfoReferencedBy( aContainer, EMemSpyThreadInfoItemTypeOtherThreads, EMemSpyDriverContainerTypeThread, aAsyncConstruction ) |
|
2596 { |
|
2597 } |
|
2598 |
|
2599 |
|
2600 CMemSpyThreadInfoOtherThreads* CMemSpyThreadInfoOtherThreads::NewLC( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction ) |
|
2601 { |
|
2602 CMemSpyThreadInfoOtherThreads* self = new(ELeave) CMemSpyThreadInfoOtherThreads( aContainer, aAsyncConstruction ); |
|
2603 CleanupStack::PushL( self ); |
|
2604 if ( !aAsyncConstruction ) |
|
2605 { |
|
2606 self->ConstructL(); |
|
2607 } |
|
2608 return self; |
|
2609 } |
|
2610 |
|
2611 |
|
2612 EXPORT_C TPtrC CMemSpyThreadInfoOtherThreads::Name() const |
|
2613 { |
|
2614 _LIT(KName, "\tReferences this Thread"); |
|
2615 return TPtrC( KName ); |
|
2616 } |
|
2617 |
|
2618 |
|
2619 void CMemSpyThreadInfoOtherThreads::HandleContainerItemL( TMemSpyDriverHandleInfoGeneric& /*aItem*/, TInt /*aRefCount*/, TDes& aFullName ) |
|
2620 { |
|
2621 AddItemL( aFullName, KNullDesC ); |
|
2622 } |
|
2623 |
|
2624 |
|
2625 |
|
2626 |
|
2627 |
|
2628 |
|
2629 |
|
2630 |
|
2631 |
|
2632 |
|
2633 |
|
2634 |
|
2635 |
|
2636 |
|
2637 |
|
2638 |
|
2639 |
|
2640 |
|
2641 |
|
2642 |
|
2643 CMemSpyThreadInfoOtherProcesses::CMemSpyThreadInfoOtherProcesses( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction ) |
|
2644 : CMemSpyThreadInfoReferencedBy( aContainer, EMemSpyThreadInfoItemTypeOtherProcesses, EMemSpyDriverContainerTypeProcess, aAsyncConstruction ) |
|
2645 { |
|
2646 } |
|
2647 |
|
2648 |
|
2649 CMemSpyThreadInfoOtherProcesses* CMemSpyThreadInfoOtherProcesses::NewLC( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction ) |
|
2650 { |
|
2651 CMemSpyThreadInfoOtherProcesses* self = new(ELeave) CMemSpyThreadInfoOtherProcesses( aContainer, aAsyncConstruction ); |
|
2652 CleanupStack::PushL( self ); |
|
2653 if ( !aAsyncConstruction ) |
|
2654 { |
|
2655 self->ConstructL(); |
|
2656 } |
|
2657 return self; |
|
2658 } |
|
2659 |
|
2660 |
|
2661 EXPORT_C TPtrC CMemSpyThreadInfoOtherProcesses::Name() const |
|
2662 { |
|
2663 _LIT(KName, "\tReferences this Process"); |
|
2664 return TPtrC( KName ); |
|
2665 } |
|
2666 |
|
2667 |
|
2668 void CMemSpyThreadInfoOtherProcesses::HandleContainerItemL( TMemSpyDriverHandleInfoGeneric& /*aItem*/, TInt /*aRefCount*/, TDes& aFullName ) |
|
2669 { |
|
2670 AddItemL( aFullName, KNullDesC ); |
|
2671 } |
|
2672 |
|
2673 |
|
2674 |
|
2675 |
|
2676 |
|
2677 |
|
2678 |
|
2679 |
|
2680 |
|
2681 |
|
2682 |
|
2683 |
|
2684 |
|
2685 |
|
2686 |
|
2687 |
|
2688 |
|
2689 CMemSpyThreadInfoMemoryTracking::CMemSpyThreadInfoMemoryTracking( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction ) |
|
2690 : CMemSpyThreadInfoItemBase( aContainer, EMemSpyThreadInfoItemTypeMemoryTracking, aAsyncConstruction ), iTotalIncludesSharedMemory( ETrue ) |
|
2691 { |
|
2692 } |
|
2693 |
|
2694 |
|
2695 CMemSpyThreadInfoMemoryTracking::~CMemSpyThreadInfoMemoryTracking() |
|
2696 { |
|
2697 #ifdef _DEBUG |
|
2698 RDebug::Printf( "CMemSpyThreadInfoMemoryTracking::~CMemSpyThreadInfoMemoryTracking() - START - this: 0x%08x, iTracker: 0x%08x", this, iTracker ); |
|
2699 #endif |
|
2700 // |
|
2701 TrackingObserverRemove( *this ); |
|
2702 // |
|
2703 delete iInfoHWM; |
|
2704 delete iInfoPeak; |
|
2705 delete iInfoCurrent; |
|
2706 // |
|
2707 #ifdef _DEBUG |
|
2708 RDebug::Printf( "CMemSpyThreadInfoMemoryTracking::~CMemSpyThreadInfoMemoryTracking() - END - this: 0x%08x, iTracker: 0x%08x", this, iTracker ); |
|
2709 #endif |
|
2710 } |
|
2711 |
|
2712 |
|
2713 void CMemSpyThreadInfoMemoryTracking::ConstructL() |
|
2714 { |
|
2715 #ifdef _DEBUG |
|
2716 RDebug::Printf( "CMemSpyThreadInfoMemoryTracking::ConstructL() - START - this: 0x%08x, iTracker: 0x%08x", this, iTracker ); |
|
2717 #endif |
|
2718 CMemSpyEngine& engine = Container().Thread().Process().Engine(); |
|
2719 // |
|
2720 const TProcessId pid = Container().Thread().Process().Id(); |
|
2721 iTracker = engine.HelperProcess().TrackerOrNull( pid ); |
|
2722 |
|
2723 #ifdef _DEBUG |
|
2724 RDebug::Printf( "CMemSpyThreadInfoMemoryTracking::ConstructL() - requesting observer add... - this: 0x%08x, iTracker: 0x%08x", this, iTracker ); |
|
2725 #endif |
|
2726 TrackingObserverAddL( *this ); |
|
2727 // |
|
2728 #ifdef _DEBUG |
|
2729 RDebug::Printf( "CMemSpyThreadInfoMemoryTracking::ConstructL() - preparing info item... - this: 0x%08x, iTracker: 0x%08x", this, iTracker ); |
|
2730 #endif |
|
2731 if ( iTracker ) |
|
2732 { |
|
2733 delete iInfoCurrent; |
|
2734 iInfoCurrent = NULL; |
|
2735 iInfoCurrent = CMemSpyThreadInfoMemoryTrackingStatisticsCurrent::NewLC( Container(), EFalse ); |
|
2736 CleanupStack::Pop( iInfoCurrent ); |
|
2737 // |
|
2738 delete iInfoHWM; |
|
2739 iInfoHWM = NULL; |
|
2740 iInfoHWM = CMemSpyThreadInfoMemoryTrackingStatisticsHWM::NewLC( Container(), EFalse ); |
|
2741 CleanupStack::Pop( iInfoHWM ); |
|
2742 // |
|
2743 delete iInfoPeak; |
|
2744 iInfoPeak = NULL; |
|
2745 iInfoPeak = CMemSpyThreadInfoMemoryTrackingStatisticsPeak::NewLC( Container(), EFalse ); |
|
2746 CleanupStack::Pop( iInfoPeak ); |
|
2747 } |
|
2748 |
|
2749 #ifdef _DEBUG |
|
2750 RDebug::Printf( "CMemSpyThreadInfoMemoryTracking::ConstructL() - prepared info items - this: 0x%08x, iTracker: 0x%08x", this, iTracker ); |
|
2751 #endif |
|
2752 |
|
2753 // Prepare items |
|
2754 _LIT( KItem0, "Tracking" ); |
|
2755 AddItemOnOffL( KItem0, ( iTracker ) ? iTracker->AmTracking() : EFalse ); |
|
2756 |
|
2757 TInt64 valCurrent( 0 ); |
|
2758 if ( iTracker ) |
|
2759 { |
|
2760 if ( TotalIncludesSharedMemory() ) |
|
2761 { |
|
2762 valCurrent = iTracker->InfoCurrent().TotalIncShared(); |
|
2763 } |
|
2764 else |
|
2765 { |
|
2766 valCurrent = iTracker->InfoCurrent().TotalExcShared(); |
|
2767 } |
|
2768 } |
|
2769 _LIT( KItem1, "Total [Current]" ); |
|
2770 AddItemLongL( KItem1, valCurrent ); |
|
2771 |
|
2772 TInt64 valHWM( 0 ); |
|
2773 if ( iTracker ) |
|
2774 { |
|
2775 if ( TotalIncludesSharedMemory() ) |
|
2776 { |
|
2777 valHWM = iTracker->InfoHWMIncShared().TotalIncShared(); |
|
2778 } |
|
2779 else |
|
2780 { |
|
2781 valHWM = iTracker->InfoHWMExcShared().TotalExcShared(); |
|
2782 } |
|
2783 } |
|
2784 _LIT( KItem2, "Total [HWM]" ); |
|
2785 AddItemLongL( KItem2, valHWM ); |
|
2786 |
|
2787 TInt64 valPeak( 0 ); |
|
2788 if ( iTracker ) |
|
2789 { |
|
2790 if ( TotalIncludesSharedMemory() ) |
|
2791 { |
|
2792 valPeak = iTracker->InfoPeaks().TotalIncShared(); |
|
2793 } |
|
2794 else |
|
2795 { |
|
2796 valPeak = iTracker->InfoPeaks().TotalExcShared(); |
|
2797 } |
|
2798 } |
|
2799 _LIT( KItem3, "Total [Peaks]" ); |
|
2800 AddItemLongL( KItem3, valPeak ); |
|
2801 |
|
2802 // |
|
2803 Container().NotifyObserverL( MMemSpyThreadInfoContainerObserver::EInfoItemChanged, Type() ); |
|
2804 #ifdef _DEBUG |
|
2805 RDebug::Printf( "CMemSpyThreadInfoMemoryTracking::ConstructL() - END - this: 0x%08x", this ); |
|
2806 #endif |
|
2807 } |
|
2808 |
|
2809 |
|
2810 CMemSpyThreadInfoMemoryTracking* CMemSpyThreadInfoMemoryTracking::NewLC( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction ) |
|
2811 { |
|
2812 CMemSpyThreadInfoMemoryTracking* self = new(ELeave) CMemSpyThreadInfoMemoryTracking( aContainer, aAsyncConstruction ); |
|
2813 CleanupStack::PushL( self ); |
|
2814 if ( !aAsyncConstruction ) |
|
2815 { |
|
2816 self->ConstructL(); |
|
2817 } |
|
2818 return self; |
|
2819 } |
|
2820 |
|
2821 |
|
2822 EXPORT_C TPtrC CMemSpyThreadInfoMemoryTracking::Name() const |
|
2823 { |
|
2824 _LIT(KName, "\tMemory Tracking"); |
|
2825 return TPtrC( KName ); |
|
2826 } |
|
2827 |
|
2828 |
|
2829 EXPORT_C TBool CMemSpyThreadInfoMemoryTracking::TrackingActive() const |
|
2830 { |
|
2831 return ( iTracker != NULL ? iTracker->AmTracking() : EFalse ); |
|
2832 } |
|
2833 |
|
2834 |
|
2835 EXPORT_C TBool CMemSpyThreadInfoMemoryTracking::TotalIncludesSharedMemory() const |
|
2836 { |
|
2837 return iTotalIncludesSharedMemory; |
|
2838 } |
|
2839 |
|
2840 |
|
2841 EXPORT_C void CMemSpyThreadInfoMemoryTracking::TrackingSetTotalIncludesSharedMemoryL( TBool aIncludesSharedMemory ) |
|
2842 { |
|
2843 iTotalIncludesSharedMemory = aIncludesSharedMemory; |
|
2844 |
|
2845 if ( iTracker ) |
|
2846 { |
|
2847 iInfoCurrent->SetTotalIncludesSharedMemoryL( aIncludesSharedMemory ); |
|
2848 iInfoHWM->SetTotalIncludesSharedMemoryL( aIncludesSharedMemory ); |
|
2849 iInfoPeak->SetTotalIncludesSharedMemoryL( aIncludesSharedMemory ); |
|
2850 |
|
2851 // Update totals |
|
2852 TRAP_IGNORE( UpdateCaptionsL( iTracker->InfoCurrent(), iTracker->InfoHWMIncShared(), iTracker->InfoHWMExcShared() ) ); |
|
2853 } |
|
2854 } |
|
2855 |
|
2856 |
|
2857 EXPORT_C void CMemSpyThreadInfoMemoryTracking::TrackingStartL() |
|
2858 { |
|
2859 if ( iTracker == NULL ) |
|
2860 { |
|
2861 CMemSpyProcess& process = Container().Thread().Process(); |
|
2862 CMemSpyEngine& engine = process.Engine(); |
|
2863 iTracker = &engine.HelperProcess().TrackerL( process ); |
|
2864 |
|
2865 // Make sure we are also listening to the tracker! |
|
2866 TrackingObserverAddL( *this ); |
|
2867 // |
|
2868 CMemSpyThreadInfoMemoryTrackingStatisticsCurrent* infoCurrent = CMemSpyThreadInfoMemoryTrackingStatisticsCurrent::NewLC( Container(), EFalse ); |
|
2869 CMemSpyThreadInfoMemoryTrackingStatisticsHWM* infoHWM = CMemSpyThreadInfoMemoryTrackingStatisticsHWM::NewLC( Container(), EFalse ); |
|
2870 CMemSpyThreadInfoMemoryTrackingStatisticsPeak* infoPeak = CMemSpyThreadInfoMemoryTrackingStatisticsPeak::NewLC( Container(), EFalse ); |
|
2871 // |
|
2872 iInfoCurrent = infoCurrent; |
|
2873 iInfoHWM = infoHWM; |
|
2874 iInfoPeak = infoPeak; |
|
2875 // |
|
2876 CleanupStack::Pop( iInfoPeak ); |
|
2877 CleanupStack::Pop( infoHWM ); |
|
2878 CleanupStack::Pop( infoCurrent ); |
|
2879 // |
|
2880 TrackingSetTotalIncludesSharedMemoryL( iTotalIncludesSharedMemory ); |
|
2881 } |
|
2882 |
|
2883 iTracker->StartL(); |
|
2884 |
|
2885 UpdateCaptionsL(); |
|
2886 } |
|
2887 |
|
2888 |
|
2889 EXPORT_C void CMemSpyThreadInfoMemoryTracking::TrackingStopL() |
|
2890 { |
|
2891 if ( iTracker != NULL ) |
|
2892 { |
|
2893 iTracker->Stop(); |
|
2894 } |
|
2895 |
|
2896 UpdateCaptionsL(); |
|
2897 } |
|
2898 |
|
2899 |
|
2900 EXPORT_C void CMemSpyThreadInfoMemoryTracking::TrackingResetHWML() |
|
2901 { |
|
2902 if ( iTracker != NULL ) |
|
2903 { |
|
2904 iTracker->ResetHWML(); |
|
2905 } |
|
2906 } |
|
2907 |
|
2908 |
|
2909 EXPORT_C void CMemSpyThreadInfoMemoryTracking::TrackingObserverAddL( MMemSpyEngineProcessMemoryTrackerObserver& aObserver ) |
|
2910 { |
|
2911 #ifdef _DEBUG |
|
2912 RDebug::Printf( "CMemSpyThreadInfoMemoryTracking::TrackingObserverAddL() - START - iTracker: 0x%08x, this: 0x%08x", iTracker, this ); |
|
2913 #endif |
|
2914 |
|
2915 if ( iTracker != NULL ) |
|
2916 { |
|
2917 iTracker->AddObserverL( aObserver ); |
|
2918 } |
|
2919 |
|
2920 #ifdef _DEBUG |
|
2921 RDebug::Printf( "CMemSpyThreadInfoMemoryTracking::TrackingObserverAddL() - END - iTracker: 0x%08x, this: 0x%08x", iTracker, this ); |
|
2922 #endif |
|
2923 } |
|
2924 |
|
2925 |
|
2926 EXPORT_C void CMemSpyThreadInfoMemoryTracking::TrackingObserverRemove( MMemSpyEngineProcessMemoryTrackerObserver& aObserver ) |
|
2927 { |
|
2928 #ifdef _DEBUG |
|
2929 RDebug::Printf( "CMemSpyThreadInfoMemoryTracking::TrackingObserverRemove() - START - iTracker: 0x%08x, this: 0x%08x", iTracker, this ); |
|
2930 #endif |
|
2931 |
|
2932 if ( iTracker != NULL ) |
|
2933 { |
|
2934 iTracker->RemoveObserver( aObserver ); |
|
2935 } |
|
2936 |
|
2937 #ifdef _DEBUG |
|
2938 RDebug::Printf( "CMemSpyThreadInfoMemoryTracking::TrackingObserverRemove() - END - iTracker: 0x%08x, this: 0x%08x", iTracker, this ); |
|
2939 #endif |
|
2940 } |
|
2941 |
|
2942 |
|
2943 EXPORT_C MDesCArray& CMemSpyThreadInfoMemoryTracking::InfoCurrent() |
|
2944 { |
|
2945 return *iInfoCurrent; |
|
2946 } |
|
2947 |
|
2948 |
|
2949 EXPORT_C MDesCArray& CMemSpyThreadInfoMemoryTracking::InfoHWM() |
|
2950 { |
|
2951 return *iInfoHWM; |
|
2952 } |
|
2953 |
|
2954 |
|
2955 EXPORT_C MDesCArray& CMemSpyThreadInfoMemoryTracking::InfoPeak() |
|
2956 { |
|
2957 return *iInfoPeak; |
|
2958 } |
|
2959 |
|
2960 |
|
2961 void CMemSpyThreadInfoMemoryTracking::HandleMemoryTrackingStartedL() |
|
2962 { |
|
2963 __ASSERT_ALWAYS( iTracker, MemSpyEngineUtils::Panic( EMemSpyEnginePanicTrackerNull1 ) ); |
|
2964 CMemSpyThreadInfoItemBase::CItem& trackingItem = Item( 0 ); |
|
2965 trackingItem.SetOnOffL( iTracker->AmTracking() ); |
|
2966 // |
|
2967 Container().NotifyObserverL( MMemSpyThreadInfoContainerObserver::EInfoItemChanged, Type() ); |
|
2968 } |
|
2969 |
|
2970 |
|
2971 void CMemSpyThreadInfoMemoryTracking::HandleMemoryTrackingStoppedL() |
|
2972 { |
|
2973 __ASSERT_ALWAYS( iTracker, MemSpyEngineUtils::Panic( EMemSpyEnginePanicTrackerNull2 ) ); |
|
2974 CMemSpyThreadInfoItemBase::CItem& trackingItem = Item( 0 ); |
|
2975 trackingItem.SetOnOffL( iTracker->AmTracking() ); |
|
2976 // |
|
2977 Container().NotifyObserverL( MMemSpyThreadInfoContainerObserver::EInfoItemChanged, Type() ); |
|
2978 } |
|
2979 |
|
2980 |
|
2981 void CMemSpyThreadInfoMemoryTracking::HandleMemoryChangedL( const TProcessId& /*aPid*/, const TMemSpyDriverProcessInspectionInfo& aInfoCurrent, const TMemSpyDriverProcessInspectionInfo& aHWMInfoIncShared, const TMemSpyDriverProcessInspectionInfo& aHWMInfoExcShared ) |
|
2982 { |
|
2983 #ifdef _DEBUG |
|
2984 RDebug::Printf( "CMemSpyThreadInfoMemoryTracking::HandleMemoryChangedL() - START - this: 0x%08x", this ); |
|
2985 #endif |
|
2986 |
|
2987 __ASSERT_ALWAYS( iTracker, MemSpyEngineUtils::Panic( EMemSpyEnginePanicTrackerNull3 ) ); |
|
2988 UpdateCaptionsL( aInfoCurrent, aHWMInfoIncShared, aHWMInfoExcShared ); |
|
2989 |
|
2990 #ifdef _DEBUG |
|
2991 RDebug::Printf( "CMemSpyThreadInfoMemoryTracking::HandleMemoryChangedL() - END - this: 0x%08x", this ); |
|
2992 #endif |
|
2993 } |
|
2994 |
|
2995 |
|
2996 void CMemSpyThreadInfoMemoryTracking::UpdateCaptionsL() |
|
2997 { |
|
2998 if ( iTracker ) |
|
2999 { |
|
3000 UpdateCaptionsL( iTracker->InfoCurrent(), iTracker->InfoHWMIncShared(), iTracker->InfoHWMExcShared() ); |
|
3001 } |
|
3002 } |
|
3003 |
|
3004 |
|
3005 void CMemSpyThreadInfoMemoryTracking::UpdateCaptionsL( const TMemSpyDriverProcessInspectionInfo& aInfoCurrent, const TMemSpyDriverProcessInspectionInfo& aHWMInfoIncShared, const TMemSpyDriverProcessInspectionInfo& aHWMInfoExcShared ) |
|
3006 { |
|
3007 if ( iTracker ) |
|
3008 { |
|
3009 // Update caption |
|
3010 Item( 0 ).SetOnOffL( TrackingActive() ); |
|
3011 |
|
3012 if ( TotalIncludesSharedMemory() ) |
|
3013 { |
|
3014 Item( 1 ).SetLongL( aInfoCurrent.TotalIncShared() ); |
|
3015 Item( 2 ).SetLongL( aHWMInfoIncShared.TotalIncShared() ); |
|
3016 Item( 3 ).SetLongL( iTracker->InfoPeaks().TotalIncShared() ); |
|
3017 } |
|
3018 else |
|
3019 { |
|
3020 Item( 1 ).SetLongL( aInfoCurrent.TotalExcShared() ); |
|
3021 Item( 2 ).SetLongL( aHWMInfoExcShared.TotalExcShared() ); |
|
3022 Item( 3 ).SetLongL( iTracker->InfoPeaks().TotalExcShared() ); |
|
3023 } |
|
3024 |
|
3025 Container().NotifyObserverL( MMemSpyThreadInfoContainerObserver::EInfoItemChanged, Type() ); |
|
3026 } |
|
3027 } |
|
3028 |
|
3029 |
|
3030 |
|
3031 |
|
3032 |
|
3033 |
|
3034 |
|
3035 |
|
3036 |
|
3037 |
|
3038 |
|
3039 |
|
3040 |
|
3041 |
|
3042 |
|
3043 |
|
3044 |
|
3045 |
|
3046 |
|
3047 |
|
3048 |
|
3049 |
|
3050 |
|
3051 |
|
3052 |
|
3053 |
|
3054 |
|
3055 |
|
3056 |
|
3057 |
|
3058 |
|
3059 |
|
3060 CMemSpyThreadInfoMemoryTrackingStatisticsCurrent::CMemSpyThreadInfoMemoryTrackingStatisticsCurrent( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction ) |
|
3061 : CMemSpyThreadInfoItemBase( aContainer, EMemSpyThreadInfoItemTypeMemoryTrackingCurrent, aAsyncConstruction ), iTotalIncludesSharedMemory( ETrue ) |
|
3062 { |
|
3063 } |
|
3064 |
|
3065 |
|
3066 CMemSpyThreadInfoMemoryTrackingStatisticsCurrent::~CMemSpyThreadInfoMemoryTrackingStatisticsCurrent() |
|
3067 { |
|
3068 if ( iTracker ) |
|
3069 { |
|
3070 iTracker->RemoveObserver( *this ); |
|
3071 } |
|
3072 } |
|
3073 |
|
3074 |
|
3075 void CMemSpyThreadInfoMemoryTrackingStatisticsCurrent::ConstructL() |
|
3076 { |
|
3077 CMemSpyEngine& engine = Container().Thread().Process().Engine(); |
|
3078 // |
|
3079 if ( iTracker ) |
|
3080 { |
|
3081 iTracker->RemoveObserver( *this ); |
|
3082 } |
|
3083 iTracker = &Container().Engine().HelperProcess().TrackerL( Container().Thread().Process() ); |
|
3084 if ( iTracker ) |
|
3085 { |
|
3086 iTracker->AddObserverL( *this ); |
|
3087 // |
|
3088 _LIT( KItem1, "Stack Memory" ); |
|
3089 AddItemDecimalL( KItem1, iTracker->InfoCurrent().iMemoryStack ); |
|
3090 // |
|
3091 _LIT( KItem2, "Heap Memory" ); |
|
3092 AddItemDecimalL( KItem2, iTracker->InfoCurrent().iMemoryHeap ); |
|
3093 // |
|
3094 _LIT( KItem3, "Local Chunk Memory" ); |
|
3095 AddItemDecimalL( KItem3, iTracker->InfoCurrent().iMemoryChunkLocal ); |
|
3096 // |
|
3097 _LIT( KItem4, "Shared Chunk Memory" ); |
|
3098 AddItemDecimalL( KItem4, iTracker->InfoCurrent().iMemoryChunkShared ); |
|
3099 // |
|
3100 _LIT( KItem5, "Global Data Memory" ); |
|
3101 AddItemDecimalL( KItem5, iTracker->InfoCurrent().iMemoryGlobalData ); |
|
3102 // |
|
3103 _LIT( KItem6, "Total" ); |
|
3104 if ( iTotalIncludesSharedMemory ) |
|
3105 { |
|
3106 AddItemLongL( KItem6, iTracker->InfoCurrent().TotalIncShared() ); |
|
3107 } |
|
3108 else |
|
3109 { |
|
3110 AddItemLongL( KItem6, iTracker->InfoCurrent().TotalExcShared() ); |
|
3111 } |
|
3112 } |
|
3113 } |
|
3114 |
|
3115 |
|
3116 CMemSpyThreadInfoMemoryTrackingStatisticsCurrent* CMemSpyThreadInfoMemoryTrackingStatisticsCurrent::NewLC( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction ) |
|
3117 { |
|
3118 CMemSpyThreadInfoMemoryTrackingStatisticsCurrent* self = new(ELeave) CMemSpyThreadInfoMemoryTrackingStatisticsCurrent( aContainer, aAsyncConstruction ); |
|
3119 CleanupStack::PushL( self ); |
|
3120 if ( !aAsyncConstruction ) |
|
3121 { |
|
3122 self->ConstructL(); |
|
3123 } |
|
3124 return self; |
|
3125 } |
|
3126 |
|
3127 |
|
3128 TPtrC CMemSpyThreadInfoMemoryTrackingStatisticsCurrent::Name() const |
|
3129 { |
|
3130 _LIT(KName, "\tCurrent Statistics"); |
|
3131 return TPtrC( KName ); |
|
3132 } |
|
3133 |
|
3134 |
|
3135 void CMemSpyThreadInfoMemoryTrackingStatisticsCurrent::SetTotalIncludesSharedMemoryL( TBool aIncludesSharedMemory ) |
|
3136 { |
|
3137 iTotalIncludesSharedMemory = aIncludesSharedMemory; |
|
3138 |
|
3139 // Update totals |
|
3140 HandleMemoryChangedL( iTracker->ProcessId(), iTracker->InfoCurrent(), iTracker->InfoHWMIncShared(), iTracker->InfoHWMExcShared() ); |
|
3141 } |
|
3142 |
|
3143 |
|
3144 void CMemSpyThreadInfoMemoryTrackingStatisticsCurrent::HandleMemoryTrackingStartedL() |
|
3145 { |
|
3146 } |
|
3147 |
|
3148 |
|
3149 void CMemSpyThreadInfoMemoryTrackingStatisticsCurrent::HandleMemoryTrackingStoppedL() |
|
3150 { |
|
3151 } |
|
3152 |
|
3153 |
|
3154 void CMemSpyThreadInfoMemoryTrackingStatisticsCurrent::HandleMemoryChangedL( const TProcessId& /*aPid*/, const TMemSpyDriverProcessInspectionInfo& aInfoCurrent, const TMemSpyDriverProcessInspectionInfo& /*aHWMInfoIncShared*/, const TMemSpyDriverProcessInspectionInfo& /*aHWMInfoExcShared*/ ) |
|
3155 { |
|
3156 Item( 0 ).SetDecimalL( aInfoCurrent.iMemoryStack ); |
|
3157 Item( 1 ).SetDecimalL( aInfoCurrent.iMemoryHeap ); |
|
3158 Item( 2 ).SetDecimalL( aInfoCurrent.iMemoryChunkLocal ); |
|
3159 Item( 3 ).SetDecimalL( aInfoCurrent.iMemoryChunkShared ); |
|
3160 Item( 4 ).SetDecimalL( aInfoCurrent.iMemoryGlobalData ); |
|
3161 // |
|
3162 if ( iTotalIncludesSharedMemory ) |
|
3163 { |
|
3164 Item( 5 ).SetLongL( aInfoCurrent.TotalIncShared() ); |
|
3165 } |
|
3166 else |
|
3167 { |
|
3168 Item( 5 ).SetLongL( aInfoCurrent.TotalExcShared() ); |
|
3169 } |
|
3170 } |
|
3171 |
|
3172 |
|
3173 |
|
3174 |
|
3175 |
|
3176 |
|
3177 |
|
3178 |
|
3179 |
|
3180 |
|
3181 |
|
3182 |
|
3183 |
|
3184 |
|
3185 |
|
3186 |
|
3187 |
|
3188 |
|
3189 |
|
3190 CMemSpyThreadInfoMemoryTrackingStatisticsPeak::CMemSpyThreadInfoMemoryTrackingStatisticsPeak( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction ) |
|
3191 : CMemSpyThreadInfoItemBase( aContainer, EMemSpyThreadInfoItemTypeMemoryTrackingPeak, aAsyncConstruction ), iTotalIncludesSharedMemory( ETrue ) |
|
3192 { |
|
3193 } |
|
3194 |
|
3195 |
|
3196 CMemSpyThreadInfoMemoryTrackingStatisticsPeak::~CMemSpyThreadInfoMemoryTrackingStatisticsPeak() |
|
3197 { |
|
3198 if ( iTracker ) |
|
3199 { |
|
3200 iTracker->RemoveObserver( *this ); |
|
3201 } |
|
3202 } |
|
3203 |
|
3204 |
|
3205 void CMemSpyThreadInfoMemoryTrackingStatisticsPeak::ConstructL() |
|
3206 { |
|
3207 CMemSpyEngine& engine = Container().Thread().Process().Engine(); |
|
3208 // |
|
3209 if ( iTracker ) |
|
3210 { |
|
3211 iTracker->RemoveObserver( *this ); |
|
3212 } |
|
3213 iTracker = &Container().Engine().HelperProcess().TrackerL( Container().Thread().Process() ); |
|
3214 if ( iTracker ) |
|
3215 { |
|
3216 iTracker->AddObserverL( *this ); |
|
3217 // |
|
3218 _LIT( KItem1, "Stack Memory" ); |
|
3219 AddItemDecimalL( KItem1, iTracker->InfoPeaks().iMemoryStack ); |
|
3220 // |
|
3221 _LIT( KItem2, "Heap Memory" ); |
|
3222 AddItemDecimalL( KItem2, iTracker->InfoPeaks().iMemoryHeap ); |
|
3223 // |
|
3224 _LIT( KItem3, "Local Chunk Memory" ); |
|
3225 AddItemDecimalL( KItem3, iTracker->InfoPeaks().iMemoryChunkLocal ); |
|
3226 // |
|
3227 _LIT( KItem4, "Shared Chunk Memory" ); |
|
3228 AddItemDecimalL( KItem4, iTracker->InfoPeaks().iMemoryChunkShared ); |
|
3229 // |
|
3230 _LIT( KItem5, "Global Data Memory" ); |
|
3231 AddItemDecimalL( KItem5, iTracker->InfoPeaks().iMemoryGlobalData ); |
|
3232 // |
|
3233 _LIT( KItem6, "Total" ); |
|
3234 if ( iTotalIncludesSharedMemory ) |
|
3235 { |
|
3236 AddItemLongL( KItem6, iTracker->InfoPeaks().TotalIncShared() ); |
|
3237 } |
|
3238 else |
|
3239 { |
|
3240 AddItemLongL( KItem6, iTracker->InfoPeaks().TotalExcShared() ); |
|
3241 } |
|
3242 } |
|
3243 } |
|
3244 |
|
3245 |
|
3246 CMemSpyThreadInfoMemoryTrackingStatisticsPeak* CMemSpyThreadInfoMemoryTrackingStatisticsPeak::NewLC( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction ) |
|
3247 { |
|
3248 CMemSpyThreadInfoMemoryTrackingStatisticsPeak* self = new(ELeave) CMemSpyThreadInfoMemoryTrackingStatisticsPeak( aContainer, aAsyncConstruction ); |
|
3249 CleanupStack::PushL( self ); |
|
3250 if ( !aAsyncConstruction ) |
|
3251 { |
|
3252 self->ConstructL(); |
|
3253 } |
|
3254 return self; |
|
3255 } |
|
3256 |
|
3257 |
|
3258 TPtrC CMemSpyThreadInfoMemoryTrackingStatisticsPeak::Name() const |
|
3259 { |
|
3260 _LIT(KName, "\tPeak Statistics"); |
|
3261 return TPtrC( KName ); |
|
3262 } |
|
3263 |
|
3264 |
|
3265 void CMemSpyThreadInfoMemoryTrackingStatisticsPeak::SetTotalIncludesSharedMemoryL( TBool aIncludesSharedMemory ) |
|
3266 { |
|
3267 iTotalIncludesSharedMemory = aIncludesSharedMemory; |
|
3268 |
|
3269 // Update totals |
|
3270 HandleMemoryChangedL( iTracker->ProcessId(), iTracker->InfoCurrent(), iTracker->InfoHWMIncShared(), iTracker->InfoHWMExcShared() ); |
|
3271 } |
|
3272 |
|
3273 |
|
3274 void CMemSpyThreadInfoMemoryTrackingStatisticsPeak::HandleMemoryTrackingStartedL() |
|
3275 { |
|
3276 } |
|
3277 |
|
3278 |
|
3279 void CMemSpyThreadInfoMemoryTrackingStatisticsPeak::HandleMemoryTrackingStoppedL() |
|
3280 { |
|
3281 } |
|
3282 |
|
3283 |
|
3284 void CMemSpyThreadInfoMemoryTrackingStatisticsPeak::HandleMemoryChangedL( const TProcessId& /*aPid*/, const TMemSpyDriverProcessInspectionInfo& /*aInfoCurrent*/, const TMemSpyDriverProcessInspectionInfo& /*aHWMInfoIncShared*/, const TMemSpyDriverProcessInspectionInfo& /*aHWMInfoExcShared*/ ) |
|
3285 { |
|
3286 Item( 0 ).SetDecimalL( iTracker->InfoPeaks().iMemoryStack ); |
|
3287 Item( 1 ).SetDecimalL( iTracker->InfoPeaks().iMemoryHeap ); |
|
3288 Item( 2 ).SetDecimalL( iTracker->InfoPeaks().iMemoryChunkLocal ); |
|
3289 Item( 3 ).SetDecimalL( iTracker->InfoPeaks().iMemoryChunkShared ); |
|
3290 Item( 4 ).SetDecimalL( iTracker->InfoPeaks().iMemoryGlobalData ); |
|
3291 // |
|
3292 if ( iTotalIncludesSharedMemory ) |
|
3293 { |
|
3294 Item( 5 ).SetLongL( iTracker->InfoPeaks().TotalIncShared() ); |
|
3295 } |
|
3296 else |
|
3297 { |
|
3298 Item( 5 ).SetLongL( iTracker->InfoPeaks().TotalExcShared() ); |
|
3299 } |
|
3300 } |
|
3301 |
|
3302 |
|
3303 |
|
3304 |
|
3305 |
|
3306 |
|
3307 |
|
3308 |
|
3309 |
|
3310 |
|
3311 |
|
3312 |
|
3313 |
|
3314 |
|
3315 |
|
3316 |
|
3317 CMemSpyThreadInfoMemoryTrackingStatisticsHWM::CMemSpyThreadInfoMemoryTrackingStatisticsHWM( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction ) |
|
3318 : CMemSpyThreadInfoItemBase( aContainer, EMemSpyThreadInfoItemTypeMemoryTrackingHWM, aAsyncConstruction ), iTotalIncludesSharedMemory( ETrue ) |
|
3319 { |
|
3320 } |
|
3321 |
|
3322 |
|
3323 CMemSpyThreadInfoMemoryTrackingStatisticsHWM::~CMemSpyThreadInfoMemoryTrackingStatisticsHWM() |
|
3324 { |
|
3325 if ( iTracker ) |
|
3326 { |
|
3327 iTracker->RemoveObserver( *this ); |
|
3328 } |
|
3329 } |
|
3330 |
|
3331 |
|
3332 void CMemSpyThreadInfoMemoryTrackingStatisticsHWM::ConstructL() |
|
3333 { |
|
3334 CMemSpyEngine& engine = Container().Thread().Process().Engine(); |
|
3335 // |
|
3336 if ( iTracker ) |
|
3337 { |
|
3338 iTracker->RemoveObserver( *this ); |
|
3339 } |
|
3340 iTracker = &Container().Engine().HelperProcess().TrackerL( Container().Thread().Process() ); |
|
3341 if ( iTracker ) |
|
3342 { |
|
3343 iTracker->AddObserverL( *this ); |
|
3344 // |
|
3345 _LIT( KItem1, "Stack Memory" ); |
|
3346 _LIT( KItem2, "Heap Memory" ); |
|
3347 _LIT( KItem3, "Local Chunk Memory" ); |
|
3348 _LIT( KItem4, "Shared Chunk Memory" ); |
|
3349 _LIT( KItem5, "Global Data Memory" ); |
|
3350 _LIT( KItem6, "Total" ); |
|
3351 // |
|
3352 if ( iTotalIncludesSharedMemory ) |
|
3353 { |
|
3354 AddItemDecimalL( KItem1, iTracker->InfoHWMIncShared().iMemoryStack ); |
|
3355 AddItemDecimalL( KItem2, iTracker->InfoHWMIncShared().iMemoryHeap ); |
|
3356 AddItemDecimalL( KItem3, iTracker->InfoHWMIncShared().iMemoryChunkLocal ); |
|
3357 AddItemDecimalL( KItem4, iTracker->InfoHWMIncShared().iMemoryChunkShared ); |
|
3358 AddItemDecimalL( KItem5, iTracker->InfoHWMIncShared().iMemoryGlobalData ); |
|
3359 AddItemLongL( KItem6, iTracker->InfoHWMIncShared().TotalIncShared() ); |
|
3360 } |
|
3361 else |
|
3362 { |
|
3363 AddItemDecimalL( KItem1, iTracker->InfoHWMExcShared().iMemoryStack ); |
|
3364 AddItemDecimalL( KItem2, iTracker->InfoHWMExcShared().iMemoryHeap ); |
|
3365 AddItemDecimalL( KItem3, iTracker->InfoHWMExcShared().iMemoryChunkLocal ); |
|
3366 AddItemDecimalL( KItem4, iTracker->InfoHWMExcShared().iMemoryChunkShared ); |
|
3367 AddItemDecimalL( KItem5, iTracker->InfoHWMExcShared().iMemoryGlobalData ); |
|
3368 AddItemLongL( KItem6, iTracker->InfoHWMExcShared().TotalExcShared() ); |
|
3369 } |
|
3370 } |
|
3371 } |
|
3372 |
|
3373 |
|
3374 CMemSpyThreadInfoMemoryTrackingStatisticsHWM* CMemSpyThreadInfoMemoryTrackingStatisticsHWM::NewLC( CMemSpyThreadInfoContainer& aContainer, TBool aAsyncConstruction ) |
|
3375 { |
|
3376 CMemSpyThreadInfoMemoryTrackingStatisticsHWM* self = new(ELeave) CMemSpyThreadInfoMemoryTrackingStatisticsHWM( aContainer, aAsyncConstruction ); |
|
3377 CleanupStack::PushL( self ); |
|
3378 if ( !aAsyncConstruction ) |
|
3379 { |
|
3380 self->ConstructL(); |
|
3381 } |
|
3382 return self; |
|
3383 } |
|
3384 |
|
3385 |
|
3386 void CMemSpyThreadInfoMemoryTrackingStatisticsHWM::SetTotalIncludesSharedMemoryL( TBool aIncludesSharedMemory ) |
|
3387 { |
|
3388 iTotalIncludesSharedMemory = aIncludesSharedMemory; |
|
3389 |
|
3390 // Update totals |
|
3391 HandleMemoryChangedL( iTracker->ProcessId(), iTracker->InfoCurrent(), iTracker->InfoHWMIncShared(), iTracker->InfoHWMExcShared() ); |
|
3392 } |
|
3393 |
|
3394 |
|
3395 TPtrC CMemSpyThreadInfoMemoryTrackingStatisticsHWM::Name() const |
|
3396 { |
|
3397 _LIT(KName, "\tHigh-Water-Mark Statistics"); |
|
3398 return TPtrC( KName ); |
|
3399 } |
|
3400 |
|
3401 |
|
3402 void CMemSpyThreadInfoMemoryTrackingStatisticsHWM::HandleMemoryTrackingStartedL() |
|
3403 { |
|
3404 } |
|
3405 |
|
3406 |
|
3407 void CMemSpyThreadInfoMemoryTrackingStatisticsHWM::HandleMemoryTrackingStoppedL() |
|
3408 { |
|
3409 } |
|
3410 |
|
3411 |
|
3412 void CMemSpyThreadInfoMemoryTrackingStatisticsHWM::HandleMemoryChangedL( const TProcessId& /*aPid*/, const TMemSpyDriverProcessInspectionInfo& /*aInfoCurrent*/, const TMemSpyDriverProcessInspectionInfo& aHWMInfoIncShared, const TMemSpyDriverProcessInspectionInfo& aHWMInfoExcShared ) |
|
3413 { |
|
3414 if ( iTotalIncludesSharedMemory ) |
|
3415 { |
|
3416 Item( 0 ).SetDecimalL( aHWMInfoIncShared.iMemoryStack ); |
|
3417 Item( 1 ).SetDecimalL( aHWMInfoIncShared.iMemoryHeap ); |
|
3418 Item( 2 ).SetDecimalL( aHWMInfoIncShared.iMemoryChunkLocal ); |
|
3419 Item( 3 ).SetDecimalL( aHWMInfoIncShared.iMemoryChunkShared ); |
|
3420 Item( 4 ).SetDecimalL( aHWMInfoIncShared.iMemoryGlobalData ); |
|
3421 Item( 5 ).SetLongL( aHWMInfoIncShared.TotalIncShared() ); |
|
3422 } |
|
3423 else |
|
3424 { |
|
3425 Item( 0 ).SetDecimalL( aHWMInfoExcShared.iMemoryStack ); |
|
3426 Item( 1 ).SetDecimalL( aHWMInfoExcShared.iMemoryHeap ); |
|
3427 Item( 2 ).SetDecimalL( aHWMInfoExcShared.iMemoryChunkLocal ); |
|
3428 Item( 3 ).SetDecimalL( aHWMInfoExcShared.iMemoryChunkShared ); |
|
3429 Item( 4 ).SetDecimalL( aHWMInfoExcShared.iMemoryGlobalData ); |
|
3430 Item( 5 ).SetLongL( aHWMInfoExcShared.TotalExcShared() ); |
|
3431 } |
|
3432 } |
|