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 // Constants |
|
50 const TInt KMemSpyVersion = 2; |
|
51 |
|
52 enum TSortType |
|
53 { |
|
54 ESortProcById, |
|
55 ESortProcByName, |
|
56 ESortProcByThreadCount, |
|
57 ESortProcByCodeSegs, |
|
58 ESortProcByHeapUsage, |
|
59 ESortProcByStackUsage |
|
60 }; |
|
61 |
|
62 enum TMemSpyOutputType |
|
63 { |
|
64 EOutputTypeDebug = 0, |
|
65 EOutputTypeFile |
|
66 }; |
|
67 |
|
68 class TMemSpyDeviceWideOperationProgress |
|
69 { |
|
70 public: |
|
71 IMPORT_C TInt Progress() const; |
|
72 IMPORT_C const TDesC& Description() const; |
|
73 |
|
74 private: |
|
75 TPckgBuf<TInt> iProgress; |
|
76 TFullName iDescription; |
|
77 |
|
78 friend class RMemSpySession; |
|
79 }; |
|
80 |
|
81 |
|
82 NONSHARABLE_CLASS( RMemSpySession ) : public RSessionBase |
|
83 { |
|
84 public: |
|
85 IMPORT_C RMemSpySession(); |
|
86 IMPORT_C TInt Connect(); |
|
87 |
|
88 public: //API |
|
89 //Thread speciifc operations |
|
90 IMPORT_C void OutputKernelHeapDataL(); //EMemSpyClientServerOpHeapData |
|
91 |
|
92 IMPORT_C void OutputKernelHeapData(TRequestStatus& aStatus); //EMemSpyClientServerOpHeapData |
|
93 |
|
94 IMPORT_C void OutputThreadHeapDataL(TThreadId aThreadId); //EMemSpyClientServerOpHeapData |
|
95 |
|
96 IMPORT_C void OutputThreadHeapDataL(const TDesC& aThreadName); //EMemSpyClientServerOpHeapData |
|
97 |
|
98 IMPORT_C void OutputThreadCellListL(TThreadId aThreadId);//EMemSpyClientServerOpHeapCellListing |
|
99 |
|
100 IMPORT_C void OutputHeapInfoUserL(TThreadId aThreadId); //EMemSpyClientServerOpHeapInfo |
|
101 |
|
102 IMPORT_C void SwitchOutputSinkL( TMemSpySinkType aType); //EMemSpyClientServerOpSwitchOutputSinkFile / EMemSpyClientServerOpSwitchOutputSinkTrace |
|
103 |
|
104 IMPORT_C void SwitchOutputToTraceL(); // EMemSpyClientServerOpSwitchOutputSinkTrace |
|
105 |
|
106 IMPORT_C void SwitchOutputToFileL(const TDesC& aRootFolder); // EMemSpyClientServerOpSwitchOutputSinkFile |
|
107 |
|
108 IMPORT_C void OutputStackInfoL(TThreadId aThreadId); //EMemSpyClientServerOpStackInfo |
|
109 |
|
110 IMPORT_C void OutputStackDataL(TThreadId aThreadId, TMemSpyDriverDomainType aType ); //EMemSpyClientServerOpStackDataUser / EMemSpyClientServerOpStackDataKernel |
|
111 |
|
112 IMPORT_C void OutputThreadInfoHandlesL(TThreadId aThreadId); //EMemSpyClientServerOpOutputInfoHandles |
|
113 |
|
114 IMPORT_C void OutputAOListL(TThreadId aId, TMemSpyThreadInfoItemType aType); //EMemSpyClientServerOpOutputAOList |
|
115 |
|
116 IMPORT_C void OutputKernelObjectsL();// EMemSpyClientServerOpEnumerateKernelContainerAll |
|
117 |
|
118 IMPORT_C void OutputCompactStackInfoL();// EMemSpyClientServerOpStackInfoCompact |
|
119 |
|
120 IMPORT_C void OutputCompactHeapInfoL();// EMemSpyClientServerOpHeapInfoCompact |
|
121 |
|
122 // Device Wide Operations |
|
123 // Synchronous operations - for CLI |
|
124 IMPORT_C void OutputHeapData(); |
|
125 |
|
126 // Asynchronous operations |
|
127 IMPORT_C void OutputPhoneInfo(TRequestStatus& aStatus); |
|
128 |
|
129 IMPORT_C void OutputDetailedPhoneInfo(TRequestStatus& aStatus); |
|
130 |
|
131 IMPORT_C void OutputHeapInfo(TRequestStatus& aStatus); |
|
132 |
|
133 IMPORT_C void OutputCompactHeapInfo(TRequestStatus &aStatus); |
|
134 |
|
135 IMPORT_C void OutputHeapCellListing(TRequestStatus& aStatus); |
|
136 |
|
137 IMPORT_C void OutputHeapData(TRequestStatus& aStatus); |
|
138 |
|
139 IMPORT_C void OutputStackInfo(TRequestStatus& aStatus); |
|
140 |
|
141 IMPORT_C void OutputCompactStackInfo(TRequestStatus &aStatus); |
|
142 |
|
143 IMPORT_C void OutputUserStackData(TRequestStatus& aStatus); |
|
144 |
|
145 IMPORT_C void OutputKernelStackData(TRequestStatus& aStatus); |
|
146 |
|
147 IMPORT_C void NotifyDeviceWideOperationProgress(TMemSpyDeviceWideOperationProgress &aProgress, TRequestStatus &aStatus); |
|
148 |
|
149 IMPORT_C void CancelDeviceWideOperationL(); |
|
150 |
|
151 // Synchronous operations for MemSpyLauncher |
|
152 IMPORT_C void OutputPhoneInfo(); |
|
153 |
|
154 // "Ui" operations |
|
155 |
|
156 IMPORT_C void GetProcessesL(RArray<CMemSpyApiProcess*> &aProcesses, TSortType aSortType = ESortProcById); |
|
157 |
|
158 IMPORT_C TProcessId GetProcessIdByNameL(const TDesC& aProcessName); |
|
159 |
|
160 IMPORT_C void GetThreadsL(TProcessId aProcessId, RArray<CMemSpyApiThread*> &aThreads, TSortType aSortType = ESortProcById); |
|
161 |
|
162 IMPORT_C TInt ProcessSystemPermanentOrCritical( TProcessId aId, TBool aValue ); //aValue -> return value |
|
163 |
|
164 IMPORT_C void SetThreadPriorityL(TThreadId aId, TInt aPriority); |
|
165 |
|
166 IMPORT_C TInt EndProcess( TProcessId aId, TMemSpyEndType aType ); |
|
167 |
|
168 IMPORT_C TInt SwitchToProcess( TProcessId aId, TBool aBrought ); |
|
169 |
|
170 //SWMT operations |
|
171 |
|
172 IMPORT_C void GetMemoryTrackingCyclesL(RArray<CMemSpyApiMemoryTrackingCycle*>& aCycles); |
|
173 |
|
174 IMPORT_C void SetSwmtConfig( TMemSpyEngineHelperSysMemTrackerConfig aConfig ); |
|
175 |
|
176 IMPORT_C void SetSwmtAutoStartProcessList( CArrayFixFlat<TUid>* aList ); |
|
177 |
|
178 IMPORT_C void SetSwmtFilter( const TDesC& aFilter ); |
|
179 |
|
180 IMPORT_C void SetSwmtCategoriesL(TInt aCategories); |
|
181 |
|
182 IMPORT_C void SetSwmtHeapDumpsEnabledL(TBool aEnabled); |
|
183 |
|
184 IMPORT_C void SwmtResetTracking(); |
|
185 |
|
186 IMPORT_C void GetOutputSink( TMemSpySinkType aType ); |
|
187 |
|
188 IMPORT_C TBool IsSwmtRunningL(); |
|
189 |
|
190 IMPORT_C void StartSwmtTimerL(TInt aPeriod); |
|
191 |
|
192 IMPORT_C void StartSwmtTimerL(); // for CLI |
|
193 |
|
194 IMPORT_C void SetSwmtTimerIntervalL(TInt aPeriod); //for CLI |
|
195 |
|
196 IMPORT_C void StopSwmtTimerL(); |
|
197 |
|
198 IMPORT_C void ForceSwmtUpdateL(); |
|
199 |
|
200 IMPORT_C void ForceSwmtUpdate(TRequestStatus& aStatus); |
|
201 |
|
202 //Threads operations |
|
203 /** |
|
204 * |
|
205 */ |
|
206 IMPORT_C void GetThreadsL(TProcessId aProcessId, RArray<CMemSpyApiProcess*> &aThreads, TSortType aSortType = ESortProcById); |
|
207 |
|
208 IMPORT_C TInt ThreadSystemPermanentOrCritical( TThreadId aId, TBool aValue ); |
|
209 |
|
210 IMPORT_C TInt EndThread( TThreadId aId, TMemSpyEndType aType ); |
|
211 |
|
212 IMPORT_C TInt SwitchToThread( TThreadId aId, TBool aBrought ); |
|
213 |
|
214 IMPORT_C TInt GetInfoItemType( TInt aIndex, TThreadId aId, TMemSpyThreadInfoItemType &aType ); |
|
215 |
|
216 IMPORT_C TInt GetThreadInfoItems( RArray<CMemSpyApiThreadInfoItem*> &aInfoItems, TThreadId aId, TMemSpyThreadInfoItemType aType ); |
|
217 |
|
218 IMPORT_C void GetThreadInfoItemsL( RArray<CMemSpyApiThreadInfoItem*> &aInfoItems, TThreadId aId, TMemSpyThreadInfoItemType aType ); |
|
219 |
|
220 |
|
221 //KernelObjects operations |
|
222 |
|
223 IMPORT_C void GetKernelObjectsL( RArray<CMemSpyApiKernelObject*> &aKernelObjects ); |
|
224 |
|
225 IMPORT_C TInt GetKernelObjects( RArray<CMemSpyApiKernelObject*> &aKernelObjects ); |
|
226 |
|
227 IMPORT_C void GetKernelObjectItemsL( RArray<CMemSpyApiKernelObjectItem*> &aKernelObjectItems, TMemSpyDriverContainerType aForContainer ); |
|
228 |
|
229 IMPORT_C TInt GetKernelObjectItems( RArray<CMemSpyApiKernelObjectItem*> &aKernelObjectItems, TMemSpyDriverContainerType aForContainer ); |
|
230 |
|
231 IMPORT_C void OutputAllContainerContents(); |
|
232 |
|
233 // Heap |
|
234 |
|
235 IMPORT_C CMemSpyApiHeap* GetHeapL(); |
|
236 |
|
237 IMPORT_C CMemSpyApiHeap* GetHeap(); |
|
238 |
|
239 IMPORT_C void DumpKernelHeap(); |
|
240 |
|
241 private: |
|
242 TInt StartServer(); |
|
243 |
|
244 void SetOutputTypeL(TMemSpyOutputType aOutputType); |
|
245 |
|
246 }; |
|
247 |
|
248 #endif // MEMSPYSESSION_H |
|