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 #ifndef MEMSPYSESSION_H |
|
20 #define MEMSPYSESSION_H |
|
21 |
|
22 |
|
23 // System includes |
|
24 #include <e32base.h> |
|
25 #include <u32std.h> |
|
26 |
|
27 //user includes |
|
28 #include <memspy/api/memspyapiprocess.h> |
|
29 |
|
30 #include <memspy/api/memspyapithread.h> |
|
31 #include <memspy/api/memspyapithreadinfoitem.h> |
|
32 #include <memspy/engine/memspythreadinfoitemdata.h> |
|
33 #include <memspy/engine/memspyengineobjectthreadinfoobjects.h> |
|
34 #include <memspy/engine/memspydevicewideoperations.h> |
|
35 |
|
36 #include <memspy/api/memspyapikernelobject.h> |
|
37 |
|
38 #include <memspy/api/memspyapikernelobjectitem.h> //for KernelObjectItems |
|
39 |
|
40 #include <memspy/api/memspyapiheap.h> |
|
41 |
|
42 #include <memspy/api/memspyapimemorytrackingcycle.h> |
|
43 |
|
44 #include <memspyengineclientinterface.h> |
|
45 #include <memspy/engine/memspyengineoutputsinktype.h> |
|
46 |
|
47 #include <memspy/engine/memspyenginehelpersysmemtrackerconfig.h> |
|
48 |
|
49 #include <memspy/api/memspyapiserver.h> |
|
50 |
|
51 #include <memspy/api/memspyapiecom.h> |
|
52 |
|
53 // Constants |
|
54 const TInt KMemSpyVersion = 2; |
|
55 |
|
56 enum TSortType |
|
57 { |
|
58 ESortProcById, |
|
59 ESortProcByName, |
|
60 ESortProcByThreadCount, |
|
61 ESortProcByCodeSegs, |
|
62 ESortProcByHeapUsage, |
|
63 ESortProcByStackUsage, |
|
64 ESortServByName, |
|
65 ESortServBySessionCount |
|
66 }; |
|
67 |
|
68 enum TMemSpyOutputType |
|
69 { |
|
70 EOutputTypeDebug = 0, |
|
71 EOutputTypeFile |
|
72 }; |
|
73 |
|
74 class TMemSpyDeviceWideOperationProgress |
|
75 { |
|
76 public: |
|
77 IMPORT_C TInt Progress() const; |
|
78 IMPORT_C const TDesC& Description() const; |
|
79 |
|
80 private: |
|
81 TPckgBuf<TInt> iProgress; |
|
82 TFullName iDescription; |
|
83 |
|
84 friend class RMemSpySession; |
|
85 }; |
|
86 |
|
87 |
|
88 NONSHARABLE_CLASS( RMemSpySession ) : public RSessionBase |
|
89 { |
|
90 public: |
|
91 IMPORT_C RMemSpySession(); |
|
92 IMPORT_C TInt Connect(); |
|
93 |
|
94 public: //API |
|
95 //Thread speciifc operations |
|
96 IMPORT_C void OutputKernelHeapDataL(); //EMemSpyClientServerOpHeapData |
|
97 |
|
98 IMPORT_C void OutputKernelHeapData(TRequestStatus& aStatus); //EMemSpyClientServerOpHeapData |
|
99 |
|
100 IMPORT_C void OutputThreadHeapDataL(TThreadId aThreadId); //EMemSpyClientServerOpHeapData |
|
101 |
|
102 IMPORT_C void OutputThreadHeapDataL(const TDesC& aThreadName); //EMemSpyClientServerOpHeapData |
|
103 |
|
104 IMPORT_C void OutputThreadCellListL(TThreadId aThreadId);//EMemSpyClientServerOpHeapCellListing |
|
105 |
|
106 IMPORT_C void OutputHeapInfoUserL(TThreadId aThreadId); //EMemSpyClientServerOpHeapInfo |
|
107 |
|
108 IMPORT_C void SwitchOutputSinkL( TMemSpySinkType aType); //EMemSpyClientServerOpSwitchOutputSinkFile / EMemSpyClientServerOpSwitchOutputSinkTrace |
|
109 |
|
110 IMPORT_C void SwitchOutputToTraceL(); // EMemSpyClientServerOpSwitchOutputSinkTrace |
|
111 |
|
112 IMPORT_C void SwitchOutputToFileL(const TDesC& aRootFolder); // EMemSpyClientServerOpSwitchOutputSinkFile |
|
113 |
|
114 IMPORT_C void OutputStackInfoL(TThreadId aThreadId); //EMemSpyClientServerOpStackInfo |
|
115 |
|
116 IMPORT_C void OutputStackDataL(TThreadId aThreadId, TMemSpyDriverDomainType aType ); //EMemSpyClientServerOpStackDataUser / EMemSpyClientServerOpStackDataKernel |
|
117 |
|
118 IMPORT_C void OutputThreadInfoHandlesL(TThreadId aThreadId); //EMemSpyClientServerOpOutputInfoHandles |
|
119 |
|
120 IMPORT_C void OutputAOListL(TThreadId aId, TMemSpyThreadInfoItemType aType); //EMemSpyClientServerOpOutputAOList |
|
121 |
|
122 IMPORT_C void OutputKernelObjectsL();// EMemSpyClientServerOpEnumerateKernelContainerAll |
|
123 |
|
124 IMPORT_C void OutputCompactStackInfoL();// EMemSpyClientServerOpStackInfoCompact |
|
125 |
|
126 IMPORT_C void OutputCompactHeapInfoL();// EMemSpyClientServerOpHeapInfoCompact |
|
127 |
|
128 // Device Wide Operations |
|
129 // Synchronous operations - for CLI |
|
130 IMPORT_C void OutputHeapData(); |
|
131 |
|
132 // Asynchronous operations |
|
133 IMPORT_C void OutputPhoneInfo(TRequestStatus& aStatus); |
|
134 |
|
135 IMPORT_C void OutputDetailedPhoneInfo(TRequestStatus& aStatus); |
|
136 |
|
137 IMPORT_C void OutputHeapInfo(TRequestStatus& aStatus); |
|
138 |
|
139 IMPORT_C void OutputCompactHeapInfo(TRequestStatus &aStatus); |
|
140 |
|
141 IMPORT_C void OutputHeapCellListing(TRequestStatus& aStatus); |
|
142 |
|
143 IMPORT_C void OutputHeapData(TRequestStatus& aStatus); |
|
144 |
|
145 IMPORT_C void OutputStackInfo(TRequestStatus& aStatus); |
|
146 |
|
147 IMPORT_C void OutputCompactStackInfo(TRequestStatus &aStatus); |
|
148 |
|
149 IMPORT_C void OutputUserStackData(TRequestStatus& aStatus); |
|
150 |
|
151 IMPORT_C void OutputKernelStackData(TRequestStatus& aStatus); |
|
152 |
|
153 IMPORT_C void NotifyDeviceWideOperationProgress(TMemSpyDeviceWideOperationProgress &aProgress, TRequestStatus &aStatus); |
|
154 |
|
155 IMPORT_C void CancelDeviceWideOperationL(); |
|
156 |
|
157 // Synchronous operations for MemSpyLauncher |
|
158 IMPORT_C void OutputPhoneInfo(); |
|
159 |
|
160 // "Ui" operations |
|
161 |
|
162 IMPORT_C void GetProcessesL(RArray<CMemSpyApiProcess*> &aProcesses, TSortType aSortType = ESortProcById); |
|
163 |
|
164 IMPORT_C TProcessId GetProcessIdByNameL(const TDesC& aProcessName); |
|
165 |
|
166 IMPORT_C void GetThreadsL(TProcessId aProcessId, RArray<CMemSpyApiThread*> &aThreads, TSortType aSortType = ESortProcById); |
|
167 |
|
168 IMPORT_C TInt ProcessSystemPermanentOrCritical( TProcessId aId, TBool aValue ); //aValue -> return value |
|
169 |
|
170 IMPORT_C void SetThreadPriorityL(TThreadId aId, TInt aPriority); |
|
171 |
|
172 IMPORT_C TInt EndProcessL( TProcessId aId, TMemSpyEndType aType ); |
|
173 |
|
174 IMPORT_C TInt SwitchToProcess( TProcessId aId, TBool aBrought ); |
|
175 |
|
176 IMPORT_C void GetProcessIdByThreadId( TProcessId& aPID, TThreadId aTID ); |
|
177 |
|
178 //SWMT operations |
|
179 |
|
180 IMPORT_C void GetMemoryTrackingCyclesL(RArray<CMemSpyApiMemoryTrackingCycle*>& aCycles); |
|
181 |
|
182 IMPORT_C TInt GetSwmtCyclesCount(); |
|
183 |
|
184 IMPORT_C void SetSwmtAutoStartProcessList( CArrayFixFlat<TUid>* aList ); |
|
185 |
|
186 IMPORT_C void SetSwmtFilter( const TDesC& aFilter ); |
|
187 |
|
188 IMPORT_C void SetSwmtCategoriesL(TInt aCategories); |
|
189 |
|
190 IMPORT_C void SetSwmtHeapDumpsEnabledL(TBool aEnabled); |
|
191 |
|
192 IMPORT_C void SetSwmtMode(TMemSpyEngineHelperSysMemTrackerConfig::TMemSpyEngineSysMemTrackerMode aMode); |
|
193 |
|
194 IMPORT_C void SwmtResetTracking(); |
|
195 |
|
196 IMPORT_C void GetOutputSink( TMemSpySinkType& aType ); |
|
197 |
|
198 IMPORT_C TBool IsSwmtRunningL(); |
|
199 |
|
200 IMPORT_C void StartSwmtTimerL(TInt aPeriod); |
|
201 |
|
202 IMPORT_C void StartSwmtTimerL(); // for CLI |
|
203 |
|
204 IMPORT_C void SetSwmtTimerIntervalL(TInt aPeriod); //for CLI |
|
205 |
|
206 IMPORT_C void StopSwmtTimerL(); |
|
207 |
|
208 IMPORT_C void ForceSwmtUpdateL(); |
|
209 |
|
210 IMPORT_C void ForceSwmtUpdate(TRequestStatus& aStatus); |
|
211 |
|
212 IMPORT_C void GetSwmtFilter( TName& aFilter ); |
|
213 |
|
214 IMPORT_C void GetSwmtCategoriesL(TInt& aCategories); |
|
215 |
|
216 IMPORT_C void GetSwmtHeapDumpsEnabledL(TBool& aEnabled); |
|
217 |
|
218 IMPORT_C void GetSwmtMode(TMemSpyEngineHelperSysMemTrackerConfig::TMemSpyEngineSysMemTrackerMode& aMode); |
|
219 |
|
220 IMPORT_C void GetSwmtTimerIntervalL(TInt& aPeriod); |
|
221 |
|
222 //Threads operations |
|
223 /** |
|
224 * |
|
225 */ |
|
226 IMPORT_C void GetThreadsL(TProcessId aProcessId, RArray<CMemSpyApiProcess*> &aThreads, TSortType aSortType = ESortProcById); |
|
227 |
|
228 IMPORT_C TInt ThreadSystemPermanentOrCritical( TThreadId aId, TBool aValue ); |
|
229 |
|
230 IMPORT_C TInt EndThreadL( TThreadId aId, TMemSpyEndType aType ); |
|
231 |
|
232 IMPORT_C TInt SwitchToThread( TThreadId aId, TBool aBrought ); |
|
233 |
|
234 IMPORT_C TInt GetInfoItemType( TInt aIndex, TThreadId aId, TMemSpyThreadInfoItemType &aType ); |
|
235 |
|
236 IMPORT_C TInt GetThreadInfoItems( RArray<CMemSpyApiThreadInfoItem*> &aInfoItems, TThreadId aId, TMemSpyThreadInfoItemType aType ); |
|
237 |
|
238 IMPORT_C void GetThreadInfoItemsL( RArray<CMemSpyApiThreadInfoItem*> &aInfoItems, TThreadId aId, TMemSpyThreadInfoItemType aType ); |
|
239 |
|
240 //KernelObjects operations |
|
241 |
|
242 IMPORT_C void GetKernelObjectsL( RArray<CMemSpyApiKernelObject*> &aKernelObjects ); |
|
243 |
|
244 IMPORT_C TInt GetKernelObjects( RArray<CMemSpyApiKernelObject*> &aKernelObjects ); |
|
245 |
|
246 IMPORT_C void GetKernelObjectItemsL( RArray<CMemSpyApiKernelObjectItem*> &aKernelObjectItems, TMemSpyDriverContainerType aForContainer ); |
|
247 |
|
248 IMPORT_C TInt GetKernelObjectItems( RArray<CMemSpyApiKernelObjectItem*> &aKernelObjectItems, TMemSpyDriverContainerType aForContainer ); |
|
249 |
|
250 IMPORT_C void OutputAllContainerContents(); |
|
251 |
|
252 // Heap |
|
253 |
|
254 IMPORT_C CMemSpyApiHeap* GetHeapL(); |
|
255 |
|
256 IMPORT_C CMemSpyApiHeap* GetHeap(); |
|
257 |
|
258 IMPORT_C void DumpKernelHeap(); |
|
259 |
|
260 // Servers |
|
261 IMPORT_C void GetServersL(RArray<CMemSpyApiServer*> &aServers); |
|
262 |
|
263 IMPORT_C void GetServersL(RArray<CMemSpyApiServer*> &aServers, TSortType aSortType); |
|
264 |
|
265 IMPORT_C void ServerListOutputGenericL( TBool aDetailed ); |
|
266 |
|
267 // ECom |
|
268 |
|
269 IMPORT_C void GetEComCategoriesL(RArray<CMemSpyApiEComCategory*> &aCategories); |
|
270 |
|
271 IMPORT_C void GetEComInterfacesL(TUid aCategory, RArray<CMemSpyApiEComInterface*> &aInterfaces); |
|
272 |
|
273 IMPORT_C void GetEComImplementationsL(TUid aInterface, RArray<CMemSpyApiEComImplementation*> &aImplementations); |
|
274 |
|
275 private: |
|
276 TInt StartServer(); |
|
277 |
|
278 void SetOutputTypeL(TMemSpyOutputType aOutputType); |
|
279 |
|
280 }; |
|
281 |
|
282 #endif // MEMSPYSESSION_H |
|