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 |
#include <QMessageBox>
|
|
19 |
|
|
20 |
#include <memspy/engine/memspyenginehelpersysmemtrackerconfig.h>
|
|
21 |
|
|
22 |
#include "enginewrapper.h"
|
|
23 |
|
|
24 |
// CONSTANTS
|
|
25 |
|
|
26 |
const QString OUTPUT_MODE = "output/mode";
|
|
27 |
const QString OUTPUT_PATH = "output/path";
|
|
28 |
const QString SWMT_PERIOD = "swmt/period";
|
|
29 |
const QString SWMT_MODE = "swmt/mode";
|
|
30 |
const QString SWMT_CATEGORIES = "swmt/categories";
|
|
31 |
const QString HEAP_DUMPS_MODE = "heapdumps/mode";
|
|
32 |
|
|
33 |
QString MemSpyProcess::exitInfo() const
|
|
34 |
{
|
|
35 |
QChar exitType[] = {'K', 'T', 'P', 'R'};
|
|
36 |
QString result = QString("[%1]").arg(exitType[mProcess->ExitType()]);
|
|
37 |
|
|
38 |
if (mProcess->ExitType() != EExitKill && mProcess->ExitType() != EExitPending) {
|
|
39 |
|
|
40 |
QString exitCategory = QString((QChar*) mProcess->ExitCategory().Ptr(), mProcess->ExitCategory().Length());
|
|
41 |
result.append(QString(" %1-%2").arg(exitCategory).arg(mProcess->ExitReason()));
|
|
42 |
}
|
|
43 |
|
|
44 |
return result;
|
|
45 |
}
|
|
46 |
|
|
47 |
|
|
48 |
MemSpyDwoProgressTracker::MemSpyDwoProgressTracker(RMemSpySession &session) :
|
|
49 |
CActive(EPriorityStandard), mSession(session)
|
|
50 |
{
|
|
51 |
CActiveScheduler::Add(this);
|
|
52 |
}
|
|
53 |
|
|
54 |
MemSpyDwoProgressTracker::~MemSpyDwoProgressTracker()
|
|
55 |
{
|
|
56 |
Cancel();
|
|
57 |
}
|
|
58 |
|
|
59 |
void MemSpyDwoProgressTracker::start()
|
|
60 |
{
|
|
61 |
mSession.NotifyDeviceWideOperationProgress(mProgress, iStatus);
|
|
62 |
|
|
63 |
SetActive();
|
|
64 |
}
|
|
65 |
|
|
66 |
void MemSpyDwoProgressTracker::cancel()
|
|
67 |
{
|
|
68 |
Cancel();
|
|
69 |
}
|
|
70 |
|
|
71 |
// Event handler method.
|
|
72 |
|
|
73 |
void MemSpyDwoProgressTracker::RunL()
|
|
74 |
{
|
|
75 |
|
|
76 |
// If an error occurred handle it in RunError().
|
|
77 |
User::LeaveIfError(iStatus.Int());
|
|
78 |
|
|
79 |
// Resubmit the request immediately
|
|
80 |
|
|
81 |
mSession.NotifyDeviceWideOperationProgress(mProgress, iStatus);
|
|
82 |
|
|
83 |
SetActive();
|
|
84 |
|
|
85 |
emit progress(mProgress.Progress(), QString((QChar*) mProgress.Description().Ptr(), mProgress.Description().Length()));
|
|
86 |
}
|
|
87 |
|
|
88 |
void MemSpyDwoProgressTracker::DoCancel()
|
|
89 |
{
|
|
90 |
// this is not yet implemented, as it is not required in current use cases
|
|
91 |
}
|
|
92 |
|
|
93 |
TInt MemSpyDwoProgressTracker::RunError(TInt aError)
|
|
94 |
{
|
|
95 |
// KErrNotReady and KErrCancel errors are OK, they just notify
|
|
96 |
// us about the outstanding notification request that won't be
|
|
97 |
// processed.
|
|
98 |
Q_UNUSED(aError);
|
|
99 |
|
|
100 |
return KErrNone;
|
|
101 |
}
|
|
102 |
|
|
103 |
MemSpyDwoTracker::MemSpyDwoTracker(RMemSpySession &session, DeviceWideOperation operation) :
|
|
104 |
CActive(EPriorityStandard),
|
|
105 |
mSession(session),
|
|
106 |
mProgressTracker(new MemSpyDwoProgressTracker(session)),
|
|
107 |
mOperation(operation)
|
|
108 |
{
|
|
109 |
CActiveScheduler::Add(this);
|
|
110 |
connect(mProgressTracker, SIGNAL(progress(int,QString)), this, SIGNAL(progress(int,QString)));
|
|
111 |
}
|
|
112 |
|
|
113 |
MemSpyDwoTracker::~MemSpyDwoTracker()
|
|
114 |
{
|
|
115 |
Cancel();
|
|
116 |
|
|
117 |
delete mProgressTracker;
|
|
118 |
}
|
|
119 |
|
|
120 |
void MemSpyDwoTracker::start()
|
|
121 |
{
|
|
122 |
void (RMemSpySession::*functions[])(TRequestStatus&) = {
|
|
123 |
&RMemSpySession::OutputPhoneInfo,
|
|
124 |
&RMemSpySession::OutputDetailedPhoneInfo,
|
|
125 |
&RMemSpySession::OutputHeapInfo,
|
|
126 |
&RMemSpySession::OutputCompactHeapInfo,
|
|
127 |
&RMemSpySession::OutputHeapCellListing,
|
|
128 |
&RMemSpySession::OutputHeapData,
|
|
129 |
&RMemSpySession::OutputStackInfo,
|
|
130 |
&RMemSpySession::OutputCompactStackInfo,
|
|
131 |
&RMemSpySession::OutputUserStackData,
|
|
132 |
&RMemSpySession::OutputKernelStackData };
|
|
133 |
|
|
134 |
(mSession.*functions[mOperation])(iStatus);
|
|
135 |
|
|
136 |
mProgressTracker->start();
|
|
137 |
|
|
138 |
SetActive();
|
|
139 |
}
|
|
140 |
|
|
141 |
void MemSpyDwoTracker::cancel()
|
|
142 |
{
|
|
143 |
Cancel();
|
|
144 |
}
|
|
145 |
|
|
146 |
// Event handler method.
|
|
147 |
|
|
148 |
void MemSpyDwoTracker::RunL()
|
|
149 |
{
|
|
150 |
|
|
151 |
// If an error occurred handle it in RunError().
|
|
152 |
User::LeaveIfError(iStatus.Int());
|
|
153 |
|
|
154 |
// Operation has finished successfully
|
|
155 |
emit finished(0);
|
|
156 |
}
|
|
157 |
|
|
158 |
void MemSpyDwoTracker::DoCancel()
|
|
159 |
{
|
|
160 |
// Cancel progress tracker
|
|
161 |
mProgressTracker->cancel();
|
|
162 |
|
|
163 |
mSession.CancelDeviceWideOperationL();
|
|
164 |
}
|
|
165 |
|
|
166 |
TInt MemSpyDwoTracker::RunError(TInt aError)
|
|
167 |
{
|
|
168 |
// Emit the finished signal to notify user
|
|
169 |
// operation was canceled
|
|
170 |
emit finished(aError);
|
|
171 |
|
|
172 |
return KErrNone;
|
|
173 |
}
|
|
174 |
|
|
175 |
MemSpyAsyncTracker::MemSpyAsyncTracker(RMemSpySession& session, void (RMemSpySession::*function)(TRequestStatus&)) :
|
|
176 |
CActive(EPriorityStandard),
|
|
177 |
mFunction(function),
|
|
178 |
mSession(session)
|
|
179 |
{
|
|
180 |
CActiveScheduler::Add(this);
|
|
181 |
}
|
|
182 |
|
|
183 |
void MemSpyAsyncTracker::RunL()
|
|
184 |
{
|
|
185 |
// If an error occurred handle it in RunError().
|
|
186 |
User::LeaveIfError(iStatus.Int());
|
|
187 |
|
|
188 |
// Operation has finished successfully
|
|
189 |
emit finished(0);
|
|
190 |
}
|
|
191 |
|
|
192 |
void MemSpyAsyncTracker::DoCancel()
|
|
193 |
{
|
|
194 |
// nothing to do here
|
|
195 |
}
|
|
196 |
|
|
197 |
TInt MemSpyAsyncTracker::RunError(TInt aError)
|
|
198 |
{
|
|
199 |
// Emit the finished signal to notify user
|
|
200 |
// that operation was canceled
|
|
201 |
emit finished(aError);
|
|
202 |
|
|
203 |
return KErrNone;
|
|
204 |
}
|
|
205 |
|
|
206 |
void MemSpyAsyncTracker::start()
|
|
207 |
{
|
|
208 |
(mSession.*mFunction)(iStatus);
|
|
209 |
|
|
210 |
SetActive();
|
|
211 |
}
|
|
212 |
|
|
213 |
MemSpySettings::MemSpySettings() :
|
|
214 |
QSettings("Nokia", "MemSpy")
|
|
215 |
{
|
|
216 |
}
|
|
217 |
|
|
218 |
OutputMode MemSpySettings::outputMode() const
|
|
219 |
{
|
|
220 |
return static_cast<OutputMode>(value(OUTPUT_MODE, 0).toInt());
|
|
221 |
}
|
|
222 |
|
|
223 |
void MemSpySettings::setOutputMode(OutputMode mode)
|
|
224 |
{
|
|
225 |
setValue(OUTPUT_MODE, mode);
|
|
226 |
}
|
|
227 |
|
|
228 |
QString MemSpySettings::outputPath() const
|
|
229 |
{
|
|
230 |
return value(OUTPUT_PATH).toString();
|
|
231 |
}
|
|
232 |
|
|
233 |
void MemSpySettings::setOutputPath(const QString& path)
|
|
234 |
{
|
|
235 |
setValue(OUTPUT_PATH, path);
|
|
236 |
}
|
|
237 |
|
|
238 |
int MemSpySettings::swmtTimerPeriod() const
|
|
239 |
{
|
|
240 |
return value(SWMT_PERIOD, 30).toInt();
|
|
241 |
}
|
|
242 |
|
|
243 |
void MemSpySettings::setSwmtMode(SwmtMode mode)
|
|
244 |
{
|
|
245 |
setValue(SWMT_MODE, mode);
|
|
246 |
}
|
|
247 |
|
|
248 |
SwmtMode MemSpySettings::swmtMode() const
|
|
249 |
{
|
|
250 |
return static_cast<SwmtMode>(value(SWMT_MODE, 0).toInt());
|
|
251 |
}
|
|
252 |
|
|
253 |
void MemSpySettings::setSwmtTimerPeriod(int period)
|
|
254 |
{
|
|
255 |
setValue(SWMT_PERIOD, period);
|
|
256 |
}
|
|
257 |
|
|
258 |
|
|
259 |
QVariantList MemSpySettings::swmtCategories() const
|
|
260 |
{
|
|
261 |
return value(SWMT_CATEGORIES).toList();
|
|
262 |
}
|
|
263 |
|
|
264 |
void MemSpySettings::setSwmtCategories(const QVariantList& categories)
|
|
265 |
{
|
|
266 |
setValue(SWMT_CATEGORIES, categories);
|
|
267 |
}
|
|
268 |
|
|
269 |
HeapDumpsMode MemSpySettings::heapDumpsMode() const
|
|
270 |
{
|
|
271 |
return static_cast<HeapDumpsMode>(value(HEAP_DUMPS_MODE).toInt());
|
|
272 |
}
|
|
273 |
|
|
274 |
void MemSpySettings::setHeapDumpsMode(HeapDumpsMode mode)
|
|
275 |
{
|
|
276 |
setValue(HEAP_DUMPS_MODE, mode);
|
|
277 |
}
|
|
278 |
|
|
279 |
|
|
280 |
EngineWrapper::EngineWrapper() :
|
|
281 |
mSwmtRunning(false)
|
|
282 |
{
|
|
283 |
}
|
|
284 |
|
|
285 |
EngineWrapper::~EngineWrapper()
|
|
286 |
{
|
|
287 |
mSession.Close();
|
|
288 |
}
|
|
289 |
|
|
290 |
bool EngineWrapper::initialize()
|
|
291 |
{
|
|
292 |
return mSession.Connect() == KErrNone;
|
|
293 |
}
|
|
294 |
|
|
295 |
MemSpySettings& EngineWrapper::settings()
|
|
296 |
{
|
|
297 |
return mSettings;
|
|
298 |
}
|
|
299 |
|
|
300 |
const MemSpySettings& EngineWrapper::settings() const
|
|
301 |
{
|
|
302 |
return mSettings;
|
|
303 |
}
|
|
304 |
|
|
305 |
|
|
306 |
|
|
307 |
QList<MemSpyProcess*> EngineWrapper::getProcesses()
|
|
308 |
{
|
|
309 |
QList<MemSpyProcess*> result;
|
|
310 |
|
|
311 |
RArray<CMemSpyApiProcess*> proc;
|
|
312 |
|
|
313 |
QT_TRAP_THROWING(mSession.GetProcessesL(proc));
|
|
314 |
|
|
315 |
for (TInt i=0; i<proc.Count(); i++)
|
|
316 |
result.append(new MemSpyProcess(proc[i]));
|
|
317 |
|
|
318 |
return result;
|
|
319 |
}
|
|
320 |
|
|
321 |
QList<MemSpyThread*> EngineWrapper::getThreads(ProcessId processId)
|
|
322 |
{
|
|
323 |
QList<MemSpyThread*> result;
|
|
324 |
|
|
325 |
RArray<CMemSpyApiThread*> proc;
|
|
326 |
|
|
327 |
QT_TRAP_THROWING(mSession.GetThreadsL(processId, proc));
|
|
328 |
|
|
329 |
for (TInt i=0; i<proc.Count(); i++)
|
|
330 |
result.append(new MemSpyThread(proc[i]));
|
|
331 |
|
|
332 |
return result;
|
|
333 |
}
|
|
334 |
|
|
335 |
QList<MemSpyThreadInfoItem*> EngineWrapper::getThreadInfo(ThreadId threadId, ThreadInfoType type)
|
|
336 |
{
|
|
337 |
QList<MemSpyThreadInfoItem*> result;
|
|
338 |
RArray<CMemSpyApiThreadInfoItem*> threadInfo;
|
|
339 |
qt_symbian_throwIfError(mSession.GetThreadInfoItems(threadInfo, threadId,
|
|
340 |
static_cast<TMemSpyThreadInfoItemType>(type)));
|
|
341 |
|
|
342 |
for (TInt i=0; i<threadInfo.Count(); i++)
|
|
343 |
result.append(new MemSpyThreadInfoItem(threadInfo[i]));
|
|
344 |
|
|
345 |
return result;
|
|
346 |
}
|
|
347 |
|
|
348 |
void EngineWrapper::setThreadPriority(ThreadId threadId, ThreadPriority priority)
|
|
349 |
{
|
|
350 |
TRAP_IGNORE(mSession.SetThreadPriorityL(threadId, priority));
|
|
351 |
}
|
|
352 |
|
|
353 |
QList<MemSpyKernelObjectType*> EngineWrapper::getKernelObjectTypes()
|
|
354 |
{
|
|
355 |
QList<MemSpyKernelObjectType*> result;
|
|
356 |
|
|
357 |
RArray<CMemSpyApiKernelObject*> types;
|
|
358 |
qt_symbian_throwIfError(mSession.GetKernelObjects(types));
|
|
359 |
|
|
360 |
for(TInt i=0; i<types.Count(); i++)
|
|
361 |
result.append(new MemSpyKernelObjectType(types[i]));
|
|
362 |
|
|
363 |
return result;
|
|
364 |
}
|
|
365 |
|
|
366 |
QList<MemSpyKernelObject*> EngineWrapper::getKernelObjects(int type)
|
|
367 |
{
|
|
368 |
QList<MemSpyKernelObject*> result;
|
|
369 |
|
|
370 |
RArray<CMemSpyApiKernelObjectItem*> objects;
|
|
371 |
qt_symbian_throwIfError(mSession.GetKernelObjectItems(objects,
|
|
372 |
static_cast<TMemSpyDriverContainerType>(type)));
|
|
373 |
|
|
374 |
for (TInt i=0; i<objects.Count(); i++)
|
|
375 |
result.append(new MemSpyKernelObject(objects[i]));
|
|
376 |
|
|
377 |
return result;
|
|
378 |
}
|
|
379 |
|
|
380 |
QList<MemSpyServer*> EngineWrapper::getServers()
|
|
381 |
{
|
|
382 |
QList<MemSpyServer*> result;
|
|
383 |
|
|
384 |
RArray<CMemSpyApiServer*> proc;
|
|
385 |
|
|
386 |
QT_TRAP_THROWING(mSession.GetServersL(proc));
|
|
387 |
|
|
388 |
for (TInt i=0; i<proc.Count(); i++)
|
|
389 |
result.append(new MemSpyServer(proc[i]));
|
|
390 |
|
|
391 |
return result;
|
|
392 |
}
|
|
393 |
|
|
394 |
QList<MemSpyEComCategory*> EngineWrapper::getEComCategories()
|
|
395 |
{
|
|
396 |
QList<MemSpyEComCategory*> result;
|
|
397 |
|
|
398 |
RArray<CMemSpyApiEComCategory*> cat;
|
|
399 |
|
|
400 |
QT_TRAP_THROWING(mSession.GetEComCategoriesL(cat));
|
|
401 |
|
|
402 |
for (TInt i=0; i<cat.Count(); i++)
|
|
403 |
result.append(new MemSpyEComCategory(cat[i]));
|
|
404 |
|
|
405 |
return result;
|
|
406 |
}
|
|
407 |
|
|
408 |
QList<MemSpyEComInterface*> EngineWrapper::getEComInterfaces(int categoryId)
|
|
409 |
{
|
|
410 |
QList<MemSpyEComInterface*> result;
|
|
411 |
|
|
412 |
RArray<CMemSpyApiEComInterface*> interfaces;
|
|
413 |
|
|
414 |
QT_TRAP_THROWING(mSession.GetEComInterfacesL(TUid::Uid(categoryId), interfaces));
|
|
415 |
|
|
416 |
for (TInt i=0; i<interfaces.Count(); i++)
|
|
417 |
result.append(new MemSpyEComInterface(interfaces[i]));
|
|
418 |
|
|
419 |
return result;
|
|
420 |
}
|
|
421 |
|
|
422 |
QList<MemSpyEComImplementation*> EngineWrapper::getEComImplementations(int interfaceId)
|
|
423 |
{
|
|
424 |
QList<MemSpyEComImplementation*> result;
|
|
425 |
|
|
426 |
RArray<CMemSpyApiEComImplementation*> implementations;
|
|
427 |
|
|
428 |
QT_TRAP_THROWING(mSession.GetEComImplementationsL(TUid::Uid(interfaceId), implementations));
|
|
429 |
|
|
430 |
for (TInt i=0; i<implementations.Count(); i++)
|
|
431 |
result.append(new MemSpyEComImplementation(implementations[i]));
|
|
432 |
|
|
433 |
return result;
|
|
434 |
}
|
|
435 |
|
52
|
436 |
QList<MemSpyWindowGroup*> EngineWrapper::getWindowGroups()
|
|
437 |
{
|
|
438 |
QList<MemSpyWindowGroup*> result;
|
|
439 |
|
|
440 |
RArray<CMemSpyApiWindowGroup*> groups;
|
|
441 |
|
|
442 |
QT_TRAP_THROWING(mSession.GetWindowGroupsL(groups));
|
|
443 |
|
|
444 |
for (TInt i=0; i<groups.Count(); i++)
|
|
445 |
result.append(new MemSpyWindowGroup(groups[i]));
|
|
446 |
|
|
447 |
return result;
|
|
448 |
}
|
|
449 |
|
51
|
450 |
|
|
451 |
MemSpyDwoTracker* EngineWrapper::createDeviceWideOperation(DeviceWideOperation operation)
|
|
452 |
{
|
|
453 |
return new MemSpyDwoTracker(mSession, operation);
|
|
454 |
}
|
|
455 |
|
|
456 |
MemSpyKernelHeapDumpTracker* EngineWrapper::createKernelHeapDumpTracker()
|
|
457 |
{
|
|
458 |
return new MemSpyKernelHeapDumpTracker(mSession);
|
|
459 |
}
|
|
460 |
|
|
461 |
MemSpySwmtDumpTracker* EngineWrapper::createSwmtDumpTracker()
|
|
462 |
{
|
|
463 |
return new MemSpySwmtDumpTracker(mSession);
|
|
464 |
}
|
|
465 |
|
|
466 |
void EngineWrapper::setSwmtSettings(SwmtMode mode, const QVariantList& categories)
|
|
467 |
{
|
|
468 |
int bits = 0;
|
|
469 |
bool heapDumps = false;
|
|
470 |
switch (mode)
|
|
471 |
{
|
|
472 |
case SwmtModeBasic:
|
|
473 |
bits = TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryUserHeap |
|
52
|
474 |
//TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryUserStacks |
|
|
475 |
//TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryGlobalData |
|
51
|
476 |
TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategorySystemMemory;
|
|
477 |
|
|
478 |
break;
|
|
479 |
|
|
480 |
case SwmtModeFull:
|
|
481 |
bits = TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryAll;
|
|
482 |
heapDumps = true;
|
|
483 |
|
|
484 |
break;
|
|
485 |
|
|
486 |
case SwmtModeCustom:
|
|
487 |
bits = 0;
|
|
488 |
// this needs to be in sync. with swmt view categories
|
|
489 |
TMemSpyEngineHelperSysMemTrackerConfig::TMemSpyEngineSysMemTrackerCategories cats[] = {
|
|
490 |
TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryFileServerCache,
|
|
491 |
//TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryBitmapHandles,
|
|
492 |
TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryUserHeap,
|
|
493 |
//TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryKernelHeap,
|
|
494 |
TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryLocalChunks,
|
|
495 |
TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryGlobalChunks,
|
|
496 |
TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryRAMDrive,
|
|
497 |
//TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryUserStacks,
|
|
498 |
//TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryGlobalData,
|
|
499 |
TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryRAMLoadedCode,
|
|
500 |
TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryKernelHandles,
|
|
501 |
TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryOpenFiles,
|
|
502 |
TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryDiskusage,
|
|
503 |
TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategorySystemMemory,
|
|
504 |
TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryWindowGroups
|
|
505 |
};
|
|
506 |
|
|
507 |
foreach (const QVariant& bit, categories)
|
|
508 |
bits |= cats[bit.toInt()];
|
|
509 |
|
|
510 |
break;
|
|
511 |
}
|
|
512 |
|
|
513 |
TRAP_IGNORE(mSession.SetSwmtCategoriesL(bits));
|
|
514 |
TRAP_IGNORE(mSession.SetSwmtHeapDumpsEnabledL(heapDumps));
|
|
515 |
}
|
|
516 |
|
|
517 |
bool EngineWrapper::isSwmtRunning()
|
|
518 |
{
|
|
519 |
return mSwmtRunning;
|
|
520 |
}
|
|
521 |
|
|
522 |
void EngineWrapper::startSwmt(int period)
|
|
523 |
{
|
|
524 |
mSwmtRunning = true;
|
|
525 |
updateOutputSettings();
|
|
526 |
TRAP_IGNORE(mSession.StartSwmtTimerL(period));
|
|
527 |
}
|
|
528 |
|
|
529 |
void EngineWrapper::stopSwmt()
|
|
530 |
{
|
|
531 |
mSwmtRunning = false;
|
|
532 |
TRAP_IGNORE(mSession.StopSwmtTimerL());
|
|
533 |
}
|
|
534 |
|
|
535 |
void EngineWrapper::forceSwmtDump()
|
|
536 |
{
|
|
537 |
updateOutputSettings();
|
|
538 |
TRAP_IGNORE(mSession.ForceSwmtUpdateL());
|
|
539 |
}
|
|
540 |
|
|
541 |
void EngineWrapper::outputKernelHeapData()
|
|
542 |
{
|
|
543 |
updateOutputSettings();
|
|
544 |
TRAP_IGNORE(mSession.OutputKernelHeapDataL());
|
|
545 |
}
|
|
546 |
|
|
547 |
int EngineWrapper::outputThreadHeapData(const QString& filter)
|
|
548 |
{
|
|
549 |
TPtrC customFilterDesc(static_cast<const TUint16*>(filter.utf16()), filter.length());
|
|
550 |
|
|
551 |
TRAPD(err, mSession.OutputThreadHeapDataL(customFilterDesc));
|
|
552 |
|
|
553 |
return err;
|
|
554 |
}
|
|
555 |
|
|
556 |
void EngineWrapper::updateOutputSettings()
|
|
557 |
{
|
|
558 |
switch (mSettings.outputMode()) {
|
|
559 |
case OutputModeTrace:
|
|
560 |
TRAP_IGNORE(mSession.SwitchOutputToTraceL());
|
|
561 |
break;
|
|
562 |
|
|
563 |
case OutputModeFile:
|
|
564 |
|
|
565 |
if (mSettings.outputPath().isEmpty()) {
|
|
566 |
TRAP_IGNORE(mSession.SwitchOutputToFileL(KNullDesC));
|
|
567 |
|
|
568 |
} else {
|
|
569 |
|
|
570 |
QString root = mSettings.outputPath();
|
|
571 |
TPtrC rootDesc (static_cast<const TUint16*>(root.utf16()), root.length());
|
|
572 |
|
|
573 |
TRAP_IGNORE(mSession.SwitchOutputToFileL(rootDesc));
|
|
574 |
}
|
|
575 |
|
|
576 |
}
|
|
577 |
}
|
|
578 |
|
|
579 |
void EngineWrapper::killProcess(ProcessId process)
|
|
580 |
{
|
|
581 |
TRAP_IGNORE(mSession.EndProcessL(process, EKill));
|
|
582 |
}
|
|
583 |
|
|
584 |
void EngineWrapper::panicProcess(ProcessId process)
|
|
585 |
{
|
|
586 |
TRAP_IGNORE(mSession.EndProcessL(process, EPanic));
|
|
587 |
}
|
|
588 |
|
|
589 |
void EngineWrapper::terminateProcess(ProcessId process)
|
|
590 |
{
|
|
591 |
TRAP_IGNORE(mSession.EndProcessL(process, ETerminate));
|
|
592 |
}
|