perfapps/memspyui/ui/avkon/src/MemSpyViewProcesses.cpp
changeset 48 da3ec8478e66
child 52 36d60d12b4af
equal deleted inserted replaced
47:11fa016241a4 48:da3ec8478e66
       
     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 "MemSpyViewProcesses.h"
       
    19 
       
    20 // System includes
       
    21 #include <aknsfld.h>
       
    22 #include <AknQueryDialog.h>
       
    23 #include <memspyui.rsg>
       
    24 
       
    25 // Engine includes
       
    26 #include <memspy/engine/memspyengine.h>
       
    27 #include <memspy/engine/memspyengineobjectprocess.h>
       
    28 #include <memspy/engine/memspyengineobjectthread.h>
       
    29 #include <memspy/engine/memspyengineobjectcontainer.h>
       
    30 #include <memspy/engine/memspyengineobjectthreadinfoobjects.h>
       
    31 #include <memspy/engine/memspyengineobjectthreadinfocontainer.h>
       
    32 #include <memspy/engine/memspyenginehelperprocess.h>
       
    33 #include <memspysession.h>
       
    34 #include <memspy/engine/memspyengineutils.h>
       
    35 
       
    36 // User includes
       
    37 #include "MemSpyViewThreads.h"
       
    38 #include "MemSpyViewMainMenu.h"
       
    39 #include "MemSpyContainerObserver.h"
       
    40 #include "MemSpyUiUtils.h"
       
    41 
       
    42 // Constants
       
    43 const TInt KMemSpyMaxSearchTextLength = 30;
       
    44 const TInt KMemSpyMaxSearchTextLengthWithWildcards = KMemSpyMaxSearchTextLength + 4;
       
    45 
       
    46 
       
    47 CMemSpyViewProcesses::CMemSpyViewProcesses( RMemSpySession& aSession, MMemSpyViewObserver& aObserver )
       
    48 :   CMemSpyViewBase( aSession, aObserver )
       
    49     {
       
    50     }
       
    51 
       
    52 CMemSpyViewProcesses::CMemSpyViewProcesses( RMemSpySession& aEngine, MMemSpyViewObserver& aObserver, TProcessId aId )
       
    53 :   CMemSpyViewBase( aEngine, aObserver ), iCurrentProcessId( aId )
       
    54     {
       
    55     }
       
    56 
       
    57 CMemSpyViewProcesses::~CMemSpyViewProcesses()
       
    58     {	
       
    59 	iProcesses.Close();
       
    60     //delete iSearchField;
       
    61     delete iMatcherBuffer;
       
    62     }
       
    63 
       
    64 
       
    65 //void CMemSpyViewProcesses::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune )
       
    66 void CMemSpyViewProcesses::ConstructL( const TRect& aRect, CCoeControl& aContainer, TProcessId aSelectionRune )
       
    67     {
       
    68 	iMemSpySession.GetProcessesL(iProcesses); // get processes array;
       
    69 	
       
    70     _LIT( KTitle, "Processes\n& Threads" );
       
    71     SetTitleL( KTitle );
       
    72     //
       
    73     //CMemSpyViewBase::ConstructL( aRect, aContainer, aSelectionRune );
       
    74     CMemSpyViewBase::ConstructL( aRect, aContainer );
       
    75     //
       
    76     iMatcherBuffer = HBufC::NewL( KMemSpyMaxSearchTextLengthWithWildcards );
       
    77     //
       
    78     /* TODO: to restore the Search field functionality
       
    79     iSearchField = CAknSearchField::NewL( *this, CAknSearchField::ESearch, NULL, KMemSpyMaxSearchTextLength );
       
    80 
       
    81     iSearchField->SetObserver( this );
       
    82     iSearchField->SetFocus( ETrue );
       
    83     iSearchField->SetComponentsToInheritVisibility( ETrue );
       
    84     */
       
    85     //    
       
    86     if  ( iCurrentProcessId > 0 )
       
    87         {
       
    88 		TInt index = 0;
       
    89 	//	TProcessId selectedItem = aSelectionRune; //static_cast< TProcessId >( *aSelectionRune );
       
    90 		for( TInt i=0; i<iProcesses.Count();i++)
       
    91 			{
       
    92 			if( iProcesses[i]->Id() == iCurrentProcessId )
       
    93 				{
       
    94 				index = i;
       
    95 				}
       
    96 			}					        
       
    97         
       
    98         if  ( index >= 0 && index < iListBox->Model()->NumberOfItems() )
       
    99             {
       
   100             iListBox->SetCurrentItemIndex( index );
       
   101             HandleListBoxItemSelectedL( index );
       
   102             }            
       
   103         }
       
   104     else if ( iProcesses.Count() > 0 )
       
   105         {
       
   106         iListBox->SetCurrentItemIndex( 0 );
       
   107         HandleListBoxItemSelectedL( 0 );
       
   108         }
       
   109     //
       
   110     SizeChanged();
       
   111     ActivateL();
       
   112     }
       
   113 
       
   114 
       
   115 CMemSpyProcess& CMemSpyViewProcesses::CurrentProcess() const
       
   116     {
       
   117 	/*
       
   118     __ASSERT_ALWAYS( iCurrentProcess != NULL, User::Invariant() );
       
   119     return *iCurrentProcess;
       
   120     */	
       
   121     }
       
   122 
       
   123 
       
   124 void CMemSpyViewProcesses::RefreshL()
       
   125     {
       
   126     SetListBoxModelL();
       
   127     CMemSpyViewBase::RefreshL();
       
   128     }
       
   129 
       
   130 
       
   131 TMemSpyViewType CMemSpyViewProcesses::ViewType() const
       
   132     {
       
   133     return EMemSpyViewTypeProcesses;
       
   134     }
       
   135 
       
   136 
       
   137 CMemSpyViewBase* CMemSpyViewProcesses::PrepareParentViewL()
       
   138     {
       
   139     CMemSpyViewMainMenu* parent = new(ELeave) CMemSpyViewMainMenu( iMemSpySession, iObserver );
       
   140     CleanupStack::PushL( parent );
       
   141     parent->ConstructL( Rect(), *Parent(), (TAny*) ViewType() );
       
   142     CleanupStack::Pop( parent );
       
   143     return parent;
       
   144     }
       
   145 
       
   146 
       
   147 CMemSpyViewBase* CMemSpyViewProcesses::PrepareChildViewL()
       
   148     {	
       
   149     CMemSpyViewThreads* child = new(ELeave) CMemSpyViewThreads( iMemSpySession, iObserver, iProcesses[iListBox->CurrentItemIndex()]->Id(), 0 );
       
   150     CleanupStack::PushL( child );
       
   151     child->ConstructL( Rect(), *Parent() );
       
   152     CleanupStack::Pop( child );
       
   153     return child;
       
   154     
       
   155 	return 0;
       
   156     }
       
   157 
       
   158 
       
   159 void CMemSpyViewProcesses::DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane )
       
   160     {
       
   161     if  ( aResourceId == MenuCascadeResourceId() )
       
   162         {
       
   163         TInt index = iListBox->CurrentItemIndex( );
       
   164         const TBool hide = iProcesses[index]->IsDead() || iProcesses[index]->ThreadCount() == 0;
       
   165         
       
   166         //aMenuPane->SetItemDimmed( EMemSpyCmdProcessInfo, hide ); //to be added into API
       
   167         aMenuPane->SetItemDimmed( EMemSpyCmdProcessEnd, hide );
       
   168         }
       
   169     }
       
   170 
       
   171 
       
   172 TBool CMemSpyViewProcesses::HandleCommandL( TInt aCommand )
       
   173     {
       
   174     TBool handled = ETrue;
       
   175     //
       
   176     switch ( aCommand )
       
   177         {
       
   178     // Sorting
       
   179     case EMemSpyCmdProcessSortById:
       
   180         OnCmdSortByIdL();
       
   181 		break;
       
   182     case EMemSpyCmdProcessSortByName:
       
   183         OnCmdSortByNameL();
       
   184 		break;
       
   185     case EMemSpyCmdProcessSortByThreadCount:
       
   186         OnCmdSortByThreadCountL();
       
   187 		break;
       
   188     case EMemSpyCmdProcessSortByCodeSegs:
       
   189         OnCmdSortByCodeSegsL();
       
   190 		break;
       
   191     case EMemSpyCmdProcessSortByHeapUsage:
       
   192         OnCmdSortByHeapUsageL();
       
   193 		break;
       
   194     case EMemSpyCmdProcessSortByStackUsage:
       
   195         OnCmdSortByStackUsageL();
       
   196 		break;
       
   197     // End
       
   198     case EMemSpyCmdProcessEndTerminate:
       
   199         OnCmdEndTerminateL();
       
   200 		break;
       
   201     case EMemSpyCmdProcessEndKill:
       
   202         OnCmdEndKillL();
       
   203 		break;
       
   204     case EMemSpyCmdProcessEndPanic:
       
   205         OnCmdEndPanicL();
       
   206 		break;
       
   207     // Info
       
   208     case EMemSpyCmdProcessInfoSummary:
       
   209         OnCmdInfoSummaryL();
       
   210 		break;
       
   211     case EMemSpyCmdProcessInfoHandles:
       
   212         OnCmdInfoHandlesL();
       
   213         break;
       
   214 
       
   215     default:
       
   216         handled = CMemSpyViewBase::HandleCommandL( aCommand );
       
   217         break;
       
   218         }
       
   219     //
       
   220     return handled;
       
   221     }
       
   222 
       
   223 
       
   224 void CMemSpyViewProcesses::OnCmdSortByIdL()
       
   225     {	
       
   226     //iEngine.Container().SortById();
       
   227     RefreshL();    
       
   228     }
       
   229 
       
   230 
       
   231 void CMemSpyViewProcesses::OnCmdSortByNameL()
       
   232     {	
       
   233     //iEngine.Container().SortByName();
       
   234     RefreshL();    
       
   235     }
       
   236 
       
   237 
       
   238 void CMemSpyViewProcesses::OnCmdSortByThreadCountL()
       
   239     {	
       
   240     //iEngine.Container().SortByThreadCount();
       
   241     RefreshL();    
       
   242     }
       
   243 
       
   244 
       
   245 void CMemSpyViewProcesses::OnCmdSortByCodeSegsL()
       
   246     {	
       
   247     //iEngine.Container().SortByCodeSegs();
       
   248     RefreshL();
       
   249     }
       
   250 
       
   251 
       
   252 void CMemSpyViewProcesses::OnCmdSortByHeapUsageL()
       
   253     {	
       
   254     //iEngine.Container().SortByHeapUsage();
       
   255     RefreshL();    
       
   256     }
       
   257 
       
   258 
       
   259 void CMemSpyViewProcesses::OnCmdSortByStackUsageL()
       
   260     {
       
   261    // iEngine.Container().SortByStackUsage();
       
   262     RefreshL();
       
   263     }
       
   264 
       
   265 
       
   266 void CMemSpyViewProcesses::OnCmdInfoSummaryL()
       
   267     {
       
   268     //CMemSpyProcess& process = CurrentProcess();
       
   269     //iEngine.HelperProcess().OutputProcessInfoL( process );
       
   270     }
       
   271 
       
   272 
       
   273 void CMemSpyViewProcesses::OnCmdInfoHandlesL()
       
   274     {
       
   275 	/*
       
   276     CMemSpyProcess& process = CurrentProcess();
       
   277     //
       
   278     const TInt threadCount = process.Count();
       
   279     for( TInt i=0; i<threadCount; i++ )
       
   280         {
       
   281         CMemSpyThread& thread = process.At( i );
       
   282         thread.InfoContainerForceSyncronousConstructionL().PrintL();
       
   283         }
       
   284         */
       
   285     }
       
   286 
       
   287 
       
   288 void CMemSpyViewProcesses::OnCmdEndTerminateL()
       
   289     {
       
   290     TBool system = ETrue;
       
   291     TBool doTerminate = ETrue;
       
   292     TInt err = KErrNone;
       
   293     
       
   294     iMemSpySession.ProcessSystemPermanentOrCritical( iCurrentProcessId, system );
       
   295     
       
   296     if ( system )
       
   297         {
       
   298         CAknQueryDialog* importDialog = CAknQueryDialog::NewL();
       
   299         doTerminate = ( importDialog->ExecuteLD( R_MEMSPY_PANIC_SYSTEM_CRITICAL_THREAD_OR_PROCESS ) );
       
   300         }
       
   301     
       
   302     if ( doTerminate )
       
   303         {        
       
   304         TRAP( err, iMemSpySession.EndProcessL( iCurrentProcessId, ETerminate ) );
       
   305         if( err = KErrNone )
       
   306             RefreshL();
       
   307         }        
       
   308     }
       
   309 
       
   310 
       
   311 void CMemSpyViewProcesses::OnCmdEndPanicL()
       
   312     {
       
   313     TBool system = ETrue;
       
   314     TBool doTerminate = ETrue;
       
   315     TInt err = KErrNone;
       
   316         
       
   317     iMemSpySession.ProcessSystemPermanentOrCritical( iCurrentProcessId, system );
       
   318         
       
   319     if ( system )
       
   320         {
       
   321         CAknQueryDialog* importDialog = CAknQueryDialog::NewL();
       
   322         doTerminate = ( importDialog->ExecuteLD( R_MEMSPY_PANIC_SYSTEM_CRITICAL_THREAD_OR_PROCESS ) );
       
   323         }
       
   324         
       
   325     if ( doTerminate )
       
   326         {
       
   327         TRAP( err, iMemSpySession.EndProcessL( iCurrentProcessId, EPanic ) );
       
   328         if( err == KErrNone )            
       
   329             RefreshL();
       
   330         }               
       
   331     }
       
   332 
       
   333 
       
   334 void CMemSpyViewProcesses::OnCmdEndKillL()
       
   335     {
       
   336     TBool system = ETrue;
       
   337     TBool doTerminate = ETrue;
       
   338     TInt err = KErrNone;
       
   339          
       
   340     iMemSpySession.ProcessSystemPermanentOrCritical( iCurrentProcessId, system );
       
   341          
       
   342     if ( system )
       
   343         {
       
   344         CAknQueryDialog* importDialog = CAknQueryDialog::NewL();
       
   345         doTerminate = ( importDialog->ExecuteLD( R_MEMSPY_PANIC_SYSTEM_CRITICAL_THREAD_OR_PROCESS ) );
       
   346         }
       
   347          
       
   348     if ( doTerminate )
       
   349         {
       
   350         TRAP( err, iMemSpySession.EndProcessL( iCurrentProcessId, EKill ) )
       
   351         if( err == KErrNone )
       
   352             RefreshL();
       
   353         }               
       
   354     }
       
   355 
       
   356 
       
   357 
       
   358 
       
   359 void CMemSpyViewProcesses::SetListBoxModelL()
       
   360     {	
       
   361 	if( iProcesses.Count() > 0 )
       
   362 		{
       
   363 		iProcesses.Close();
       
   364 		}
       
   365 	
       
   366 	iMemSpySession.GetProcessesL(iProcesses); // get processes array;
       
   367 	iModel = new (ELeave) CDesC16ArrayFlat( iProcesses.Count() + 1); //array for formated items
       
   368 	
       
   369 	_LIT( KTab, "\t" );
       
   370 	iModel = FormatModel( iProcesses ); //TODO Format model method with advanced formatting
       
   371 		
       
   372 	CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox );
       
   373     //listbox->Model()->SetItemTextArray( &iEngine.Container() );
       
   374     listbox->Model()->SetItemTextArray( iModel );
       
   375     listbox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray );
       
   376     }
       
   377 
       
   378 
       
   379 void CMemSpyViewProcesses::HandleListBoxItemActionedL( TInt /*aIndex*/ )
       
   380     {
       
   381     // Notify observer about an item being 'fired'
       
   382     ReportEventL( MMemSpyViewObserver::EEventItemActioned );
       
   383     }
       
   384 
       
   385 
       
   386 void CMemSpyViewProcesses::HandleListBoxItemSelectedL( TInt aIndex )
       
   387     {
       
   388     iCurrentProcessId = iProcesses[aIndex]->Id();
       
   389     /*
       
   390     if  ( iCurrentProcess )
       
   391         {
       
   392         iCurrentProcess->Close();
       
   393         }
       
   394 
       
   395     // Obtain the process that corresponds to the selected item
       
   396     CMemSpyEngineObjectContainer& container = iEngine.Container();
       
   397     CMemSpyProcess& process = container.At( aIndex );
       
   398     iCurrentProcess = &process;
       
   399 
       
   400     // Notify observer about item selection     
       
   401      */
       
   402     ReportEventL( MMemSpyViewObserver::EEventItemSelected );
       
   403     }
       
   404 
       
   405 
       
   406 void CMemSpyViewProcesses::SizeChanged()
       
   407     {
       
   408     const TRect rect( Rect() );
       
   409     CMemSpyViewBase::SizeChanged();
       
   410     /*
       
   411     if  ( iListBox && iSearchField )
       
   412         {
       
   413         const TInt lafIndex_H = 1;
       
   414         AknLayoutUtils::LayoutControl( iListBox, rect, AknLayout::list_gen_pane( lafIndex_H ) );
       
   415         AknLayoutUtils::LayoutControl( iSearchField, rect, AknLayout::find_pane() );
       
   416         }
       
   417     else
       
   418         {
       
   419         CMemSpyViewBase::SizeChanged();
       
   420         }
       
   421     */
       
   422 
       
   423 /*
       
   424     // Search field
       
   425     TSize searchFieldSize( iSearchField->MinimumSize() ); // BALLS: search field doesn't implement minimum size correctly?!?!?
       
   426     searchFieldSize.SetWidth( rect.Width() );
       
   427     const TRect searchFieldRect( TPoint( rect.iTl.iX, rect.iBr.iY ), searchFieldSize );
       
   428     iSearchField->SetRect( searchFieldRect );
       
   429 
       
   430     // Listbox
       
   431     TSize listBoxSize( rect.Size() - TSize( 0, searchFieldSize.iHeight ) );
       
   432     iListBox->SetRect( rect.iTl, listBoxSize );
       
   433 */
       
   434     }
       
   435 
       
   436 
       
   437 TInt CMemSpyViewProcesses::CountComponentControls() const
       
   438     {
       
   439     TInt count = 0;
       
   440     //
       
   441     if  ( iListBox != NULL )
       
   442         {
       
   443         ++count;
       
   444         }
       
   445     /*if  ( iSearchField != NULL )
       
   446         {
       
   447         ++count;
       
   448         }*/
       
   449     //
       
   450     return count;
       
   451     }
       
   452 
       
   453 
       
   454 CCoeControl* CMemSpyViewProcesses::ComponentControl( TInt aIndex ) const
       
   455     {
       
   456     CCoeControl* ret = iListBox;
       
   457     //
       
   458     if  ( aIndex == 1 )
       
   459         {
       
   460         //ret = iSearchField;
       
   461         }
       
   462     //
       
   463     return ret;
       
   464     }
       
   465 
       
   466 
       
   467 TKeyResponse CMemSpyViewProcesses::OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType )
       
   468     {
       
   469     TKeyResponse resp = EKeyWasNotConsumed;
       
   470     //
       
   471     if  ( aType == EEventKey )
       
   472         {
       
   473         switch( aKeyEvent.iCode )
       
   474             {
       
   475         case EKeyUpArrow:
       
   476         case EKeyDownArrow:
       
   477         case EKeyEnter:
       
   478         case EKeyOK:
       
   479             if  ( iListBox )
       
   480                 {
       
   481                 resp = iListBox->OfferKeyEventL( aKeyEvent, aType );
       
   482                 }
       
   483             break;
       
   484         default:
       
   485             break;
       
   486             }
       
   487         //
       
   488         if  ( resp == EKeyWasNotConsumed )
       
   489             {
       
   490             // Do we need to show the find field?
       
   491             //resp = iSearchField->OfferKeyEventL( aKeyEvent, aType );
       
   492             }
       
   493         }
       
   494     //
       
   495     return resp;
       
   496     }
       
   497 
       
   498 
       
   499 void CMemSpyViewProcesses::HandleControlEventL( CCoeControl* aControl, TCoeEvent aEventType )
       
   500     {
       
   501     CMemSpyViewBase::HandleControlEventL( aControl, aEventType );
       
   502     //
       
   503     if  ( aEventType == MCoeControlObserver::EEventStateChanged )
       
   504         {
       
   505         /*
       
   506         if  ( aControl == iSearchField )
       
   507             {
       
   508             SelectListBoxItemByFindTextL();
       
   509             }
       
   510             */
       
   511         }
       
   512     }
       
   513 
       
   514 
       
   515 void CMemSpyViewProcesses::FocusChanged( TDrawNow /*aDrawNow*/ )
       
   516     {
       
   517     if  ( iListBox )
       
   518         {
       
   519         iListBox->SetFocus( IsFocused() );
       
   520         }
       
   521     /*if  ( iSearchField )
       
   522         {
       
   523         iSearchField->SetFocus( IsFocused() );
       
   524         }
       
   525         */
       
   526     }
       
   527 
       
   528 
       
   529 void CMemSpyViewProcesses::SelectListBoxItemByFindTextL()
       
   530     {
       
   531 	/*
       
   532     _LIT( KMemSpyWildcardCharacter, "*" );
       
   533     
       
   534     TPtr pBuffer( iMatcherBuffer->Des() );
       
   535     iSearchField->GetSearchText( pBuffer );
       
   536     //pBuffer.Insert( 0, KMemSpyWildcardCharacter );
       
   537     pBuffer.Append( KMemSpyWildcardCharacter );
       
   538     
       
   539     CMemSpyEngineObjectContainer& container = iEngine.Container();
       
   540     const TInt count = container.Count();
       
   541     //
       
   542     TInt index = 0;
       
   543     while( index < count )
       
   544         {
       
   545         CMemSpyProcess& process = container.At( index );
       
   546         const TPtrC processName( process.Name() );
       
   547         //
       
   548         if  ( processName.MatchF( pBuffer ) >= 0 )
       
   549             {
       
   550             HandleListBoxItemSelectedL( index );
       
   551             iListBox->ScrollToMakeItemVisible( index );
       
   552             iListBox->SetCurrentItemIndexAndDraw( index );
       
   553             return;
       
   554             }
       
   555             
       
   556         ++index;
       
   557         }
       
   558         */
       
   559     }
       
   560 
       
   561 //Model formating methods
       
   562 //TODO: to be debbuged
       
   563 
       
   564 CDesCArrayFlat* CMemSpyViewProcesses::FormatModel( RArray<CMemSpyApiProcess*> aProcesses )
       
   565 	{		
       
   566 	model = new (ELeave) CDesC16ArrayFlat( iProcesses.Count() + 16 ); //array for formated items
       
   567 	_LIT( KMemSpyProcessNameFormatSpecBasicName, " \t%S\t\t%8x, " );
       
   568 	
       
   569 	for( TInt i=0; i < aProcesses.Count(); i++ )
       
   570 		{
       
   571 		HBufC* tempName = HBufC::NewL( KMaxFullName ); //aProcesses[i]->Name().Length() + 16
       
   572 	    CleanupStack::PushL( tempName );
       
   573 	    TPtr tempNamePtr( tempName->Des() );	    
       
   574 	    tempNamePtr.Copy( aProcesses[i]->Name() );
       
   575 		
       
   576 		TBuf<10> priority;
       
   577 		TProcessPriority tempPriority = aProcesses[i]->Priority();
       
   578 		MemSpyUiUtils::AppendPriority( priority, tempPriority );
       
   579 		
       
   580 	    // Convert the full name to the format we want in the UI
       
   581 	    TBuf<KMaxFullName + 60> name;
       
   582 	    TMemSpyTruncateOverflow overflow; //included from EngineUtils TODO: to consider if this is needed to be removed or left there
       
   583 	    TUint32 tempSID =  aProcesses[i]->SID();
       
   584 	    name.AppendFormat( KMemSpyProcessNameFormatSpecBasicName, &overflow, tempName, tempSID );	//tempNamePtr
       
   585 	    
       
   586 	    if( aProcesses[i]->ExitType() != EExitPending ) // instead of IsDead() method
       
   587 	    	{
       
   588 			MemSpyUiUtils::AppendExitInfo( name, aProcesses[i]->ExitType(), aProcesses[i]->ExitReason(), aProcesses[i]->ExitCategory() );
       
   589 	    	}
       
   590 	    else
       
   591 	        {
       
   592 			_LIT( KMemSpyProcessNameFormatSpecAlive, "%2d thr, %S" );
       
   593 			name.AppendFormat( KMemSpyProcessNameFormatSpecAlive, &overflow, aProcesses[i]->ThreadCount(), &priority );
       
   594 	        }
       
   595 							
       
   596     	model->AppendL( name );
       
   597     	
       
   598     	CleanupStack::PopAndDestroy( tempName ); 
       
   599 		}	
       
   600 	
       
   601 	return model;
       
   602 	}
       
   603 
       
   604