51
|
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 |
|
|
19 |
#include "memspysession.h"
|
|
20 |
|
|
21 |
#include <memspyengineclientinterface.h>
|
|
22 |
// API
|
|
23 |
#include <memspy/engine/memspyprocessdata.h>
|
|
24 |
#include <memspy/engine/memspythreaddata.h>
|
|
25 |
#include <memspy/engine/memspykernelobjectdata.h>
|
|
26 |
#include <memspy/engine/memspyheapdata.h>
|
|
27 |
#include <memspy/engine/memspymemorytrackingcycledata.h>
|
|
28 |
//KernelObjects
|
|
29 |
#include <memspy/driver/memspydriverenumerationsshared.h>
|
|
30 |
// Servers
|
|
31 |
#include <memspy/engine/memspyserverdata.h>
|
|
32 |
// ECom
|
|
33 |
#include <memspy/engine/memspyecomdata.h>
|
52
|
34 |
// Window groups
|
|
35 |
#include <memspy/engine/memspyenginehelperwindowserver.h>
|
62
|
36 |
// Chunks
|
|
37 |
#include <memspy/engine/memspychunkdata.h>
|
|
38 |
// Code Segments
|
|
39 |
#include <memspy/engine/memspycodesegmentdata.h>
|
51
|
40 |
|
|
41 |
// IMPLEMENTATION
|
|
42 |
|
|
43 |
EXPORT_C RMemSpySession::RMemSpySession()
|
|
44 |
{
|
|
45 |
}
|
|
46 |
|
|
47 |
|
|
48 |
EXPORT_C TInt RMemSpySession::Connect()
|
|
49 |
{
|
|
50 |
TInt error(KErrNone);
|
|
51 |
|
|
52 |
for (TInt i=0; i<2; i++) // Two retries max
|
|
53 |
{
|
|
54 |
TInt error = CreateSession(KMemSpyServerName, TVersion(KMemSpyVersion, 0, 0));
|
|
55 |
|
|
56 |
if (error != KErrNotFound && error != KErrServerTerminated)
|
|
57 |
return error;
|
|
58 |
|
|
59 |
error = StartServer();
|
|
60 |
|
|
61 |
if (error != KErrNone && error != KErrAlreadyExists)
|
|
62 |
return error;
|
|
63 |
}
|
|
64 |
|
|
65 |
return error;
|
|
66 |
}
|
|
67 |
|
|
68 |
TInt RMemSpySession::StartServer()
|
|
69 |
{
|
|
70 |
RProcess server;
|
|
71 |
_LIT(KCommand, "start");
|
|
72 |
const TUid KServerUid3 = {0xE5883BC2};
|
|
73 |
TInt error = server.Create(KMemSpyServerName, KCommand);//, KServerUid3);
|
|
74 |
|
|
75 |
if (error != KErrNone)
|
|
76 |
return error;
|
|
77 |
|
|
78 |
TRequestStatus startStatus, stopStatus;
|
|
79 |
server.Logon(stopStatus);
|
|
80 |
if (stopStatus != KRequestPending)
|
|
81 |
{
|
|
82 |
User::WaitForRequest(stopStatus);
|
|
83 |
server.Kill(0);
|
|
84 |
server.Close();
|
|
85 |
return stopStatus.Int();
|
|
86 |
}
|
|
87 |
|
|
88 |
server.Rendezvous(startStatus);
|
|
89 |
server.Resume();
|
|
90 |
User::WaitForRequest(startStatus, stopStatus);
|
|
91 |
if (startStatus == KRequestPending)
|
|
92 |
{
|
|
93 |
// not started yet, i.e. stopStatus was signaled
|
|
94 |
server.Close();
|
|
95 |
return stopStatus.Int();
|
|
96 |
}
|
|
97 |
|
|
98 |
// Rendezvous was called - the server is ready
|
|
99 |
|
|
100 |
// We first need to cancel Logon
|
|
101 |
server.LogonCancel(stopStatus);
|
|
102 |
// We don't need this anymore
|
|
103 |
server.Close();
|
|
104 |
// Wait for LogonCancel to complete
|
|
105 |
User::WaitForRequest(stopStatus);
|
|
106 |
|
|
107 |
// Everything went OK
|
|
108 |
return KErrNone;
|
|
109 |
}
|
|
110 |
|
|
111 |
EXPORT_C void RMemSpySession::GetProcessesL(RArray<CMemSpyApiProcess*> &aProcesses, TSortType aSortType)
|
|
112 |
{
|
|
113 |
TPckgBuf<TInt> count;
|
|
114 |
User::LeaveIfError(SendReceive(EMemSpyClientServerOpGetProcessCount, TIpcArgs(&count)));
|
|
115 |
|
|
116 |
TInt requestedCount = count();
|
62
|
117 |
|
51
|
118 |
HBufC8* buffer = HBufC8::NewLC(requestedCount * sizeof(TMemSpyProcessData));
|
|
119 |
TPtr8 bufferPtr(buffer->Des());
|
|
120 |
|
|
121 |
User::LeaveIfError(SendReceive(EMemSpyClientServerOpGetProcesses, TIpcArgs(&count, &bufferPtr)));
|
|
122 |
aProcesses.Reset();
|
|
123 |
|
|
124 |
TInt receivedCount = Min(count(), requestedCount);
|
62
|
125 |
for(TInt i=0, offset = 0; i<receivedCount; i++, offset+=sizeof(TMemSpyProcessData))
|
51
|
126 |
{
|
|
127 |
TPckgBuf<TMemSpyProcessData> data;
|
|
128 |
data.Copy(bufferPtr.Ptr()+offset, sizeof(TMemSpyProcessData));
|
|
129 |
aProcesses.AppendL(CMemSpyApiProcess::NewLC(data()));
|
|
130 |
}
|
|
131 |
CleanupStack::Pop(aProcesses.Count());
|
|
132 |
CleanupStack::PopAndDestroy(buffer);
|
|
133 |
}
|
|
134 |
|
|
135 |
EXPORT_C TProcessId RMemSpySession::GetProcessIdByNameL(const TDesC& aProcessName)
|
|
136 |
{
|
|
137 |
TPckgBuf<TProcessId> procId;
|
|
138 |
User::LeaveIfError(SendReceive(EMemSpyClienServerOpGetProcessIdByName,
|
|
139 |
TIpcArgs(&aProcessName, &procId)));
|
|
140 |
|
|
141 |
return procId();
|
|
142 |
}
|
|
143 |
|
62
|
144 |
EXPORT_C TInt RMemSpySession::ProcessSystemPermanentOrCritical( TProcessId aId, TBool& aValue )
|
51
|
145 |
{
|
|
146 |
TPckgBuf<TProcessId> arg1( aId );
|
|
147 |
TPckgBuf<TBool> arg2( aValue );
|
|
148 |
TIpcArgs args( &arg1, &arg2 );
|
|
149 |
|
|
150 |
TInt error = SendReceive( EMemSpyClientServerOpProcessSystemPermanentOrCritical, args );
|
|
151 |
|
|
152 |
aValue = arg2();
|
|
153 |
|
|
154 |
return error;
|
|
155 |
}
|
|
156 |
|
62
|
157 |
EXPORT_C void RMemSpySession::NotifyEvent(TRequestStatus &aStatus)
|
|
158 |
{
|
|
159 |
SendReceive(EMemSpyClientServerOpNotifyEvent | KMemSpyOpFlagsAsyncOperation,
|
|
160 |
TIpcArgs(), aStatus);
|
|
161 |
}
|
|
162 |
|
|
163 |
EXPORT_C void RMemSpySession::CancelEventNotificationL()
|
|
164 |
{
|
|
165 |
User::LeaveIfError(SendReceive(EMemSpyClientServerOpCancelEventNotification));
|
|
166 |
}
|
|
167 |
|
51
|
168 |
EXPORT_C TInt RMemSpySession::EndProcessL( TProcessId aId, TMemSpyEndType aType )
|
|
169 |
{
|
|
170 |
TPckgBuf<TProcessId> arg1( aId );
|
|
171 |
TPckgBuf<TMemSpyEndType> arg2( aType );
|
|
172 |
TIpcArgs args( &arg1, &arg2 );
|
|
173 |
|
|
174 |
TInt error = SendReceive( EMemSpyClientServerOpEndProcess, args );
|
|
175 |
|
|
176 |
return error;
|
|
177 |
}
|
|
178 |
|
|
179 |
EXPORT_C TInt RMemSpySession::SwitchToProcess( TProcessId aId, TBool aBrought )
|
|
180 |
{
|
|
181 |
TPckgBuf<TProcessId> arg1( aId );
|
|
182 |
TPckgBuf<TBool> arg2( aBrought );
|
|
183 |
TIpcArgs args( &arg1, &arg2 );
|
|
184 |
|
|
185 |
TInt error = SendReceive( EMemSpyClientServerOpSwitchToProcess, args );
|
|
186 |
|
|
187 |
return error;
|
|
188 |
}
|
|
189 |
|
|
190 |
// Threads related methods
|
|
191 |
EXPORT_C void RMemSpySession::GetThreadsL(TProcessId aProcessId, RArray<CMemSpyApiThread*> &aThreads, TSortType aSortType)
|
|
192 |
{
|
|
193 |
TPckgBuf<TInt> count;
|
|
194 |
TPckgBuf<TProcessId> pid(aProcessId);
|
|
195 |
User::LeaveIfError(SendReceive(EMemSpyClientServerOpGetThreadCount, TIpcArgs(&count, &pid)));
|
|
196 |
|
|
197 |
TInt requestedCount = count();
|
62
|
198 |
|
51
|
199 |
HBufC8* buffer = HBufC8::NewLC(requestedCount * sizeof(TMemSpyThreadData));
|
|
200 |
TPtr8 bufferPtr(buffer->Des());
|
|
201 |
|
|
202 |
User::LeaveIfError(SendReceive(EMemSpyClientServerOpGetThreads, TIpcArgs(&count, &bufferPtr, &pid)));
|
|
203 |
aThreads.Reset();
|
|
204 |
|
|
205 |
TInt receivedCount = Min(count(), requestedCount);
|
62
|
206 |
for(TInt i=0, offset = 0; i<receivedCount; i++, offset+=sizeof(TMemSpyThreadData))
|
51
|
207 |
{
|
|
208 |
TPckgBuf<TMemSpyThreadData> data;
|
|
209 |
data.Copy(bufferPtr.Ptr()+offset, sizeof(TMemSpyThreadData));
|
|
210 |
aThreads.AppendL(CMemSpyApiThread::NewLC(data()));
|
|
211 |
}
|
|
212 |
CleanupStack::Pop(aThreads.Count());
|
|
213 |
CleanupStack::PopAndDestroy(buffer);
|
|
214 |
}
|
|
215 |
|
|
216 |
EXPORT_C void RMemSpySession::SetThreadPriorityL(TThreadId aId, TInt aPriority)
|
|
217 |
{
|
|
218 |
TPckgBuf<TThreadId> arg1( aId );
|
|
219 |
TPckgBuf<TInt> arg2( aPriority );
|
|
220 |
|
|
221 |
User::LeaveIfError(SendReceive( EMemSpyClientServerOpSetThreadPriority, TIpcArgs(&arg1, &arg2)));
|
|
222 |
}
|
|
223 |
|
|
224 |
EXPORT_C TInt RMemSpySession::ThreadSystemPermanentOrCritical( TThreadId aId, TBool aValue )
|
|
225 |
{
|
|
226 |
TPckgBuf<TThreadId> arg1( aId );
|
|
227 |
TPckgBuf<TBool> arg2( aValue );
|
|
228 |
TIpcArgs args( &arg1, &arg2 );
|
|
229 |
|
|
230 |
TInt error = SendReceive( EMemSpyClientServerOpThreadSystemPermanentOrCritical, args );
|
|
231 |
|
|
232 |
aValue = arg2();
|
|
233 |
|
|
234 |
return error;
|
|
235 |
}
|
|
236 |
|
|
237 |
EXPORT_C TInt RMemSpySession::EndThreadL( TThreadId aId, TMemSpyEndType aType )
|
|
238 |
{
|
|
239 |
TPckgBuf<TThreadId> arg1( aId );
|
|
240 |
TPckgBuf<TMemSpyEndType> arg2( aType );
|
|
241 |
TIpcArgs args( &arg1, &arg2 );
|
|
242 |
|
|
243 |
TInt error = SendReceive( EMemSpyClientServerOpEndThread, args );
|
|
244 |
|
|
245 |
return error;
|
|
246 |
}
|
|
247 |
|
|
248 |
EXPORT_C TInt RMemSpySession::SwitchToThread( TThreadId aId, TBool aBrought )
|
|
249 |
{
|
|
250 |
TPckgBuf<TThreadId> arg1( aId );
|
|
251 |
TPckgBuf<TBool> arg2( aBrought );
|
|
252 |
TIpcArgs args( &arg1, &arg2 );
|
|
253 |
|
|
254 |
TInt error = SendReceive( EMemSpyClientServerOpSwitchToThread, args );
|
|
255 |
|
|
256 |
return error;
|
|
257 |
}
|
|
258 |
|
|
259 |
EXPORT_C TInt RMemSpySession::GetInfoItemType( TInt aIndex, TThreadId aId, TMemSpyThreadInfoItemType &aType )
|
|
260 |
{
|
|
261 |
TPckgBuf<TInt> arg1( aIndex );
|
|
262 |
TPckgBuf<TThreadId> arg2( aId );
|
|
263 |
TPckgBuf<TMemSpyThreadInfoItemType> arg3;
|
|
264 |
TIpcArgs args( &arg1, &arg2, &arg3 );
|
|
265 |
|
|
266 |
TInt error = SendReceive( EMemSpyClientServerOpGetInfoItemType, args );
|
|
267 |
|
|
268 |
aType = arg3();
|
|
269 |
|
|
270 |
return error;
|
|
271 |
}
|
|
272 |
|
|
273 |
EXPORT_C void RMemSpySession::GetThreadInfoItemsL( RArray<CMemSpyApiThreadInfoItem*> &aInfoItems, TThreadId aId, TMemSpyThreadInfoItemType aType )
|
|
274 |
{
|
|
275 |
TPckgBuf<TThreadId> id( aId );
|
|
276 |
TPckgBuf<TMemSpyThreadInfoItemType> type( aType );
|
|
277 |
TPckgBuf<TInt> count;
|
|
278 |
|
|
279 |
TInt error = SendReceive( EMemSpyClientServerOpGetThreadInfoItemsCount, TIpcArgs( &id, &type, &count ) );
|
|
280 |
TInt itemCount = count();
|
|
281 |
|
|
282 |
if( error == KErrNone )
|
|
283 |
{
|
|
284 |
if( itemCount == 0 )
|
|
285 |
{
|
|
286 |
aInfoItems.Reset();
|
|
287 |
}
|
|
288 |
else
|
|
289 |
{
|
|
290 |
HBufC8* buffer = HBufC8::NewLC( itemCount * sizeof(TMemSpyThreadInfoItemData) );
|
|
291 |
TPtr8 bufferPtr(buffer->Des());
|
|
292 |
|
|
293 |
TPckgBuf<TInt> requestedCount( itemCount );
|
|
294 |
|
|
295 |
TIpcArgs args( &requestedCount, &id, &type, &bufferPtr );
|
|
296 |
TInt error = SendReceive( EMemSpyClientServerOpGetThreadInfoItems, args ); // TODO check error
|
|
297 |
|
|
298 |
aInfoItems.Reset();
|
|
299 |
|
|
300 |
for(TInt i=0, offset = 0; i < itemCount; i++, offset+=sizeof(TMemSpyThreadInfoItemData))
|
|
301 |
{
|
|
302 |
TPckgBuf<TMemSpyThreadInfoItemData> data;
|
|
303 |
data.Copy(bufferPtr.Ptr()+offset, sizeof(TMemSpyThreadInfoItemData));
|
|
304 |
aInfoItems.AppendL(CMemSpyApiThreadInfoItem::NewLC(data()));
|
|
305 |
}
|
|
306 |
|
|
307 |
CleanupStack::Pop(aInfoItems.Count());
|
|
308 |
CleanupStack::PopAndDestroy(buffer);
|
|
309 |
}
|
|
310 |
}
|
|
311 |
|
|
312 |
User::LeaveIfError(error);
|
|
313 |
}
|
|
314 |
|
|
315 |
EXPORT_C TInt RMemSpySession::GetThreadInfoItems( RArray<CMemSpyApiThreadInfoItem*> &aInfoItems, TThreadId aId, TMemSpyThreadInfoItemType aType )
|
|
316 |
{
|
|
317 |
TRAPD(error, GetThreadInfoItemsL(aInfoItems, aId, aType));
|
|
318 |
return error;
|
|
319 |
}
|
|
320 |
|
|
321 |
EXPORT_C void RMemSpySession::GetProcessIdByThreadId( TProcessId& aPID, TThreadId aTID )
|
|
322 |
{
|
|
323 |
TPckgBuf<TProcessId> pid(aPID);
|
|
324 |
TPckgBuf<TThreadId> tid(aTID);
|
|
325 |
|
|
326 |
TIpcArgs args( &pid, &tid );
|
|
327 |
User::LeaveIfError( SendReceive( EMemSpyClientServerOpGetProcessIdByThreadId, args ) );
|
|
328 |
aPID = pid();
|
|
329 |
}
|
|
330 |
|
|
331 |
//Kernel Objects specific operations
|
|
332 |
EXPORT_C void RMemSpySession::GetKernelObjectsL( RArray<CMemSpyApiKernelObject*> &aKernelObjects )
|
|
333 |
{
|
|
334 |
TPckgBuf<TInt> count;
|
|
335 |
User::LeaveIfError(SendReceive( EMemSpyClientServerOpGetKernelObjectCount, TIpcArgs(&count) ));
|
|
336 |
|
|
337 |
TInt requestedCount = count();
|
62
|
338 |
|
51
|
339 |
HBufC8* buffer = HBufC8::NewLC(requestedCount * sizeof(TMemSpyKernelObjectData));
|
|
340 |
TPtr8 bufferPtr(buffer->Des());
|
|
341 |
|
|
342 |
TIpcArgs args( &count, &bufferPtr );
|
|
343 |
User::LeaveIfError(SendReceive( EMemSpyClientServerOpGetKernelObjects, args ));
|
|
344 |
|
|
345 |
aKernelObjects.Reset();
|
|
346 |
|
62
|
347 |
TInt receivedCount = Min(count(), requestedCount);
|
|
348 |
|
|
349 |
for(TInt i=0, offset = 0; i<receivedCount; i++, offset+=sizeof(TMemSpyKernelObjectData))
|
51
|
350 |
{
|
|
351 |
TPckgBuf<TMemSpyKernelObjectData> data;
|
|
352 |
data.Copy(bufferPtr.Ptr()+offset, sizeof(TMemSpyKernelObjectData));
|
|
353 |
aKernelObjects.AppendL(CMemSpyApiKernelObject::NewLC(data()));
|
|
354 |
}
|
|
355 |
|
|
356 |
CleanupStack::Pop(aKernelObjects.Count());
|
|
357 |
CleanupStack::PopAndDestroy(buffer);
|
|
358 |
}
|
|
359 |
|
|
360 |
EXPORT_C TInt RMemSpySession::GetKernelObjects( RArray<CMemSpyApiKernelObject*> &aKernelObjects )
|
|
361 |
{
|
|
362 |
TRAPD(error, GetKernelObjectsL(aKernelObjects));
|
|
363 |
return error;
|
|
364 |
}
|
|
365 |
|
|
366 |
EXPORT_C void RMemSpySession::GetKernelObjectItemsL( RArray<CMemSpyApiKernelObjectItem*> &aKernelObjectItems, TMemSpyDriverContainerType aForContainer )
|
|
367 |
{
|
|
368 |
TPckgBuf<TInt> count;
|
|
369 |
TPckgBuf<TMemSpyDriverContainerType> type(aForContainer);
|
|
370 |
User::LeaveIfError(SendReceive( EMemSpyClientServerOpGetKernelObjectItemCount, TIpcArgs(&count, &type) ));
|
|
371 |
|
|
372 |
TInt requestedCount = count();
|
62
|
373 |
|
51
|
374 |
HBufC8* buffer = HBufC8::NewLC(requestedCount * sizeof(TMemSpyDriverHandleInfoGeneric));
|
|
375 |
TPtr8 bufferPtr(buffer->Des());
|
|
376 |
|
|
377 |
TIpcArgs args( &count, &type, &bufferPtr );
|
|
378 |
User::LeaveIfError(SendReceive( EMemSpyClientServerOpGetKernelObjectItems, args ));
|
|
379 |
|
|
380 |
aKernelObjectItems.Reset();
|
62
|
381 |
|
|
382 |
TInt receivedCount = Min(count(), requestedCount);
|
51
|
383 |
|
62
|
384 |
for(TInt i=0, offset = 0; i<receivedCount; i++, offset+=sizeof(TMemSpyDriverHandleInfoGeneric))
|
51
|
385 |
{
|
|
386 |
TPckgBuf<TMemSpyDriverHandleInfoGeneric> data;
|
|
387 |
data.Copy(bufferPtr.Ptr()+offset, sizeof(TMemSpyDriverHandleInfoGeneric));
|
|
388 |
aKernelObjectItems.AppendL( CMemSpyApiKernelObjectItem::NewLC( data() ) );
|
|
389 |
}
|
|
390 |
CleanupStack::Pop(aKernelObjectItems.Count());
|
|
391 |
CleanupStack::PopAndDestroy(buffer);
|
|
392 |
}
|
|
393 |
|
|
394 |
EXPORT_C TInt RMemSpySession::GetKernelObjectItems( RArray<CMemSpyApiKernelObjectItem*> &aKernelObjectItems, TMemSpyDriverContainerType aForContainer )
|
|
395 |
{
|
|
396 |
TRAPD(error, GetKernelObjectItemsL(aKernelObjectItems, aForContainer));
|
|
397 |
return error;
|
|
398 |
}
|
|
399 |
|
|
400 |
EXPORT_C void RMemSpySession::GetMemoryTrackingCyclesL(RArray<CMemSpyApiMemoryTrackingCycle*>& aCycles)
|
|
401 |
{
|
|
402 |
TPckgBuf<TInt> count;
|
|
403 |
User::LeaveIfError(SendReceive( EMemSpyClientServerOpGetMemoryTrackingCycleCount, TIpcArgs(&count) ));
|
|
404 |
|
|
405 |
TInt requestedCount = count();
|
62
|
406 |
|
51
|
407 |
HBufC8* buffer = HBufC8::NewLC(requestedCount * sizeof(TMemSpyMemoryTrackingCycleData));
|
|
408 |
TPtr8 bufferPtr(buffer->Des());
|
|
409 |
|
|
410 |
TIpcArgs args( &count, &bufferPtr );
|
|
411 |
User::LeaveIfError(SendReceive( EMemSpyClientServerOpGetMemoryTrackingCycles, args ));
|
|
412 |
|
|
413 |
aCycles.Reset();
|
|
414 |
|
62
|
415 |
TInt receivedCount = Min(count(), requestedCount);
|
|
416 |
|
|
417 |
for(TInt i=0, offset = 0; i<receivedCount; i++, offset+=sizeof(TMemSpyMemoryTrackingCycleData))
|
51
|
418 |
{
|
|
419 |
TPckgBuf<TMemSpyMemoryTrackingCycleData> data;
|
|
420 |
data.Copy(bufferPtr.Ptr()+offset, sizeof(TMemSpyMemoryTrackingCycleData));
|
|
421 |
aCycles.AppendL(CMemSpyApiMemoryTrackingCycle::NewLC(data()));
|
|
422 |
}
|
|
423 |
|
|
424 |
CleanupStack::Pop(aCycles.Count());
|
|
425 |
CleanupStack::PopAndDestroy(buffer);
|
|
426 |
}
|
|
427 |
|
|
428 |
EXPORT_C void RMemSpySession::OutputAllContainerContents()
|
|
429 |
{
|
|
430 |
SendReceive( EMemSpyClientServerOpOutputAllContainerContents );
|
|
431 |
}
|
|
432 |
|
|
433 |
|
|
434 |
//Heap specific operations
|
|
435 |
|
|
436 |
EXPORT_C CMemSpyApiHeap* RMemSpySession::GetHeapL()
|
62
|
437 |
{
|
51
|
438 |
HBufC8* buffer = HBufC8::NewLC( sizeof(TMemSpyHeapData) );
|
|
439 |
TPtr8 bufferPtr(buffer->Des());
|
|
440 |
TIpcArgs args( &bufferPtr );
|
|
441 |
|
|
442 |
User::LeaveIfError(SendReceive( EMemSpyClientServerOpGetHeap, args ));
|
|
443 |
|
|
444 |
TPckgBuf<TMemSpyHeapData> data;
|
|
445 |
data.Copy(bufferPtr.Ptr(), sizeof(TMemSpyHeapData));
|
62
|
446 |
CMemSpyApiHeap* heap = CMemSpyApiHeap::NewL( data() );
|
51
|
447 |
|
|
448 |
CleanupStack::PopAndDestroy(buffer);
|
|
449 |
|
62
|
450 |
return heap;
|
51
|
451 |
}
|
|
452 |
|
|
453 |
EXPORT_C CMemSpyApiHeap* RMemSpySession::GetHeap()
|
|
454 |
{
|
|
455 |
CMemSpyApiHeap *result = NULL;
|
|
456 |
TRAPD(error, result = GetHeapL());
|
|
457 |
return error == KErrNone ? result : NULL;
|
|
458 |
}
|
|
459 |
|
|
460 |
|
|
461 |
|
|
462 |
EXPORT_C void RMemSpySession::GetEComCategoriesL(RArray<CMemSpyApiEComCategory*> &aCategories)
|
|
463 |
{
|
|
464 |
TPckgBuf<TInt> count;
|
|
465 |
User::LeaveIfError(SendReceive(EMemSpyClientServerOpGetEComCategoryCount, TIpcArgs(&count)));
|
|
466 |
|
|
467 |
TInt requestedCount = count();
|
62
|
468 |
|
51
|
469 |
HBufC8* buffer = HBufC8::NewLC(requestedCount * sizeof(TMemSpyEComCategoryData));
|
|
470 |
TPtr8 bufferPtr(buffer->Des());
|
|
471 |
|
|
472 |
User::LeaveIfError(SendReceive(EMemSpyClientServerOpGetEComCategories, TIpcArgs(&count, &bufferPtr)));
|
|
473 |
aCategories.Reset();
|
|
474 |
|
|
475 |
TInt receivedCount = Min(count(), requestedCount);
|
62
|
476 |
for(TInt i=0, offset = 0; i<receivedCount; i++, offset+=sizeof(TMemSpyEComCategoryData))
|
51
|
477 |
{
|
|
478 |
TPckgBuf<TMemSpyEComCategoryData> data;
|
|
479 |
data.Copy(bufferPtr.Ptr()+offset, sizeof(TMemSpyEComCategoryData));
|
|
480 |
aCategories.AppendL(CMemSpyApiEComCategory::NewLC(data()));
|
|
481 |
}
|
|
482 |
CleanupStack::Pop(aCategories.Count());
|
|
483 |
CleanupStack::PopAndDestroy(buffer);
|
|
484 |
}
|
|
485 |
|
|
486 |
EXPORT_C void RMemSpySession::GetEComInterfacesL(TUid aCategory, RArray<CMemSpyApiEComInterface*> &aInterfaces)
|
|
487 |
{
|
|
488 |
TPckgBuf<TInt> count;
|
|
489 |
TPckgBuf<TUid> category(aCategory);
|
|
490 |
User::LeaveIfError(SendReceive(EMemSpyClientServerOpGetEComInterfaceCount, TIpcArgs(&count, &category)));
|
|
491 |
|
|
492 |
TInt requestedCount = count();
|
62
|
493 |
|
51
|
494 |
HBufC8* buffer = HBufC8::NewLC(requestedCount * sizeof(TMemSpyEComInterfaceData));
|
|
495 |
TPtr8 bufferPtr(buffer->Des());
|
|
496 |
|
|
497 |
User::LeaveIfError(SendReceive(EMemSpyClientServerOpGetEComInterfaces, TIpcArgs(&count, &category, &bufferPtr)));
|
|
498 |
aInterfaces.Reset();
|
|
499 |
|
|
500 |
TInt receivedCount = Min(count(), requestedCount);
|
62
|
501 |
for(TInt i=0, offset = 0; i<receivedCount; i++, offset+=sizeof(TMemSpyEComInterfaceData))
|
51
|
502 |
{
|
|
503 |
TPckgBuf<TMemSpyEComInterfaceData> data;
|
|
504 |
data.Copy(bufferPtr.Ptr()+offset, sizeof(TMemSpyEComInterfaceData));
|
|
505 |
aInterfaces.AppendL(CMemSpyApiEComInterface::NewLC(data()));
|
|
506 |
}
|
|
507 |
CleanupStack::Pop(aInterfaces.Count());
|
|
508 |
CleanupStack::PopAndDestroy(buffer);
|
|
509 |
}
|
|
510 |
|
|
511 |
EXPORT_C void RMemSpySession::GetEComImplementationsL(TUid aInterface, RArray<CMemSpyApiEComImplementation*> &aImplementations)
|
|
512 |
{
|
|
513 |
TPckgBuf<TInt> count;
|
|
514 |
TPckgBuf<TUid> interface(aInterface);
|
|
515 |
User::LeaveIfError(SendReceive(EMemSpyClientServerOpGetEComImplementationCount, TIpcArgs(&count, &interface)));
|
|
516 |
|
|
517 |
TInt requestedCount = count();
|
62
|
518 |
|
51
|
519 |
HBufC8* buffer = HBufC8::NewLC(requestedCount * sizeof(TMemSpyEComImplementationData));
|
|
520 |
TPtr8 bufferPtr(buffer->Des());
|
|
521 |
|
|
522 |
User::LeaveIfError(SendReceive(EMemSpyClientServerOpGetEComImplementations, TIpcArgs(&count, &interface, &bufferPtr)));
|
|
523 |
aImplementations.Reset();
|
|
524 |
|
|
525 |
TInt receivedCount = Min(count(), requestedCount);
|
62
|
526 |
for(TInt i=0, offset = 0; i<receivedCount; i++, offset+=sizeof(TMemSpyEComImplementationData))
|
51
|
527 |
{
|
|
528 |
TPckgBuf<TMemSpyEComImplementationData> data;
|
|
529 |
data.Copy(bufferPtr.Ptr()+offset, sizeof(TMemSpyEComImplementationData));
|
|
530 |
aImplementations.AppendL(CMemSpyApiEComImplementation::NewLC(data()));
|
|
531 |
}
|
|
532 |
CleanupStack::Pop(aImplementations.Count());
|
|
533 |
CleanupStack::PopAndDestroy(buffer);
|
|
534 |
}
|
|
535 |
|
52
|
536 |
EXPORT_C void RMemSpySession::GetWindowGroupsL(RArray<CMemSpyApiWindowGroup*> &aGroups)
|
|
537 |
{
|
|
538 |
TPckgBuf<TInt> count;
|
|
539 |
User::LeaveIfError(SendReceive(EMemSpyClientServerOpGetWindowGroupCount, TIpcArgs(&count)));
|
|
540 |
|
|
541 |
TInt requestedCount = count();
|
62
|
542 |
|
52
|
543 |
HBufC8* buffer = HBufC8::NewLC(requestedCount * sizeof(TMemSpyEngineWindowGroupDetails));
|
|
544 |
TPtr8 bufferPtr(buffer->Des());
|
|
545 |
|
|
546 |
User::LeaveIfError(SendReceive(EMemSpyClientServerOpGetWindowGroups, TIpcArgs(&count, &bufferPtr)));
|
|
547 |
aGroups.Reset();
|
|
548 |
|
|
549 |
TInt receivedCount = Min(count(), requestedCount);
|
62
|
550 |
for(TInt i=0, offset = 0; i<receivedCount; i++, offset+=sizeof(TMemSpyEngineWindowGroupDetails))
|
52
|
551 |
{
|
|
552 |
TPckgBuf<TMemSpyEngineWindowGroupDetails> data;
|
|
553 |
data.Copy(bufferPtr.Ptr()+offset, sizeof(TMemSpyEngineWindowGroupDetails));
|
|
554 |
aGroups.AppendL(CMemSpyApiWindowGroup::NewLC(data()));
|
|
555 |
}
|
|
556 |
CleanupStack::Pop(aGroups.Count());
|
|
557 |
CleanupStack::PopAndDestroy(buffer);
|
|
558 |
}
|
|
559 |
|
62
|
560 |
EXPORT_C void RMemSpySession::SwitchToWindowGroupL( TInt aId )
|
|
561 |
{
|
|
562 |
TPckgBuf<TInt> id( aId );
|
|
563 |
TIpcArgs args(&id);
|
|
564 |
User::LeaveIfError(SendReceive(EMemSpyClientServerOpSwitchToWindowGroup, args));
|
|
565 |
}
|
|
566 |
|
51
|
567 |
EXPORT_C void RMemSpySession::DumpKernelHeap()
|
|
568 |
{
|
|
569 |
SendReceive( EMemSpyClientServerOpDumpKernelHeap );
|
|
570 |
}
|
|
571 |
|
|
572 |
EXPORT_C void RMemSpySession::OutputKernelHeapDataL()
|
|
573 |
{
|
|
574 |
User::LeaveIfError(SendReceive(EMemSpyClientServerOpHeapData | KMemSpyOpFlagsIncludesThreadId,
|
|
575 |
TIpcArgs(KMemSpyClientServerThreadIdKernel)));
|
|
576 |
|
|
577 |
}
|
|
578 |
|
|
579 |
EXPORT_C void RMemSpySession::OutputKernelHeapData(TRequestStatus& aStatus)
|
|
580 |
{
|
|
581 |
SendReceive(EMemSpyClientServerOpHeapData,
|
|
582 |
TIpcArgs(KMemSpyClientServerThreadIdKernel),
|
|
583 |
aStatus);
|
|
584 |
}
|
|
585 |
|
|
586 |
EXPORT_C void RMemSpySession::OutputThreadHeapDataL( TThreadId aThreadId)
|
|
587 |
{
|
|
588 |
User::LeaveIfError(SendReceive(EMemSpyClientServerOpHeapData | KMemSpyOpFlagsIncludesThreadId,
|
|
589 |
TIpcArgs(aThreadId)));
|
|
590 |
}
|
|
591 |
|
|
592 |
EXPORT_C void RMemSpySession::OutputThreadHeapDataL(const TDesC& aThreadName)
|
|
593 |
{
|
|
594 |
const TIpcArgs args( &aThreadName );
|
|
595 |
|
|
596 |
User::LeaveIfError( SendReceive( EMemSpyClientServerOpHeapData | KMemSpyOpFlagsIncludesThreadName, args ));
|
|
597 |
}
|
|
598 |
|
|
599 |
EXPORT_C void RMemSpySession::OutputThreadCellListL(TThreadId aThreadId)
|
|
600 |
{
|
|
601 |
User::LeaveIfError(SendReceive(EMemSpyClientServerOpHeapCellListing | KMemSpyOpFlagsIncludesThreadId,
|
|
602 |
TIpcArgs(aThreadId)));
|
|
603 |
}
|
|
604 |
|
|
605 |
EXPORT_C void RMemSpySession::OutputHeapInfoUserL(TThreadId aThreadId)
|
|
606 |
{
|
|
607 |
User::LeaveIfError(SendReceive( EMemSpyClientServerOpHeapInfo | KMemSpyOpFlagsIncludesThreadId,
|
|
608 |
TIpcArgs(aThreadId)));
|
|
609 |
}
|
|
610 |
|
|
611 |
EXPORT_C void RMemSpySession::SwitchOutputSinkL( TMemSpySinkType aType )
|
|
612 |
{
|
|
613 |
TInt op;
|
|
614 |
if( aType == ESinkTypeFile )
|
|
615 |
op = EMemSpyClientServerOpSwitchOutputSinkFile;
|
|
616 |
else
|
|
617 |
op = EMemSpyClientServerOpSwitchOutputSinkTrace;
|
|
618 |
|
|
619 |
User::LeaveIfError(SendReceive( op ));
|
|
620 |
}
|
|
621 |
|
|
622 |
EXPORT_C void RMemSpySession::SwitchOutputToTraceL()
|
|
623 |
{
|
|
624 |
User::LeaveIfError(SendReceive(EMemSpyClientServerOpSwitchOutputSinkTrace));
|
|
625 |
}
|
|
626 |
|
|
627 |
EXPORT_C void RMemSpySession::SwitchOutputToFileL(const TDesC& aRootFolder)
|
|
628 |
{
|
|
629 |
TIpcArgs args;
|
|
630 |
if (aRootFolder.Length())
|
|
631 |
{
|
|
632 |
args.Set(0, &aRootFolder);
|
|
633 |
}
|
|
634 |
|
|
635 |
User::LeaveIfError(SendReceive(EMemSpyClientServerOpSwitchOutputSinkFile, args));
|
|
636 |
}
|
|
637 |
|
|
638 |
EXPORT_C void RMemSpySession::OutputStackInfoL(TThreadId aThreadId)
|
|
639 |
{
|
|
640 |
User::LeaveIfError(SendReceive( EMemSpyClientServerOpStackInfo | KMemSpyOpFlagsIncludesThreadId,
|
|
641 |
TIpcArgs(aThreadId)));
|
|
642 |
}
|
|
643 |
|
|
644 |
EXPORT_C void RMemSpySession::OutputStackDataL(TThreadId aThreadId, TMemSpyDriverDomainType aType )
|
|
645 |
{
|
|
646 |
TInt op;
|
|
647 |
if( aType == EMemSpyDriverDomainUser )
|
|
648 |
op = EMemSpyClientServerOpStackDataUser;
|
|
649 |
else
|
|
650 |
op = EMemSpyClientServerOpStackDataKernel;
|
|
651 |
|
|
652 |
User::LeaveIfError(SendReceive( op | KMemSpyOpFlagsIncludesThreadId,
|
|
653 |
TIpcArgs(aThreadId, aType)));
|
|
654 |
|
|
655 |
}
|
|
656 |
|
|
657 |
EXPORT_C void RMemSpySession::OutputThreadInfoHandlesL(TThreadId aThreadId)
|
|
658 |
{
|
|
659 |
TPckgBuf<TThreadId> id(aThreadId);
|
|
660 |
User::LeaveIfError(SendReceive(EMemSpyClientServerOpOutputInfoHandles, TIpcArgs( &id )));
|
|
661 |
}
|
|
662 |
|
|
663 |
EXPORT_C void RMemSpySession::OutputAOListL(TThreadId aId, TMemSpyThreadInfoItemType aType)
|
|
664 |
{
|
|
665 |
TPckgBuf<TThreadId> id(aId);
|
|
666 |
TPckgBuf<TMemSpyThreadInfoItemType> type(aType);
|
|
667 |
|
|
668 |
User::LeaveIfError(SendReceive(EMemSpyClientServerOpOutputAOList, TIpcArgs( &id, &type )));
|
|
669 |
}
|
|
670 |
|
|
671 |
EXPORT_C void RMemSpySession::OutputKernelObjectsL()
|
|
672 |
{
|
|
673 |
User::LeaveIfError(SendReceive(EMemSpyClientServerOpEnumerateKernelContainerAll));
|
|
674 |
}
|
|
675 |
|
|
676 |
EXPORT_C void RMemSpySession::OutputCompactStackInfoL()
|
|
677 |
{
|
|
678 |
User::LeaveIfError(SendReceive(EMemSpyClientServerOpStackInfoCompact));
|
|
679 |
}
|
|
680 |
|
|
681 |
EXPORT_C void RMemSpySession::OutputCompactHeapInfoL()
|
|
682 |
{
|
|
683 |
User::LeaveIfError(SendReceive(EMemSpyClientServerOpHeapInfoCompact));
|
|
684 |
}
|
|
685 |
// Asynchronous operations
|
|
686 |
EXPORT_C void RMemSpySession::OutputPhoneInfo(TRequestStatus& aStatus)
|
|
687 |
{
|
|
688 |
SendReceive(EMemSpyClientServerOpSummaryInfo | KMemSpyOpFlagsAsyncOperation, TIpcArgs(), aStatus);
|
|
689 |
}
|
|
690 |
|
|
691 |
EXPORT_C void RMemSpySession::OutputDetailedPhoneInfo(TRequestStatus& aStatus)
|
|
692 |
{
|
|
693 |
SendReceive(EMemSpyClientServerOpSummaryInfoDetailed | KMemSpyOpFlagsAsyncOperation, TIpcArgs(), aStatus);
|
|
694 |
}
|
|
695 |
|
|
696 |
EXPORT_C void RMemSpySession::OutputHeapInfo(TRequestStatus& aStatus)
|
|
697 |
{
|
|
698 |
SendReceive(EMemSpyClientServerOpHeapInfo | KMemSpyOpFlagsAsyncOperation, TIpcArgs(), aStatus);
|
|
699 |
}
|
|
700 |
|
|
701 |
EXPORT_C void RMemSpySession::OutputCompactHeapInfo(TRequestStatus& aStatus)
|
|
702 |
{
|
|
703 |
SendReceive(EMemSpyClientServerOpHeapInfoCompact | KMemSpyOpFlagsAsyncOperation, TIpcArgs(), aStatus);
|
|
704 |
}
|
|
705 |
|
|
706 |
EXPORT_C void RMemSpySession::OutputHeapCellListing(TRequestStatus& aStatus)
|
|
707 |
{
|
|
708 |
SendReceive(EMemSpyClientServerOpHeapCellListing | KMemSpyOpFlagsAsyncOperation, TIpcArgs(), aStatus);
|
|
709 |
}
|
|
710 |
|
|
711 |
EXPORT_C void RMemSpySession::OutputHeapData(TRequestStatus& aStatus)
|
|
712 |
{
|
|
713 |
SendReceive(EMemSpyClientServerOpHeapData | KMemSpyOpFlagsAsyncOperation, TIpcArgs(), aStatus);
|
|
714 |
}
|
|
715 |
|
|
716 |
// synchronous version of the operation - for CLI
|
|
717 |
EXPORT_C void RMemSpySession::OutputHeapData()
|
|
718 |
{
|
|
719 |
SendReceive(EMemSpyClientServerOpHeapData);
|
|
720 |
}
|
|
721 |
|
|
722 |
EXPORT_C void RMemSpySession::OutputStackInfo(TRequestStatus& aStatus)
|
|
723 |
{
|
|
724 |
SendReceive(EMemSpyClientServerOpStackInfo | KMemSpyOpFlagsAsyncOperation, TIpcArgs(), aStatus);
|
|
725 |
}
|
|
726 |
|
|
727 |
EXPORT_C void RMemSpySession::OutputCompactStackInfo(TRequestStatus& aStatus)
|
|
728 |
{
|
|
729 |
SendReceive(EMemSpyClientServerOpStackInfoCompact | KMemSpyOpFlagsAsyncOperation, TIpcArgs(), aStatus);
|
|
730 |
}
|
|
731 |
|
|
732 |
EXPORT_C void RMemSpySession::OutputUserStackData(TRequestStatus& aStatus)
|
|
733 |
{
|
|
734 |
SendReceive(EMemSpyClientServerOpStackDataUser | KMemSpyOpFlagsAsyncOperation, TIpcArgs(), aStatus);
|
|
735 |
}
|
|
736 |
|
|
737 |
EXPORT_C void RMemSpySession::OutputKernelStackData(TRequestStatus& aStatus)
|
|
738 |
{
|
|
739 |
SendReceive(EMemSpyClientServerOpStackDataKernel | KMemSpyOpFlagsAsyncOperation, TIpcArgs(), aStatus);
|
|
740 |
}
|
|
741 |
|
|
742 |
// Synchronous operations
|
|
743 |
EXPORT_C void RMemSpySession::OutputPhoneInfo()
|
|
744 |
{
|
|
745 |
SendReceive( EMemSpyClientServerOpSummaryInfo , TIpcArgs() );
|
|
746 |
}
|
|
747 |
|
|
748 |
EXPORT_C TInt RMemSpySession::GetSwmtCyclesCount()
|
|
749 |
{
|
|
750 |
TPckgBuf<TInt> count;
|
|
751 |
TIpcArgs args( &count );
|
|
752 |
|
|
753 |
User::LeaveIfError(SendReceive( EMemSpyClientServerOpGetMemoryTrackingCycleCount, args ));
|
|
754 |
|
|
755 |
return count();
|
|
756 |
}
|
|
757 |
|
|
758 |
EXPORT_C void RMemSpySession::SetSwmtAutoStartProcessList( CArrayFixFlat<TUid>* aList )
|
|
759 |
{
|
|
760 |
TInt count = aList->Count();
|
|
761 |
TIpcArgs args( &aList, &count );
|
|
762 |
|
|
763 |
SendReceive( EMemSpyClientServerOpSetSwmtAutoStartProcessList, args );
|
|
764 |
}
|
|
765 |
|
|
766 |
EXPORT_C void RMemSpySession::SwmtResetTracking()
|
|
767 |
{
|
|
768 |
SendReceive( EMemSpyClientServerOpSystemWideMemoryTrackingReset );
|
|
769 |
}
|
|
770 |
|
|
771 |
EXPORT_C void RMemSpySession::GetOutputSink( TMemSpySinkType& aType )
|
|
772 |
{
|
|
773 |
TPckgBuf<TMemSpySinkType> type( aType );
|
|
774 |
TIpcArgs args( &type );
|
|
775 |
|
|
776 |
SendReceive( EMemSpyClientServerOpGetOutputSink, args );
|
|
777 |
|
|
778 |
aType = type();
|
|
779 |
}
|
|
780 |
|
|
781 |
EXPORT_C void RMemSpySession::NotifyDeviceWideOperationProgress(TMemSpyDeviceWideOperationProgress &aProgress, TRequestStatus &aStatus)
|
|
782 |
{
|
|
783 |
SendReceive(EMemSpyClientServerOpNotifyDeviceWideOperationProgress | KMemSpyOpFlagsAsyncOperation,
|
|
784 |
TIpcArgs(&aProgress.iProgress, &aProgress.iDescription),
|
|
785 |
aStatus);
|
|
786 |
}
|
|
787 |
|
|
788 |
EXPORT_C void RMemSpySession::CancelDeviceWideOperationL()
|
|
789 |
{
|
|
790 |
User::LeaveIfError(SendReceive(EMemSpyClientServerOpCancelDeviceWideOperation));
|
|
791 |
}
|
|
792 |
|
|
793 |
// SWMT operations
|
|
794 |
EXPORT_C void RMemSpySession::SetSwmtCategoriesL(TInt aCategories)
|
|
795 |
{
|
|
796 |
User::LeaveIfError(SendReceive(EMemSpyClientServerOpSystemWideMemoryTrackingCategoriesSet,
|
|
797 |
TIpcArgs(aCategories)));
|
|
798 |
}
|
|
799 |
|
|
800 |
EXPORT_C void RMemSpySession::SetSwmtHeapDumpsEnabledL(TBool aEnabled)
|
|
801 |
{
|
|
802 |
User::LeaveIfError(SendReceive(EMemSpyClientServerOpSystemWideMemoryTrackingHeapDumpSet,
|
|
803 |
TIpcArgs(aEnabled)));
|
|
804 |
}
|
|
805 |
|
|
806 |
EXPORT_C void RMemSpySession::SetSwmtMode(TMemSpyEngineHelperSysMemTrackerConfig::TMemSpyEngineSysMemTrackerMode aMode)
|
|
807 |
{
|
|
808 |
TPckgBuf<TMemSpyEngineHelperSysMemTrackerConfig::TMemSpyEngineSysMemTrackerMode> mode( aMode );
|
|
809 |
TIpcArgs args(&mode);
|
|
810 |
User::LeaveIfError(SendReceive(EMemSpyClientServerOpSystemWideMemoryTrackingModeSet, args));
|
|
811 |
}
|
|
812 |
|
|
813 |
EXPORT_C TBool RMemSpySession::IsSwmtRunningL()
|
|
814 |
{
|
|
815 |
TPckgBuf<TBool> ret;
|
|
816 |
User::LeaveIfError(SendReceive(EMemSpyClientServerOpIsSwmtRunning, TIpcArgs(&ret)));
|
54
|
817 |
|
51
|
818 |
return ret();
|
|
819 |
}
|
|
820 |
|
|
821 |
EXPORT_C void RMemSpySession::StartSwmtTimerL(TInt aPeriod)
|
|
822 |
{
|
|
823 |
SetSwmtTimerIntervalL(aPeriod);
|
|
824 |
User::LeaveIfError(SendReceive(EMemSpyClientServerOpSystemWideMemoryTrackingTimerStart));
|
|
825 |
}
|
|
826 |
|
54
|
827 |
EXPORT_C void RMemSpySession::StartSwmtTimer( TRequestStatus& aStatus )
|
|
828 |
{
|
|
829 |
SendReceive( EMemSpyClientServerOpSystemWideMemoryTrackingTimerStart,
|
|
830 |
TIpcArgs(), aStatus );
|
|
831 |
}
|
|
832 |
|
51
|
833 |
EXPORT_C void RMemSpySession::StartSwmtTimerL()
|
|
834 |
{
|
|
835 |
User::LeaveIfError(SendReceive(EMemSpyClientServerOpSystemWideMemoryTrackingTimerStart));
|
|
836 |
}
|
|
837 |
|
|
838 |
EXPORT_C void RMemSpySession::SetSwmtTimerIntervalL(TInt aPeriod)
|
|
839 |
{
|
|
840 |
User::LeaveIfError(SendReceive(EMemSpyClientServerOpSystemWideMemoryTrackingTimerPeriodSet,
|
|
841 |
TIpcArgs(aPeriod)));
|
|
842 |
}
|
|
843 |
|
|
844 |
EXPORT_C void RMemSpySession::StopSwmtTimerL()
|
|
845 |
{
|
|
846 |
User::LeaveIfError(SendReceive(EMemSpyClientServerOpSystemWideMemoryTrackingTimerStop));
|
|
847 |
}
|
|
848 |
|
|
849 |
|
|
850 |
EXPORT_C void RMemSpySession::ForceSwmtUpdateL()
|
|
851 |
{
|
|
852 |
User::LeaveIfError(SendReceive(EMemSpyClientServerOpSystemWideMemoryTrackingForceUpdate));
|
|
853 |
}
|
|
854 |
|
|
855 |
EXPORT_C void RMemSpySession::ForceSwmtUpdate(TRequestStatus& aStatus)
|
|
856 |
{
|
|
857 |
SendReceive(EMemSpyClientServerOpSystemWideMemoryTrackingForceUpdate,
|
|
858 |
TIpcArgs(),
|
|
859 |
aStatus);
|
|
860 |
}
|
|
861 |
|
|
862 |
EXPORT_C void RMemSpySession::SetSwmtFilter( const TDesC& aFilter )
|
|
863 |
{
|
|
864 |
TIpcArgs args( &aFilter );
|
|
865 |
User::LeaveIfError( SendReceive( EMemSpyClientServerOpSystemWideMemoryTrackingThreadNameFilterSet, args ) );
|
|
866 |
}
|
|
867 |
|
|
868 |
EXPORT_C void RMemSpySession::GetSwmtFilter( TName& aFilter )
|
|
869 |
{
|
|
870 |
TPckgBuf<TName> name;
|
|
871 |
TIpcArgs args( &name );
|
|
872 |
User::LeaveIfError( SendReceive( EMemSpyClientServerOpSystemWideMemoryTrackingThreadNameFilterGet, args ) );
|
|
873 |
aFilter = name();
|
|
874 |
}
|
|
875 |
|
|
876 |
EXPORT_C void RMemSpySession::GetSwmtCategoriesL(TInt& aCategories)
|
|
877 |
{
|
|
878 |
TPckgBuf<TInt> cat;
|
|
879 |
TIpcArgs args( &cat );
|
|
880 |
User::LeaveIfError( SendReceive( EMemSpyClientServerOpSystemWideMemoryTrackingCategoriesGet, args ) );
|
|
881 |
aCategories = cat();
|
|
882 |
}
|
|
883 |
|
|
884 |
EXPORT_C void RMemSpySession::GetSwmtHeapDumpsEnabledL(TBool& aEnabled)
|
|
885 |
{
|
|
886 |
TPckgBuf<TBool> enabled;
|
|
887 |
TIpcArgs args( &enabled );
|
|
888 |
User::LeaveIfError( SendReceive( EMemSpyClientServerOpSystemWideMemoryTrackingHeapDumpGet, args ) );
|
|
889 |
|
|
890 |
aEnabled = enabled();
|
|
891 |
}
|
|
892 |
|
|
893 |
EXPORT_C void RMemSpySession::GetSwmtMode(TMemSpyEngineHelperSysMemTrackerConfig::TMemSpyEngineSysMemTrackerMode& aMode)
|
|
894 |
{
|
|
895 |
TPckgBuf<TMemSpyEngineHelperSysMemTrackerConfig::TMemSpyEngineSysMemTrackerMode> mode;
|
|
896 |
TIpcArgs args( &mode );
|
|
897 |
User::LeaveIfError( SendReceive( EMemSpyClientServerOpSystemWideMemoryTrackingModeGet, args ) );
|
|
898 |
aMode = mode();
|
|
899 |
}
|
|
900 |
|
|
901 |
EXPORT_C void RMemSpySession::GetSwmtTimerIntervalL(TInt& aPeriod)
|
|
902 |
{
|
|
903 |
TPckgBuf<TInt> time;
|
|
904 |
TIpcArgs args( &time );
|
|
905 |
User::LeaveIfError(SendReceive(EMemSpyClientServerOpSystemWideMemoryTrackingTimerPeriodGet,
|
|
906 |
args));
|
|
907 |
aPeriod = time();
|
|
908 |
}
|
|
909 |
|
|
910 |
EXPORT_C TInt TMemSpyDeviceWideOperationProgress::Progress() const
|
|
911 |
{
|
|
912 |
return iProgress();
|
|
913 |
}
|
|
914 |
|
|
915 |
EXPORT_C const TDesC& TMemSpyDeviceWideOperationProgress::Description() const
|
|
916 |
{
|
|
917 |
return iDescription;
|
|
918 |
}
|
|
919 |
|
|
920 |
// Servers
|
|
921 |
EXPORT_C void RMemSpySession::GetServersL(RArray<CMemSpyApiServer*> &aServers)
|
|
922 |
{
|
|
923 |
TPckgBuf<TInt> count;
|
|
924 |
User::LeaveIfError(SendReceive(EMemSpyClientServerOpGetServerCount, TIpcArgs(&count)));
|
|
925 |
|
|
926 |
TInt requestedCount = count();
|
62
|
927 |
|
|
928 |
if( requestedCount < 0 )
|
|
929 |
requestedCount = 0;
|
|
930 |
|
51
|
931 |
HBufC8* buffer = HBufC8::NewLC(requestedCount * sizeof(TMemSpyServerData));
|
|
932 |
TPtr8 bufferPtr(buffer->Des());
|
|
933 |
|
|
934 |
User::LeaveIfError(SendReceive(EMemSpyClientServerOpGetServers, TIpcArgs(&count, &bufferPtr)));
|
|
935 |
aServers.Reset();
|
|
936 |
|
|
937 |
TInt receivedCount = Min(count(), requestedCount);
|
|
938 |
for(TInt i=0, offset = 0; i<requestedCount; i++, offset+=sizeof(TMemSpyServerData))
|
|
939 |
{
|
|
940 |
TPckgBuf<TMemSpyServerData> data;
|
|
941 |
data.Copy(bufferPtr.Ptr()+offset, sizeof(TMemSpyServerData));
|
|
942 |
aServers.AppendL(CMemSpyApiServer::NewLC(data()));
|
|
943 |
}
|
|
944 |
CleanupStack::Pop(aServers.Count());
|
|
945 |
CleanupStack::PopAndDestroy(buffer);
|
|
946 |
}
|
|
947 |
|
|
948 |
EXPORT_C void RMemSpySession::GetServersL(RArray<CMemSpyApiServer*> &aServers, TSortType aSortType)
|
|
949 |
{
|
|
950 |
TPckgBuf<TInt> count;
|
|
951 |
TPckgBuf<TSortType> sort( aSortType );
|
|
952 |
User::LeaveIfError(SendReceive(EMemSpyClientServerOpGetServerCount, TIpcArgs(&count)));
|
|
953 |
|
|
954 |
TInt requestedCount = count();
|
62
|
955 |
|
51
|
956 |
HBufC8* buffer = HBufC8::NewLC(requestedCount * sizeof(TMemSpyServerData));
|
|
957 |
TPtr8 bufferPtr(buffer->Des());
|
|
958 |
|
|
959 |
User::LeaveIfError(SendReceive(EMemSpyClientServerOpGetSortedServers, TIpcArgs(&count, &bufferPtr, &sort)));
|
|
960 |
aServers.Reset();
|
|
961 |
|
|
962 |
TInt receivedCount = Min(count(), requestedCount);
|
62
|
963 |
for(TInt i=0, offset = 0; i<receivedCount; i++, offset+=sizeof(TMemSpyServerData))
|
51
|
964 |
{
|
|
965 |
TPckgBuf<TMemSpyServerData> data;
|
|
966 |
data.Copy(bufferPtr.Ptr()+offset, sizeof(TMemSpyServerData));
|
|
967 |
aServers.AppendL(CMemSpyApiServer::NewLC(data()));
|
|
968 |
}
|
|
969 |
CleanupStack::Pop(aServers.Count());
|
|
970 |
CleanupStack::PopAndDestroy(buffer);
|
|
971 |
}
|
|
972 |
|
|
973 |
EXPORT_C void RMemSpySession::ServerListOutputGenericL( TBool aDetailed )
|
|
974 |
{
|
|
975 |
TPckgBuf<TBool> detailed( aDetailed );
|
|
976 |
TIpcArgs args( &detailed );
|
|
977 |
User::LeaveIfError( SendReceive( EMemSpyClientServerOpServerListOutputGeneric, args ) );
|
|
978 |
}
|
|
979 |
|
62
|
980 |
// Chunks
|
|
981 |
|
|
982 |
EXPORT_C void RMemSpySession::GetChunksL(RArray<CMemSpyApiChunk*> &aChunks, TSortType aSortType)
|
|
983 |
{
|
|
984 |
TPckgBuf<TInt> count;
|
|
985 |
TPckgBuf<TSortType> sort( aSortType );
|
|
986 |
User::LeaveIfError(SendReceive(EMemSpyClientServerOpGetChunksCount, TIpcArgs(&count)));
|
|
987 |
|
|
988 |
TInt requestedCount = count();
|
|
989 |
|
|
990 |
HBufC8* buffer = HBufC8::NewLC(requestedCount * sizeof(TMemSpyChunkData));
|
|
991 |
TPtr8 bufferPtr(buffer->Des());
|
|
992 |
|
|
993 |
User::LeaveIfError(SendReceive(EMemSpyClientServerOpGetSortedChunks, TIpcArgs(&count, &bufferPtr, &sort)));
|
|
994 |
aChunks.Reset();
|
|
995 |
|
|
996 |
TInt receivedCount = Min(count(), requestedCount);
|
|
997 |
for(TInt i=0, offset = 0; i<receivedCount; i++, offset+=sizeof(TMemSpyChunkData))
|
|
998 |
{
|
|
999 |
TPckgBuf<TMemSpyChunkData> data;
|
|
1000 |
data.Copy(bufferPtr.Ptr()+offset, sizeof(TMemSpyChunkData));
|
|
1001 |
aChunks.AppendL(CMemSpyApiChunk::NewLC(data()));
|
|
1002 |
}
|
|
1003 |
CleanupStack::Pop(aChunks.Count());
|
|
1004 |
CleanupStack::PopAndDestroy(buffer);
|
|
1005 |
}
|
|
1006 |
|
|
1007 |
EXPORT_C void RMemSpySession::ChunkListOutputL()
|
|
1008 |
{
|
|
1009 |
User::LeaveIfError(SendReceive(EMemSpyClientServerOpChunkListOutput));
|
|
1010 |
}
|
|
1011 |
|
|
1012 |
// RAM info
|
|
1013 |
EXPORT_C void RMemSpySession::IsAknIconCacheConfigurable( TBool& aValue )
|
|
1014 |
{
|
|
1015 |
TPckgBuf<TBool> arg( aValue );
|
|
1016 |
TIpcArgs args( &arg );
|
|
1017 |
|
|
1018 |
User::LeaveIfError(SendReceive( EMemSpyClientServerOpIsAknIconCacheConfigurable, args ));
|
|
1019 |
|
|
1020 |
aValue = arg();
|
|
1021 |
}
|
|
1022 |
|
|
1023 |
EXPORT_C void RMemSpySession::SetAknIconCacheStatusL( TBool aEnabled, TInt64& aValue )
|
|
1024 |
{
|
|
1025 |
TPckgBuf<TBool> arg1( aEnabled );
|
|
1026 |
TPckgBuf<TInt64> arg2( aValue );
|
|
1027 |
TIpcArgs args( &arg1, &arg2 );
|
|
1028 |
|
|
1029 |
User::LeaveIfError(SendReceive( EMemSpyClientServerOpSetAknIconCacheStatus, args ));
|
|
1030 |
|
|
1031 |
aValue=arg2();
|
|
1032 |
}
|
|
1033 |
|
|
1034 |
// Code Segments
|
|
1035 |
EXPORT_C void RMemSpySession::GetCodeSegmentsL(RArray<CMemSpyApiCodeSegment*> &aCodeSegments, TSortType aSortType)
|
|
1036 |
{
|
|
1037 |
TPckgBuf<TInt> count;
|
|
1038 |
TPckgBuf<TSortType> sort( aSortType );
|
|
1039 |
User::LeaveIfError(SendReceive(EMemSpyClientServerOpGetCodeSegmentsCount, TIpcArgs(&count)));
|
|
1040 |
|
|
1041 |
TInt requestedCount = count();
|
|
1042 |
|
|
1043 |
HBufC8* buffer = HBufC8::NewLC(requestedCount * sizeof(TMemSpyCodeSegmentData));
|
|
1044 |
TPtr8 bufferPtr(buffer->Des());
|
|
1045 |
|
|
1046 |
User::LeaveIfError(SendReceive(EMemSpyClientServerOpGetSortedCodeSegments, TIpcArgs(&count, &bufferPtr, &sort)));
|
|
1047 |
aCodeSegments.Reset();
|
|
1048 |
|
|
1049 |
TInt receivedCount = Min(count(), requestedCount);
|
|
1050 |
for(TInt i=0, offset = 0; i<receivedCount; i++, offset+=sizeof(TMemSpyCodeSegmentData))
|
|
1051 |
{
|
|
1052 |
TPckgBuf<TMemSpyCodeSegmentData> data;
|
|
1053 |
data.Copy(bufferPtr.Ptr()+offset, sizeof(TMemSpyCodeSegmentData));
|
|
1054 |
aCodeSegments.AppendL(CMemSpyApiCodeSegment::NewLC(data()));
|
|
1055 |
}
|
|
1056 |
CleanupStack::Pop(aCodeSegments.Count());
|
|
1057 |
CleanupStack::PopAndDestroy(buffer);
|
|
1058 |
}
|
|
1059 |
|
|
1060 |
EXPORT_C void RMemSpySession::CodeSegmentsListOutputL()
|
|
1061 |
{
|
|
1062 |
User::LeaveIfError(SendReceive(EMemSpyClientServerOpCodeSegmentsOutput));
|
|
1063 |
}
|
|
1064 |
|