1001 iEngine.Sink().DataStreamEndL(); |
1022 iEngine.Sink().DataStreamEndL(); |
1002 |
1023 |
1003 CleanupStack::PopAndDestroy(list); |
1024 CleanupStack::PopAndDestroy(list); |
1004 break; |
1025 break; |
1005 } |
1026 } |
|
1027 case EMemSpyClientServerOpGetChunksCount: |
|
1028 { |
|
1029 CMemSpyEngineChunkList* list = iEngine.HelperChunk().ListL(); |
|
1030 CleanupStack::PushL( list ); |
|
1031 aMessage.WriteL(0, TPckgBuf<TInt>(list->MdcaCount())); |
|
1032 CleanupStack::PopAndDestroy( list ); |
|
1033 |
|
1034 break; |
|
1035 } |
|
1036 case EMemSpyClientServerOpGetSortedChunks: |
|
1037 { |
|
1038 CMemSpyEngineChunkList* list = iEngine.HelperChunk().ListL(); |
|
1039 CleanupStack::PushL( list ); |
|
1040 |
|
1041 TPckgBuf<TSortType> a2; |
|
1042 aMessage.ReadL( 2, a2 ); |
|
1043 |
|
1044 //sort the list of chunks |
|
1045 if( a2() == ESortChunkByName ) |
|
1046 list->SortByNameL(); |
|
1047 else |
|
1048 list->SortBySizeL(); |
|
1049 |
|
1050 TPckgBuf<TInt> a0; |
|
1051 aMessage.ReadL(0, a0); |
|
1052 |
|
1053 TInt realCount = Min(a0(), list->MdcaCount()); |
|
1054 |
|
1055 for(TInt i=0, offset = 0; i<realCount; i++, offset += sizeof(TMemSpyChunkData)) |
|
1056 { |
|
1057 const CMemSpyEngineChunkEntry& chunk = list->At(i); |
|
1058 TMemSpyChunkData data; |
|
1059 |
|
1060 data.iName.Copy( chunk.Name() ); |
|
1061 data.iHandle = (TUint8*)chunk.Handle(); |
|
1062 data.iSize = chunk.Size(); |
|
1063 data.iMaxSize = chunk.MaxSize(); |
|
1064 data.iBaseAddress = (TUint8*)chunk.BaseAddress(); |
|
1065 data.iOwnerId = chunk.OwnerId(); |
|
1066 TFullName ownerName; |
|
1067 chunk.OwnerName( ownerName ); |
|
1068 data.iOwnerName = ownerName; |
|
1069 data.iType = chunk.Type(); |
|
1070 data.iAttributes = chunk.Attributes(); |
|
1071 |
|
1072 TPckgBuf<TMemSpyChunkData> buffer(data); |
|
1073 aMessage.WriteL(1, buffer, offset); |
|
1074 } |
|
1075 |
|
1076 CleanupStack::PopAndDestroy( list ); |
|
1077 |
|
1078 break; |
|
1079 } |
|
1080 case EMemSpyClientServerOpChunkListOutput: |
|
1081 { |
|
1082 //Get Chunk list |
|
1083 CMemSpyEngineChunkList* list = iEngine.HelperChunk().ListL(); |
|
1084 CleanupStack::PushL( list ); |
1006 |
1085 |
|
1086 // Begin a new data stream |
|
1087 _LIT( KMemSpyContext, "Chunk List" ); |
|
1088 _LIT( KMemSpyFolder, "Chunks" ); |
|
1089 iEngine.Sink().DataStreamBeginL( KMemSpyContext, KMemSpyFolder ); |
|
1090 |
|
1091 // Set prefix for overall listing |
|
1092 _LIT( KOverallPrefix, "Chunk List - " ); |
|
1093 iEngine.Sink().OutputPrefixSetLC( KOverallPrefix ); |
|
1094 |
|
1095 // Create header |
|
1096 CMemSpyEngineChunkList::OutputDataColumnsL( iEngine ); |
|
1097 |
|
1098 // List items |
|
1099 const TInt count = list->Count(); |
|
1100 for(TInt i=0; i<count; i++) |
|
1101 { |
|
1102 const CMemSpyEngineChunkEntry& entry = list->At( i ); |
|
1103 // |
|
1104 entry.OutputDataL( iEngine.HelperChunk() ); |
|
1105 } |
|
1106 |
|
1107 // Tidy up |
|
1108 CleanupStack::PopAndDestroy(); // prefix |
|
1109 |
|
1110 // End data stream |
|
1111 iEngine.Sink().DataStreamEndL(); |
|
1112 CleanupStack::PopAndDestroy( list ); |
|
1113 |
|
1114 break; |
|
1115 } |
1007 case EMemSpyClientServerOpGetMemoryTrackingCycleCount: |
1116 case EMemSpyClientServerOpGetMemoryTrackingCycleCount: |
1008 { |
1117 { |
1009 TInt count = iEngine.HelperSysMemTracker().CompletedCycles().Count(); |
1118 TInt count = iEngine.HelperSysMemTracker().CompletedCycles().Count(); |
1010 TPckgBuf<TInt> ret( count ); |
1119 TPckgBuf<TInt> ret( count ); |
1011 aMessage.WriteL( 0, ret ); |
1120 aMessage.WriteL( 0, ret ); |
1295 |
1404 |
1296 CleanupStack::PopAndDestroy( &groups ); |
1405 CleanupStack::PopAndDestroy( &groups ); |
1297 |
1406 |
1298 break; |
1407 break; |
1299 } |
1408 } |
|
1409 case EMemSpyClientServerOpSwitchToWindowGroup: |
|
1410 { |
|
1411 TPckgBuf<TInt> id; |
|
1412 aMessage.ReadL(0, id); |
|
1413 |
|
1414 MMemSpyEngineHelperWindowServer& windowServerManager = iEngine.HelperWindowServer(); |
|
1415 windowServerManager.SwitchToL( id() ); |
|
1416 |
|
1417 break; |
|
1418 } |
|
1419 case EMemSpyClientServerOpIsAknIconCacheConfigurable: |
|
1420 { |
|
1421 TBool ret = iEngine.HelperRAM().IsAknIconCacheConfigurable(); |
|
1422 |
|
1423 TPckgBuf<TBool> retBuf( ret ); |
|
1424 aMessage.WriteL( 0, retBuf ); |
|
1425 break; |
|
1426 } |
|
1427 case EMemSpyClientServerOpSetAknIconCacheStatus: |
|
1428 { |
|
1429 TPckgBuf<TBool> enabled; |
|
1430 aMessage.ReadL(0, enabled); |
|
1431 |
|
1432 TInt64 savedAmount = iEngine.HelperRAM().SetAknIconCacheStatusL( enabled() ); |
|
1433 |
|
1434 TPckgBuf<TInt64> ret(savedAmount); |
|
1435 aMessage.WriteL(1, ret); |
|
1436 break; |
|
1437 } |
|
1438 |
|
1439 // Code Segments |
|
1440 case EMemSpyClientServerOpGetCodeSegmentsCount: |
|
1441 { |
|
1442 TInt result = 0; |
|
1443 |
|
1444 CMemSpyEngineCodeSegList* list = iEngine.HelperCodeSegment().CodeSegmentListL(); |
|
1445 CleanupStack::PushL( list ); |
|
1446 result = list->MdcaCount(); |
|
1447 aMessage.WriteL(0, TPckgBuf<TInt>(result)); |
|
1448 CleanupStack::Pop( list ); |
|
1449 break; |
|
1450 } |
|
1451 case EMemSpyClientServerOpGetSortedCodeSegments: |
|
1452 { |
|
1453 CMemSpyEngineCodeSegList* list = iEngine.HelperCodeSegment().CodeSegmentListL(); |
|
1454 CleanupStack::PushL( list ); |
|
1455 |
|
1456 TPckgBuf<TSortType> a2; |
|
1457 aMessage.ReadL( 2, a2 ); |
|
1458 |
|
1459 //sort the list of Code Segments |
|
1460 if( a2() == ESortCodeSegByName ) |
|
1461 list->SortByFileNameL(); |
|
1462 else if ( a2() == ESortCodeSegBySize ) |
|
1463 list->SortByCodeSizeL(); |
|
1464 else if ( a2() == ESortCodeSegByTotalDataSize ) |
|
1465 list->SortByDataSizeL(); |
|
1466 else |
|
1467 list->SortByUidsL(); |
|
1468 |
|
1469 TPckgBuf<TInt> a0; |
|
1470 aMessage.ReadL(0, a0); |
|
1471 |
|
1472 TInt realCount = Min(a0(), list->MdcaCount()); |
|
1473 |
|
1474 for(TInt i=0, offset = 0; i<realCount; i++, offset += sizeof(TMemSpyCodeSegmentData)) |
|
1475 { |
|
1476 const CMemSpyEngineCodeSegEntry& codeSegment = list->At(i); |
|
1477 TMemSpyCodeSegmentData data; |
|
1478 TCodeSegCreateInfo createInfo = codeSegment.CreateInfo(); |
|
1479 |
|
1480 data.iName.Copy( codeSegment.FileName() ); |
|
1481 data.iCodeSize = createInfo.iCodeSize; |
|
1482 data.iTotalDataSize = createInfo.iTotalDataSize; |
|
1483 data.iTextSize = createInfo.iTextSize; |
|
1484 data.iDataSize = createInfo.iDataSize; |
|
1485 data.iBssSize = createInfo.iBssSize; |
|
1486 data.iUids = createInfo.iUids; |
|
1487 data.iModuleVersion = createInfo.iModuleVersion; |
|
1488 data.iSecureId = createInfo.iS.iSecureId; |
|
1489 data.iVendorId = createInfo.iS.iVendorId; |
|
1490 data.iEntryPtVeneer = createInfo.iEntryPtVeneer; |
|
1491 data.iFileEntryPoint = createInfo.iFileEntryPoint; |
|
1492 data.iDepCount = createInfo.iDepCount; |
|
1493 data.iCodeLoadAddress = createInfo.iCodeLoadAddress; |
|
1494 data.iDataLoadAddress = createInfo.iDataLoadAddress; |
|
1495 data.iCapabilities1 = static_cast<TUint32>(createInfo.iS.iCaps[0]); |
|
1496 data.iCapabilities2 = static_cast<TUint32>(createInfo.iS.iCaps[1]); |
|
1497 |
|
1498 TPckgBuf<TMemSpyCodeSegmentData> buffer(data); |
|
1499 aMessage.WriteL(1, buffer, offset); |
|
1500 } |
|
1501 CleanupStack::PopAndDestroy( list ); |
|
1502 |
|
1503 break; |
|
1504 } |
|
1505 case EMemSpyClientServerOpCodeSegmentsOutput: |
|
1506 { |
|
1507 CMemSpyEngineCodeSegList* list = iEngine.HelperCodeSegment().CodeSegmentListL(); |
|
1508 CleanupStack::PushL( list ); |
|
1509 // Begin a new data stream |
|
1510 _LIT( KMemSpyContext, "CodeSeg List - " ); |
|
1511 _LIT( KMemSpyFolder, "CodeSegs" ); |
|
1512 iEngine.Sink().DataStreamBeginL( KMemSpyContext, KMemSpyFolder ); |
|
1513 |
|
1514 // Set prefix for overall listing |
|
1515 _LIT(KOverallPrefix, "CodeSeg List - "); |
|
1516 iEngine.Sink().OutputPrefixSetLC( KOverallPrefix ); |
|
1517 |
|
1518 // Create header |
|
1519 CMemSpyEngineCodeSegList::OutputDataColumnsL( iEngine ); |
|
1520 |
|
1521 // List items |
|
1522 const TInt count = list->Count(); |
|
1523 for(TInt i=0; i<count; i++) |
|
1524 { |
|
1525 const CMemSpyEngineCodeSegEntry& entry = list->At( i ); |
|
1526 // |
|
1527 entry.OutputDataL( iEngine.HelperCodeSegment() ); |
|
1528 } |
|
1529 |
|
1530 // Tidy up |
|
1531 CleanupStack::PopAndDestroy(); // prefix |
|
1532 |
|
1533 // End data stream |
|
1534 iEngine.Sink().DataStreamEndL(); |
|
1535 |
|
1536 // Tidy up Code segment list |
|
1537 CleanupStack::PopAndDestroy( list ); |
|
1538 |
|
1539 break; |
|
1540 } |
|
1541 |
|
1542 case EMemSpyClientServerOpNotifyEvent: |
|
1543 Server().NotificationTracker()->AddNotificationL( aMessage ); |
|
1544 break; |
|
1545 |
|
1546 case EMemSpyClientServerOpCancelEventNotification: |
|
1547 Server().NotificationTracker()->CancelNotification( aMessage ); |
|
1548 break; |
1300 |
1549 |
1301 |
1550 |
1302 } |
1551 } |
1303 } |
1552 } |
1304 |
1553 |
1856 } |
2105 } |
1857 |
2106 |
1858 } |
2107 } |
1859 |
2108 |
1860 } |
2109 } |
|
2110 |
|
2111 |
|
2112 |
|
2113 |
|
2114 |
|
2115 |
|
2116 |
|
2117 |
|
2118 |
|
2119 CMemSpyNotificationTracker* CMemSpyNotificationTracker::NewL() |
|
2120 { |
|
2121 CMemSpyNotificationTracker* self = new (ELeave) CMemSpyNotificationTracker(); |
|
2122 CleanupStack::PushL( self ); |
|
2123 self->ConstructL(); |
|
2124 CleanupStack::Pop( self ); |
|
2125 return self; |
|
2126 } |
|
2127 |
|
2128 CMemSpyNotificationTracker::~CMemSpyNotificationTracker() |
|
2129 { |
|
2130 delete iPendingNotifications; |
|
2131 } |
|
2132 |
|
2133 void CMemSpyNotificationTracker::ConstructL() |
|
2134 { |
|
2135 iPendingNotifications = new (ELeave) CArrayFixFlat<RMessage2>(3); |
|
2136 } |
|
2137 |
|
2138 void CMemSpyNotificationTracker::AddNotificationL( const RMessage2& aMessage ) |
|
2139 { |
|
2140 iPendingNotifications->AppendL(aMessage); |
|
2141 } |
|
2142 |
|
2143 void CMemSpyNotificationTracker::CancelNotification( const RMessage2& aMessage ) |
|
2144 { |
|
2145 for (TInt i = iPendingNotifications->Count()-1; i >= 0; --i) |
|
2146 { |
|
2147 if (iPendingNotifications->At( i ).Session() == aMessage.Session()) |
|
2148 { |
|
2149 iPendingNotifications->At( i ).Complete( KErrCancel ); |
|
2150 iPendingNotifications->Delete( i ); |
|
2151 } |
|
2152 } |
|
2153 } |
|
2154 |
|
2155 void CMemSpyNotificationTracker::HandleMemSpyEngineEventL( TEvent aEvent, TAny* aContext ) |
|
2156 { |
|
2157 switch( aEvent ) |
|
2158 { |
|
2159 |
|
2160 case MMemSpyEngineObserver::EHandleThreadsOrProcessesChanged: |
|
2161 { |
|
2162 for (TInt i=0; i<iPendingNotifications->Count(); i++) |
|
2163 { |
|
2164 TRAPD(err, iPendingNotifications->At(i).WriteL(0, TPckgBuf<TInt>( aEvent ))); |
|
2165 if (err != KErrNone) |
|
2166 { |
|
2167 // TODO: iPendingProgressNotifications->At(i).Panic() |
|
2168 } |
|
2169 iPendingNotifications->At(i).Complete( KErrNone ); |
|
2170 } |
|
2171 iPendingNotifications->Reset(); |
|
2172 break; |
|
2173 } |
|
2174 |
|
2175 } |
|
2176 |
|
2177 } |