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