|
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 "MemSpyEngineHelperSysMemTrackerEntryRamDrive.h" |
|
19 |
|
20 // System includes |
|
21 #include <e32base.h> |
|
22 #include <badesca.h> |
|
23 |
|
24 // Driver includes |
|
25 #include <memspy/driver/memspydriverclient.h> |
|
26 |
|
27 // User includes |
|
28 #include <memspy/engine/memspyengine.h> |
|
29 #include <memspy/engine/memspyengineutils.h> |
|
30 #include <memspy/engine/memspyengineoutputsink.h> |
|
31 #include <memspy/engine/memspyengineoutputlist.h> |
|
32 #include <memspy/engine/memspyenginehelperheap.h> |
|
33 #include <memspy/engine/memspyenginehelperchunk.h> |
|
34 #include <memspy/engine/memspyengineobjectthread.h> |
|
35 #include <memspy/engine/memspyengineobjectprocess.h> |
|
36 #include <memspy/engine/memspyengineobjectcontainer.h> |
|
37 #include <memspy/engine/memspyenginehelpercodesegment.h> |
|
38 #include "MemSpyEngineHelperSysMemTrackerImp.h" |
|
39 #include <memspy/engine/memspyenginehelpersysmemtrackercycle.h> |
|
40 #include <memspy/engine/memspyenginehelpersysmemtrackerconfig.h> |
|
41 |
|
42 |
|
43 |
|
44 |
|
45 |
|
46 CMemSpyEngineHelperSysMemTrackerEntryRamDrive::CMemSpyEngineHelperSysMemTrackerEntryRamDrive( CMemSpyEngineHelperSysMemTrackerImp& aTracker ) |
|
47 : CMemSpyEngineHelperSysMemTrackerEntry( aTracker, EMemSpyEngineSysMemTrackerTypeRamDrive ) |
|
48 { |
|
49 } |
|
50 |
|
51 |
|
52 CMemSpyEngineHelperSysMemTrackerEntryRamDrive::~CMemSpyEngineHelperSysMemTrackerEntryRamDrive() |
|
53 { |
|
54 } |
|
55 |
|
56 |
|
57 void CMemSpyEngineHelperSysMemTrackerEntryRamDrive::ConstructL( const TMemSpyDriverChunkInfo& aInfo ) |
|
58 { |
|
59 iCurrent = aInfo; |
|
60 iLast = aInfo; |
|
61 // |
|
62 SetHandle( aInfo.iHandle ); |
|
63 } |
|
64 |
|
65 |
|
66 CMemSpyEngineHelperSysMemTrackerEntryRamDrive* CMemSpyEngineHelperSysMemTrackerEntryRamDrive::NewLC( CMemSpyEngineHelperSysMemTrackerImp& aTracker, const TMemSpyDriverChunkInfo& aInfo ) |
|
67 { |
|
68 CMemSpyEngineHelperSysMemTrackerEntryRamDrive* self = new(ELeave) CMemSpyEngineHelperSysMemTrackerEntryRamDrive( aTracker ); |
|
69 CleanupStack::PushL( self ); |
|
70 self->ConstructL( aInfo ); |
|
71 return self; |
|
72 } |
|
73 |
|
74 |
|
75 void CMemSpyEngineHelperSysMemTrackerEntryRamDrive::UpdateFromL( const CMemSpyEngineHelperSysMemTrackerEntry& aEntry ) |
|
76 { |
|
77 const CMemSpyEngineHelperSysMemTrackerEntryRamDrive& entry = static_cast< const CMemSpyEngineHelperSysMemTrackerEntryRamDrive& >( aEntry ); |
|
78 |
|
79 // Update state |
|
80 iLast = iCurrent; |
|
81 iCurrent = entry.iCurrent; |
|
82 } |
|
83 |
|
84 |
|
85 TBool CMemSpyEngineHelperSysMemTrackerEntryRamDrive::HasChangedL( const TMemSpyEngineHelperSysMemTrackerConfig& /*aConfig*/ ) const |
|
86 { |
|
87 const TBool hasChanged = ( iCurrent.iSize != iLast.iSize ); |
|
88 return hasChanged; |
|
89 } |
|
90 |
|
91 |
|
92 void CMemSpyEngineHelperSysMemTrackerEntryRamDrive::CreateChangeDescriptorL( CMemSpyEngineHelperSysMemTrackerCycle& aCycle ) |
|
93 { |
|
94 CMemSpyEngineHelperSysMemTrackerCycleChangeRamDrive* changeDescriptor = CMemSpyEngineHelperSysMemTrackerCycleChangeRamDrive::NewLC( Attributes(), iCurrent, IsNew() ? NULL : &iLast ); |
|
95 aCycle.AddAndPopL( changeDescriptor ); |
|
96 } |
|
97 |
|
98 |
|
99 void CMemSpyEngineHelperSysMemTrackerEntryRamDrive::UpdateCycleStatistics( CMemSpyEngineHelperSysMemTrackerCycle& aCycle ) |
|
100 { |
|
101 aCycle.AddToMemoryUsed( iCurrent.iSize ); |
|
102 } |
|
103 |
|
104 |
|
105 |
|
106 |
|
107 |
|
108 |
|
109 |
|
110 |
|
111 |
|
112 |
|
113 |
|
114 |
|
115 |
|
116 |
|
117 |
|
118 |
|
119 |
|
120 |
|
121 |
|
122 |
|
123 |
|
124 |
|
125 |
|
126 |
|
127 |
|
128 |
|
129 |
|
130 |
|
131 |
|
132 |
|
133 |
|
134 |
|
135 |
|
136 |
|
137 CMemSpyEngineHelperSysMemTrackerCycleChangeRamDrive::CMemSpyEngineHelperSysMemTrackerCycleChangeRamDrive( TUint8 aAttribs, const TMemSpyDriverChunkInfo& aCurrent ) |
|
138 : CMemSpyEngineHelperSysMemTrackerCycleChange( aAttribs ), iCurrent( aCurrent ) |
|
139 { |
|
140 } |
|
141 |
|
142 |
|
143 CMemSpyEngineHelperSysMemTrackerCycleChangeRamDrive::~CMemSpyEngineHelperSysMemTrackerCycleChangeRamDrive() |
|
144 { |
|
145 delete iLast; |
|
146 } |
|
147 |
|
148 |
|
149 void CMemSpyEngineHelperSysMemTrackerCycleChangeRamDrive::ConstructL( const TMemSpyDriverChunkInfo* aLast ) |
|
150 { |
|
151 BaseConstructL(); |
|
152 |
|
153 // Save last heap data (if available) |
|
154 if ( aLast ) |
|
155 { |
|
156 iLast = new (ELeave) TMemSpyDriverChunkInfo(); |
|
157 *iLast = *aLast; |
|
158 } |
|
159 } |
|
160 |
|
161 |
|
162 CMemSpyEngineHelperSysMemTrackerCycleChangeRamDrive* CMemSpyEngineHelperSysMemTrackerCycleChangeRamDrive::NewLC( TUint8 aAttribs, const TMemSpyDriverChunkInfo& aCurrent, const TMemSpyDriverChunkInfo* aLast ) |
|
163 { |
|
164 CMemSpyEngineHelperSysMemTrackerCycleChangeRamDrive* self = new(ELeave) CMemSpyEngineHelperSysMemTrackerCycleChangeRamDrive( aAttribs, aCurrent ); |
|
165 CleanupStack::PushL( self ); |
|
166 self->ConstructL( aLast ); |
|
167 return self; |
|
168 } |
|
169 |
|
170 |
|
171 TMemSpyEngineSysMemTrackerType CMemSpyEngineHelperSysMemTrackerCycleChangeRamDrive::Type() const |
|
172 { |
|
173 return EMemSpyEngineSysMemTrackerTypeRamDrive; |
|
174 } |
|
175 |
|
176 |
|
177 void CMemSpyEngineHelperSysMemTrackerCycleChangeRamDrive::OutputHeaderL( CMemSpyEngineOutputSink& aSink, CMemSpyEngineHelperSysMemTrackerCycle& /*aCycle*/ ) |
|
178 { |
|
179 _LIT( KHeaderRamDrive, "Type, Chunk, Handle, Base Addr, Size, Max Size, Attribs"); |
|
180 aSink.OutputLineL( KHeaderRamDrive ); |
|
181 } |
|
182 |
|
183 |
|
184 void CMemSpyEngineHelperSysMemTrackerCycleChangeRamDrive::OutputContentL( CMemSpyEngineOutputSink& aSink, CMemSpyEngineHelperSysMemTrackerCycle& /*aCycle*/ ) |
|
185 { |
|
186 _LIT( KFormat, "%S,%S,0x%08x,0x%08x,%d,%d,%S" ); |
|
187 // |
|
188 TMemSpySWMTTypeName type;; |
|
189 FormatType( type ); |
|
190 // |
|
191 TBuf<20> attribs; |
|
192 FormatAttributes( attribs ); |
|
193 // |
|
194 HBufC* buf = HBufC::NewLC( 1024 ); |
|
195 TPtr pBuf(buf->Des()); |
|
196 |
|
197 // Now output line |
|
198 pBuf.Format( KFormat, |
|
199 &type, |
|
200 &iCurrent.iName, |
|
201 iCurrent.iHandle, |
|
202 iCurrent.iBaseAddress, |
|
203 iCurrent.iSize, |
|
204 iCurrent.iMaxSize, |
|
205 &attribs |
|
206 ); |
|
207 |
|
208 aSink.OutputLineL( pBuf ); |
|
209 CleanupStack::PopAndDestroy( buf ); |
|
210 } |
|
211 |
|
212 |