19 |
19 |
20 // System includes |
20 // System includes |
21 #include <bacline.h> |
21 #include <bacline.h> |
22 #include <bautils.h> |
22 #include <bautils.h> |
23 #include <memspyengineclientinterface.h> |
23 #include <memspyengineclientinterface.h> |
|
24 #include <memspysession.h> |
24 #include <memspy/engine/memspyenginehelpersysmemtrackerconfig.h> |
25 #include <memspy/engine/memspyenginehelpersysmemtrackerconfig.h> |
25 |
26 |
26 // User includes |
27 // User includes |
27 #include "MemSpyCommands.h" |
28 #include "MemSpyCommands.h" |
28 |
29 |
29 |
30 /* |
30 CMemSpyCommandLine::CMemSpyCommandLine() |
31 CMemSpyCommandLine::CMemSpyCommandLine() |
31 { |
32 { |
32 } |
33 } |
33 |
34 */ |
|
35 |
|
36 CMemSpyCommandLine::CMemSpyCommandLine( CConsoleBase& aConsole ) |
|
37 : CActive( EPriorityHigh ), iConsole( aConsole ) |
|
38 { |
|
39 CActiveScheduler::Add( this ); |
|
40 } |
34 |
41 |
35 CMemSpyCommandLine::~CMemSpyCommandLine() |
42 CMemSpyCommandLine::~CMemSpyCommandLine() |
36 { |
43 { |
37 if ( iMemSpy ) |
44 Cancel(); |
38 { |
45 |
39 iMemSpy->Close(); |
46 if ( iMemSpySession ) |
40 } |
47 { |
41 delete iMemSpy; |
48 iMemSpySession->Close(); |
|
49 } |
|
50 delete iMemSpySession; |
42 iFsSession.Close(); |
51 iFsSession.Close(); |
43 } |
52 } |
44 |
53 |
45 |
54 |
46 void CMemSpyCommandLine::ConstructL() |
55 void CMemSpyCommandLine::ConstructL() |
47 { |
56 { |
48 User::LeaveIfError( iFsSession.Connect() ); |
57 User::LeaveIfError( iFsSession.Connect() ); |
49 iMemSpy = new(ELeave) RMemSpyEngineClientInterface(); |
58 iMemSpySession = new(ELeave) RMemSpySession(); |
50 ConnectToMemSpyL(); |
59 ConnectToMemSpyL(); |
51 } |
60 } |
52 |
61 |
53 |
62 CMemSpyCommandLine* CMemSpyCommandLine::NewLC( CConsoleBase& aConsole ) |
54 CMemSpyCommandLine* CMemSpyCommandLine::NewLC() |
63 { |
55 { |
64 CMemSpyCommandLine* self = new(ELeave) CMemSpyCommandLine( aConsole ); |
56 CMemSpyCommandLine* self = new(ELeave) CMemSpyCommandLine(); |
|
57 CleanupStack::PushL( self ); |
65 CleanupStack::PushL( self ); |
58 self->ConstructL(); |
66 self->ConstructL(); |
59 return self; |
67 return self; |
60 } |
68 } |
61 |
|
62 |
|
63 void CMemSpyCommandLine::PerformBatchL( const TDesC& aFileName ) |
|
64 { |
|
65 TInt err = KErrNone; |
|
66 RFile file; |
|
67 err = file.Open( iFsSession, aFileName, EFileRead ); |
|
68 TRACE( RDebug::Print( _L("[MemSpyCmdLine] CMemSpyCommandLine::PerformBatchL() - START - this: 0x%08x, openErr: %d, fileName: %S"), this, err, &aFileName ) ); |
|
69 User::LeaveIfError( err ); |
|
70 |
|
71 CleanupClosePushL( file ); |
|
72 CDesCArray* lines = ReadLinesL( file ); |
|
73 CleanupStack::PopAndDestroy( &file ); |
|
74 CleanupStack::PushL( lines ); |
|
75 |
|
76 const TInt count = lines->Count(); |
|
77 TRACE( RDebug::Printf( "[MemSpyCmdLine] CMemSpyCommandLine::PerformOpL() - got %d lines", count ) ); |
|
78 iIsBatch = ETrue; |
|
79 for( TInt i=0; i<count; i++ ) |
|
80 { |
|
81 const TPtrC pLine( (*lines)[ i ] ); |
|
82 TRACE( RDebug::Print( _L("[MemSpyCmdLine] CMemSpyCommandLine::PerformOpL() - processing line[%03d] \"%S\""), i, &pLine ) ); |
|
83 |
|
84 // Must be at least 3 chars big, i.e. '[' and <command> and then ']' |
|
85 if ( pLine.Length() <= 2 || pLine[ 0 ] != '[' ) |
|
86 { |
|
87 TRACE( RDebug::Print( _L("[MemSpyCmdLine] CMemSpyCommandLine::PerformOpL() - ignoring line: \"%S\""), &pLine ) ); |
|
88 } |
|
89 else if ( pLine[0] == '[' ) |
|
90 { |
|
91 // Try to find end of command... |
|
92 const TInt posOfClosingArgChar = pLine.Locate( ']' ); |
|
93 if ( posOfClosingArgChar >= 2 ) |
|
94 { |
|
95 // Get command |
|
96 const TPtrC pCommand( pLine.Mid( 1, posOfClosingArgChar - 1 ) ); |
|
97 TRACE( RDebug::Print( _L("[MemSpyCmdLine] CMemSpyCommandLine::PerformOpL() - got command: %S"), &pCommand ) ); |
|
98 |
|
99 // Next, try to get any args |
|
100 CDesCArrayFlat* args = new(ELeave) CDesCArrayFlat( 2 ); |
|
101 CleanupStack::PushL( args ); |
|
102 |
|
103 // There must be a mandatory space between closing ] and start of args... |
|
104 // E.g.: |
|
105 // |
|
106 // [CMD] ARG |
|
107 // |
|
108 const TInt remainderLength = pLine.Length() - posOfClosingArgChar; |
|
109 if ( remainderLength > 1 ) |
|
110 { |
|
111 const TPtrC remainder( pLine.Mid( posOfClosingArgChar + 1 ) ); |
|
112 TRACE( RDebug::Print( _L("[MemSpyCmdLine] CMemSpyCommandLine::PerformOpL() - got remainder: %S"), &pLine ) ); |
|
113 |
|
114 // Extract arguments separated by tabs or space characters |
|
115 // and store in arguments array |
|
116 HBufC* argText = HBufC::NewLC( pLine.Length() + 1 ); |
|
117 TPtr pArgText( argText->Des() ); |
|
118 for( TInt j=0; j<remainder.Length(); j++ ) |
|
119 { |
|
120 const TChar c( remainder[ j ] ); |
|
121 // |
|
122 if ( c == '\t' || c == ' ' ) |
|
123 { |
|
124 pArgText.Trim(); |
|
125 if ( pArgText.Length() ) |
|
126 { |
|
127 TRACE( RDebug::Print( _L("[MemSpyCmdLine] CMemSpyCommandLine::PerformOpL() - arg[%02d] %S"), args->Count(), &pArgText ) ); |
|
128 args->AppendL( pArgText ); |
|
129 pArgText.Zero(); |
|
130 } |
|
131 } |
|
132 else |
|
133 { |
|
134 pArgText.Append( c ); |
|
135 } |
|
136 } |
|
137 |
|
138 // Save leftovers... |
|
139 pArgText.Trim(); |
|
140 if ( pArgText.Length() ) |
|
141 { |
|
142 TRACE( RDebug::Print( _L("[MemSpyCmdLine] CMemSpyCommandLine::PerformOpL() - arg[%02d] %S"), args->Count(), &pArgText ) ); |
|
143 args->AppendL( pArgText ); |
|
144 } |
|
145 |
|
146 CleanupStack::PopAndDestroy( argText ); |
|
147 } |
|
148 |
|
149 // Now we can perform the operation! |
|
150 PerformSingleOpL( pCommand, *args ); |
|
151 |
|
152 CleanupStack::PopAndDestroy( args ); |
|
153 } |
|
154 } |
|
155 |
|
156 TRACE( RDebug::Print( _L("[MemSpyCmdLine] CMemSpyCommandLine::PerformOpL() - processing line: \"%S\""), &pLine ) ); |
|
157 } |
|
158 |
|
159 iIsBatch = EFalse; |
|
160 |
|
161 CleanupStack::PopAndDestroy( lines ); |
|
162 TRACE( RDebug::Print( _L("[MemSpyCmdLine] CMemSpyCommandLine::PerformBatchL() - END - this: 0x%08x, fileName: %S"), this, &aFileName ) ); |
|
163 } |
|
164 |
|
165 |
69 |
166 void CMemSpyCommandLine::PerformOpL( const CCommandLineArguments& aCommandLine ) |
70 void CMemSpyCommandLine::PerformOpL( const CCommandLineArguments& aCommandLine ) |
167 { |
71 { |
168 const TInt count = aCommandLine.Count(); |
72 const TInt count = aCommandLine.Count(); |
169 TRACE( RDebug::Printf( "[MemSpyCmdLine] CMemSpyCommandLine::PerformOpL() - START - arg count: %d, this: 0x%08x", count, this ) ); |
73 TRACE( RDebug::Printf( "[MemSpyCmdLine] CMemSpyCommandLine::PerformOpL() - START - arg count: %d, this: 0x%08x", count, this ) ); |
216 |
120 |
217 TFileName batchFile; |
121 TFileName batchFile; |
218 batchFile.Append( aCommand ); |
122 batchFile.Append( aCommand ); |
219 |
123 |
220 TInt err = KErrNotSupported; |
124 TInt err = KErrNotSupported; |
221 if ( aCommand.CompareF( KMemSpyCmdSWMTForceUpdate ) == 0 ) |
125 TInt error = KErrNotSupported; |
222 { |
126 |
223 TRACE( RDebug::Printf( "[MemSpyCmdLine] CMemSpyCommandLine::PerformSingleOpL() - this: 0x%08x - SWMT_ForceUpdate", this ) ); |
127 // --- HELP |
224 if ( paramCount > 0 ) |
128 if ( aCommand.CompareF( KMemSpyCmdHelp1) == 0 || |
225 { |
129 aCommand.CompareF( KMemSpyCmdHelp2) == 0 || |
226 TInt categories( 0 ); |
130 aCommand.CompareF( KMemSpyCmdHelp3) == 0 || |
227 TName threadNameFilter; |
131 aCommand.CompareF( KMemSpyCmdHelp4) == 0 ) |
228 TRAP( err, ParseSWMTParametersL( aParameters, categories, threadNameFilter ) ); |
132 { |
229 if ( !err ) |
133 iConsole.Write( KHelpMessage ); |
230 { |
134 iConsole.Write( KMemSpyCLINewLine ); |
231 err = iMemSpy->SystemWideMemoryTrackerCategoriesSet( categories ); |
135 iConsole.Write( KHelpOutputCommand ); |
232 if ( !err && threadNameFilter.Length() > 0 ) |
136 iConsole.Write( KHelpOutputToFileCommand ); |
233 { |
137 iConsole.Write( KHelpHeapDumpCommand ); |
234 err = iMemSpy->SystemWideMemoryTrackerThreadFilterSet( threadNameFilter ); |
138 iConsole.Write( KHelpSwmtCommand ); |
235 } |
139 iConsole.Write( KHelpKillServerCommand ); |
236 } |
140 iConsole.Write( KMemSpyCLINewLine ); |
237 } |
141 iConsole.Write( KHelpCommand ); |
238 if ( !err ) |
142 |
239 { |
143 // Show input prompt. |
240 err = iMemSpy->PerformOperation( EMemSpyClientServerOpSystemWideMemoryTrackingForceUpdate ); |
144 iCommandPromptPos = iConsole.CursorPos(); |
241 } |
145 RedrawInputPrompt(); |
242 } |
146 WaitForInput(); |
243 else if ( aCommand.CompareF( KMemSpyCmdSWMTReset ) == 0 ) |
147 |
244 { |
148 CActiveScheduler::Start(); |
245 TRACE( RDebug::Printf( "[MemSpyCmdLine] CMemSpyCommandLine::PerformSingleOpL() - this: 0x%08x - SWMT_Reset", this ) ); |
149 } |
246 err = iMemSpy->PerformOperation( EMemSpyClientServerOpSystemWideMemoryTrackingReset ); |
150 // --- OUTPUT |
247 } |
151 //TODO: directory option to be added |
248 else if ( aCommand.CompareF( KMemSpyCmdHeapDumpKernel ) == 0 ) |
152 else if ( aCommand.CompareF( KMemSpyCmdOutput ) == 0 ) //change output mode |
249 { |
153 { |
250 TRACE( RDebug::Printf( "[MemSpyCmdLine] CMemSpyCommandLine::PerformSingleOpL() - this: 0x%08x - Heap_DumpKernel", this ) ); |
154 if( paramCount >= 1 ) |
251 err = iMemSpy->PerformOperation( EMemSpyClientServerOpHeapData, KMemSpyClientServerThreadIdKernel ); |
155 { |
252 } |
156 if( aParameters[0].CompareF( KMemSpyCmdOutputParameterFile ) == 0 ) |
253 else if ( aCommand.CompareF( KMemSpyCmdHeapCompact ) == 0 ) |
157 { |
254 { |
158 if( paramCount == 2 ) |
255 TRACE( RDebug::Printf( "[MemSpyCmdLine] CMemSpyCommandLine::PerformSingleOpL() - this: 0x%08x - Heap_Compact", this ) ); |
159 { |
256 err = iMemSpy->PerformOperation( EMemSpyClientServerOpHeapInfoCompact ); |
160 TBuf<KMaxFileName> directory; |
257 } |
161 directory.Copy( aParameters[1] ); |
258 else if ( aCommand.CompareF( KMemSpyCmdContainer ) == 0 ) |
162 iMemSpySession->SwitchOutputToFileL( directory ); |
259 { |
163 } |
260 TRACE( RDebug::Printf( "[MemSpyCmdLine] CMemSpyCommandLine::PerformSingleOpL() - this: 0x%08x - Container", this ) ); |
164 else |
261 err = iMemSpy->PerformOperation( EMemSpyClientServerOpEnumerateKernelContainerAll ); |
165 { |
262 } |
166 iMemSpySession->SwitchOutputToFileL( KNullDesC ); |
263 else if ( aCommand.CompareF( KMemSpyCmdBitmapsSave ) == 0 ) |
167 } |
264 { |
168 } |
265 TRACE( RDebug::Printf( "[MemSpyCmdLine] CMemSpyCommandLine::PerformSingleOpL() - this: 0x%08x - Bitmaps_Save", this ) ); |
169 else if( aParameters[0].CompareF( KMemSpyCmdOutputParameterTrace ) == 0) |
266 err = iMemSpy->SaveAllBitmaps(); |
170 { |
267 } |
171 TRACE( RDebug::Printf( "[MemSpyCmdLine] CMemSpyCommandLine::PerformSingleOpL() - this: 0x%08x - Output Trace", this ) ); |
268 else if ( aCommand.CompareF( KMemSpyCmdRamDisableAknIconCache ) == 0 ) |
172 iMemSpySession->SwitchOutputToTraceL(); |
269 { |
173 } |
270 TRACE( RDebug::Printf( "[MemSpyCmdLine] CMemSpyCommandLine::PerformSingleOpL() - this: 0x%08x - Ram_DisableAknIconCache", this ) ); |
174 } |
271 err = iMemSpy->DisableAknIconCache(); |
175 } |
272 } |
176 // --- HEAP DUMP |
273 else if ( aCommand.CompareF( KMemSpyCmdOutputToFile ) == 0 ) |
177 else if ( aCommand.CompareF( KMemSpyCmdHeapDump) == 0 ) |
274 { |
178 { |
275 TRACE( RDebug::Printf( "[MemSpyCmdLine] CMemSpyCommandLine::PerformSingleOpL() - this: 0x%08x - Output_ToFile", this ) ); |
179 RedrawStatusMessage( KHeapDumpMessage ); |
276 err = iMemSpy->SwitchOutputModeFile(); |
180 |
277 } |
181 if( paramCount == 0 ) // no parameter - dump all heap data + kernel heap at the end |
278 else if ( aCommand.CompareF( KMemSpyCmdOutputToTrace ) == 0 ) |
182 { |
279 { |
183 |
280 TRACE( RDebug::Printf( "[MemSpyCmdLine] CMemSpyCommandLine::PerformSingleOpL() - this: 0x%08x - Output_ToTrace", this ) ); |
184 TRACE( RDebug::Printf( "[MemSpyCmdLine] CMemSpyCommandLine::PerformSingleOpL() - this: 0x%08x - Heap_Dump (all threads)", this ) ); |
281 err = iMemSpy->SwitchOutputModeTrace(); |
185 // Dump heap data for all threads - Thread agnostic operation |
282 } |
186 iMemSpySession->OutputHeapData(); |
283 else if ( aCommand.CompareF( KMemSpyCmdUiSendToBackground ) == 0 ) |
187 // Dump kernel heap data |
284 { |
188 iMemSpySession->OutputThreadHeapDataL( KMemSpyClientServerThreadIdKernel ); |
285 TRACE( RDebug::Printf( "[MemSpyCmdLine] CMemSpyCommandLine::PerformSingleOpL() - this: 0x%08x - UI_Background", this ) ); |
189 } |
286 err = iMemSpy->SendToBackground(); |
190 else if( paramCount >= 1) |
287 } |
191 { |
288 else if ( aCommand.CompareF( KMemSpyCmdUiBringToForeground ) == 0 ) |
192 if( aParameters[0].CompareF( KMemSpyCmdHeapDumpParameterAll ) == 0 ) |
289 { |
193 { |
290 TRACE( RDebug::Printf( "[MemSpyCmdLine] CMemSpyCommandLine::PerformSingleOpL() - this: 0x%08x - UI_Foreground", this ) ); |
194 iMemSpySession->OutputHeapData(); |
291 err = iMemSpy->BringToForeground(); |
195 iMemSpySession->OutputThreadHeapDataL( KMemSpyClientServerThreadIdKernel ); |
292 } |
196 } |
293 else if ( aCommand.CompareF( KMemSpyCmdUiExit ) == 0 ) |
197 else if( aParameters[0].CompareF( KMemSpyCmdHeapDumpParameterKernel ) == 0 ) |
294 { |
198 { |
295 TRACE( RDebug::Printf( "[MemSpyCmdLine] CMemSpyCommandLine::PerformSingleOpL() - this: 0x%08x - UI_Exit", this ) ); |
199 TRACE( RDebug::Printf( "[MemSpyCmdLine] CMemSpyCommandLine::PerformSingleOpL() - this: 0x%08x - Heap_DumpKernel", this ) ); |
296 err = iMemSpy->Exit(); |
200 iMemSpySession->OutputThreadHeapDataL( KMemSpyClientServerThreadIdKernel ); |
297 } |
201 } |
298 else if ( aCommand.CompareF( KMemSpyCmdHeapDump ) == 0 ) |
202 else |
299 { |
203 { |
300 if ( paramCount == 0 ) |
204 // Dump heap data for named thread - filter |
301 { |
205 const TPtrC pThreadName( aParameters[0] ); |
302 // Dump heap data for all threads |
206 TRACE( RDebug::Print( _L("[MemSpyCmdLine] CMemSpyCommandLine::PerformSingleOpL() - this: 0x%08x - Heap_Dump (%S)"), this, &pThreadName ) ); |
303 TRACE( RDebug::Printf( "[MemSpyCmdLine] CMemSpyCommandLine::PerformSingleOpL() - this: 0x%08x - Heap_Dump (all threads)", this ) ); |
207 iMemSpySession->OutputThreadHeapDataL( pThreadName ); |
304 err = iMemSpy->PerformOperation( EMemSpyClientServerOpHeapData ); |
208 } |
305 } |
209 } |
306 else if ( paramCount >= 1 ) |
210 } |
307 { |
211 |
308 // Dump heap data for named thread |
212 // --- SYSTEM WIDE MEMORY TRACKING |
309 const TPtrC pThreadName( aParameters[ 0 ] ); |
213 else if( aCommand.CompareF( KMemSpyCmdSwmt ) == 0 ) |
310 TRACE( RDebug::Print( _L("[MemSpyCmdLine] CMemSpyCommandLine::PerformSingleOpL() - this: 0x%08x - Heap_Dump (%S)"), this, &pThreadName ) ); |
214 { |
311 err = iMemSpy->PerformOperation( EMemSpyClientServerOpHeapData, pThreadName ); |
215 RedrawStatusMessage( KSWMTMessage ); |
312 } |
216 |
313 } |
217 TInt categories( 0 ); |
314 else if ( aCommand.CompareF( KMemSpyCmdOpenFile ) == 0 ) |
218 TName threadNameFilter; |
315 { |
219 |
316 if ( paramCount == 0 ) |
220 if( paramCount == 0 ) //default state -> "dumpnow" command with "all" categories |
317 { |
221 { |
318 // Dump heap data for all threads |
222 TRACE( RDebug::Printf( "[MemSpyCmdLine] CMemSpyCommandLine::PerformSingleOpL() - this: 0x%08x - dumpnow command", this ) ); |
319 TRACE( RDebug::Printf( "[MemSpyCmdLine] CMemSpyCommandLine::PerformSingleOpL() - this: 0x%08x - OpenFile (all threads)", this ) ); |
223 TInt category = TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryAll; |
320 err = iMemSpy->PerformOperation( EMemSpyClientServerOpOpenFiles ); |
224 iMemSpySession->SetSwmtCategoriesL( category ); |
321 } |
225 iMemSpySession->ForceSwmtUpdateL(); |
322 else if ( paramCount >= 1 ) |
226 } |
323 { |
227 else if( paramCount >= 1) |
324 // Dump heap data for named thread |
228 { |
325 const TPtrC pThreadName( aParameters[ 0 ] ); |
229 const TPtrC pParam( aParameters[0] ); |
326 TRACE( RDebug::Print( _L("[MemSpyCmdLine] CMemSpyCommandLine::PerformSingleOpL() - this: 0x%08x - OpenFile (%S)"), this, &pThreadName ) ); |
230 if( pParam.CompareF( KMemSpyCmdSwmtParameterStarttimer) == 0 ) // "starttimer" - start tracking |
327 err = iMemSpy->PerformOperation( EMemSpyClientServerOpOpenFiles, pThreadName ); |
231 { |
328 } |
232 TInt result(0); |
329 } |
233 categories = TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryAll; |
330 else if ( !iIsBatch && FindBatchFile( batchFile ) == KErrNone ) |
234 iMemSpySession->SetSwmtTimerIntervalL( KMemSpySysMemTrackerConfigMinTimerPeriod ); |
331 { |
235 |
332 TRACE( RDebug::Print( _L("[MemSpyCmdLine] CMemSpyCommandLine::PerformSingleOpL() - this: 0x%08x - Batch file: %S"), this, &batchFile ) ); |
236 if( paramCount >= 2 ) // user gave some optional parameters - <categories> or <value in seconds> |
333 PerformBatchL( batchFile ); |
237 { |
334 } |
238 TLex lex( aParameters[1] ); |
335 else |
239 if ( lex.Val( result ) == KErrNone ) //if 2nd parameter is not number, then parse parameters |
336 { |
240 { |
337 TRACE( RDebug::Print( _L("[MemSpyCmdLine] CMemSpyCommandLine::PerformSingleOpL() - this: 0x%08x - Unsupported Command: %S"), this, &aCommand ) ); |
241 if( result >= KMemSpySysMemTrackerConfigMinTimerPeriod && result <= KMemSpySysMemTrackerConfigMaxTimerPeriod ) |
338 } |
242 { |
339 |
243 iMemSpySession->SetSwmtTimerIntervalL( result ); ; |
|
244 } |
|
245 } |
|
246 TRAP( err, ParseSWMTParametersL( aParameters, categories, threadNameFilter) ); |
|
247 } |
|
248 |
|
249 //if( !err ) |
|
250 // { |
|
251 /* |
|
252 _LIT( KPressS, "Press 's' to stop the timer " ); |
|
253 iConsole.Write( KPressS ); |
|
254 |
|
255 iCommandPromptPos = iConsole.CursorPos(); |
|
256 RedrawInputPrompt(); |
|
257 WaitForInput(); |
|
258 */ |
|
259 |
|
260 iMemSpySession->StartSwmtTimerL(); |
|
261 |
|
262 //CActiveScheduler::Start(); |
|
263 // } |
|
264 } |
|
265 else if( pParam.CompareF( KMemSpyCmdSwmtParameterStoptimer) == 0 ) // "stoptime" - stop tracking |
|
266 { |
|
267 iMemSpySession->StopSwmtTimerL(); |
|
268 } |
|
269 else if( pParam.CompareF( KMemSpyCmdSwmtParameterDumpnow ) == 0 ) // "dumpnow" - runs one tracking cycle (CmdSWMT_ForceUpdate before) |
|
270 { |
|
271 categories = TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryAll; |
|
272 if( paramCount >= 2 ) // user gave some optional parameters - <categories> |
|
273 { |
|
274 TRAP( err, ParseSWMTParametersL( aParameters, categories, threadNameFilter) ); |
|
275 } |
|
276 |
|
277 if( !err ) |
|
278 { |
|
279 iMemSpySession->SetSwmtCategoriesL( categories ); |
|
280 iMemSpySession->ForceSwmtUpdateL(); |
|
281 } |
|
282 } |
|
283 else //no parameters ("starttimer / stoptimer / dumpnow"), just categories / thread filter |
|
284 //so dumpnow is used as default with category / thread specified |
|
285 { |
|
286 TRAP( err, ParseSWMTParametersL( aParameters, categories, threadNameFilter) ); |
|
287 if( !err ) |
|
288 { |
|
289 iMemSpySession->SetSwmtCategoriesL( categories ); |
|
290 if( threadNameFilter.Length() > 0 ) |
|
291 { |
|
292 iMemSpySession->SetSwmtFilter( threadNameFilter ); |
|
293 } |
|
294 } |
|
295 iMemSpySession->ForceSwmtUpdateL(); |
|
296 } |
|
297 } |
|
298 } |
|
299 // --- KILL SERVER |
|
300 else if ( aCommand.CompareF( KMemSpyCmdKillServer ) == 0 ) |
|
301 { |
|
302 } |
|
303 |
|
304 // RedrawStatusMessage(); |
|
305 |
340 TRACE( RDebug::Print( _L("[MemSpyCmdLine] CMemSpyCommandLine::PerformSingleOpL() - END - err: %d, this: 0x%08x, cmd: %S" ), err, this, &aCommand ) ); |
306 TRACE( RDebug::Print( _L("[MemSpyCmdLine] CMemSpyCommandLine::PerformSingleOpL() - END - err: %d, this: 0x%08x, cmd: %S" ), err, this, &aCommand ) ); |
341 |
307 |
342 // Calculate duration |
308 // Calculate duration |
343 TTime timeEnd; |
309 TTime timeEnd; |
344 timeEnd.HomeTime(); |
310 timeEnd.HomeTime(); |