libraries/qr3/src/mutexlistboxdata.cpp
changeset 0 7f656887cf89
equal deleted inserted replaced
-1:000000000000 0:7f656887cf89
       
     1 // mutexlistboxdata.cpp
       
     2 // 
       
     3 // Copyright (c) 2010 Accenture. All rights reserved.
       
     4 // This component and the accompanying materials are made available
       
     5 // under the terms of the "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 // Accenture - Initial contribution
       
    11 //
       
    12 #include "KernLbxModel.h"
       
    13 #include "Utils.h"
       
    14 #include <fshell/clogger.h>
       
    15 #include <fshell/memoryaccess.h>
       
    16 #include <fshell/qr3dll.h>
       
    17 #include "QResources3.hrh"
       
    18 
       
    19 CMutexListBoxData::CMutexListBoxData(CKernListBoxModel* aModel)
       
    20 	: CKernListBoxData(aModel)
       
    21 	{
       
    22 	}
       
    23 
       
    24 void CMutexListBoxData::DoFormatL(TObjectKernelInfo* aInfo, RBuf& name, RBuf& more, TInt& /*itemId*/)
       
    25 	{
       
    26 	TMutexKernelInfo& info = *(TMutexKernelInfo*)aInfo;
       
    27 	name.Copy(info.iFullName);
       
    28 	PrettyName(iType, name);
       
    29 
       
    30 	more.Format(_L("Order=%d Held=%d Waiting=%d"), info.iOrder, info.iHoldCount, info.iWaitCount);
       
    31 	}
       
    32 
       
    33 void CMutexListBoxData::DumpToCloggerL(RClogger& clogger, TInt i, TInt /*count*/)
       
    34 	{
       
    35 	TMutexKernelInfo& info = *(TMutexKernelInfo*)iInfo;
       
    36 	_LIT8(KDesc,"Mutex;KernObjAddr;FullName;AccessCount;HoldCount;WaitCount;Order");
       
    37 	_LIT8(KFmt, "Mutex;%x;%S;%d;%x;%u");
       
    38 	
       
    39 	if (i == 0) clogger.Log(KDesc);
       
    40 	clogger.Log(KFmt, info.iAddressOfKernelObject, &info.iFullName, info.iAccessCount, info.iHoldCount, info.iWaitCount, info.iOrder);
       
    41 	}
       
    42 
       
    43 #define CASE_LIT2(val, name) case val: { _LIT(KName, #name); return KName; }
       
    44 
       
    45 const TDesC& Name(TUint8 aOrder)
       
    46 	{
       
    47 	switch (aOrder)
       
    48 		{
       
    49 		CASE_LIT2(0xff, KMutexOrdNone);
       
    50 		CASE_LIT2(0xfe, KMutexOrdUser);
       
    51 		CASE_LIT2(0xf7, KMutexOrdGeneral7);
       
    52 		CASE_LIT2(0xf6, KMutexOrdGeneral6);
       
    53 		CASE_LIT2(0xf5, KMutexOrdGeneral5);
       
    54 		CASE_LIT2(0xf4, KMutexOrdGeneral4);
       
    55 		CASE_LIT2(0xf3, KMutexOrdGeneral3);
       
    56 		CASE_LIT2(0xf2, KMutexOrdGeneral2);
       
    57 		CASE_LIT2(0xf1, KMutexOrdGeneral1);
       
    58 		CASE_LIT2(0xf0, KMutexOrdGeneral0);
       
    59 		CASE_LIT2(0x60, KMutexOrdCodeSegLock);
       
    60 		CASE_LIT2(0x5e, KMutexOrdPubSub2);
       
    61 		CASE_LIT2(0x5c, KMutexOrdDemandPaging);
       
    62 		CASE_LIT2(0x58, KMutexOrdPowerMgr);
       
    63 		CASE_LIT2(0x50, KMutexOrdPubSub);
       
    64 		CASE_LIT2(0x48, KMutexOrdProcessLock);
       
    65 		CASE_LIT2(0x47, KMutexOrdDebug);
       
    66 		CASE_LIT2(0x40, KMutexOrdTimer);
       
    67 		CASE_LIT2(0x38, KMutexOrdObjectCon2);
       
    68 		CASE_LIT2(0x30, KMutexOrdHandle);
       
    69 		CASE_LIT2(0x28, KMutexOrdObjectCon);
       
    70 		CASE_LIT2(0x20, KMutexOrdMachineConfig);
       
    71 		CASE_LIT2(0x10, KMutexOrdHwChunk);
       
    72 		CASE_LIT2(0x08, KMutexOrdKernelHeap);
       
    73 		CASE_LIT2(0x01, KMutexOrdRamAlloc);
       
    74 		default:
       
    75 			_LIT(KHuh, "?");
       
    76 			return KHuh;
       
    77 		}
       
    78 	}
       
    79 
       
    80 void CMutexListBoxData::DoInfoForDialogL(RBuf& aTitle, RBuf& inf, TDes* /*aTemp*/)
       
    81 	{
       
    82 	TMutexKernelInfo& info = *(TMutexKernelInfo*)iInfo;
       
    83 	_LIT(KInfo, "Mutex info");
       
    84 	aTitle.Copy(KInfo);
       
    85 
       
    86 	inf.Copy(iInfo->iFullName);
       
    87 	inf.Append(Klflf);
       
    88 	
       
    89 	inf.AppendFormat(_L("Kernel object address: 0x%08x\n"), info.iAddressOfKernelObject);
       
    90 	TPtrC ord = Name(info.iOrder);
       
    91 	inf.AppendFormat(_L("Order: 0x%02x (%S)\n"), info.iOrder, &ord);
       
    92 	inf.AppendFormat(_L("Access count: %u\n"), info.iAccessCount);
       
    93 	inf.AppendFormat(_L("Hold count: %d\nWaiting count: %d"), info.iHoldCount, info.iWaitCount);
       
    94 	}