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