|
1 // Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 #ifndef __ECOMSESSIONAUX_H__ |
|
17 #define __ECOMSESSIONAUX_H__ |
|
18 |
|
19 #include <e32cmn.h> |
|
20 #include <startup.hrh> |
|
21 |
|
22 /** |
|
23 Codes used for processing ESetGetParameters messages. |
|
24 Note: The constants are intended for component testing of |
|
25 EcomServer. |
|
26 @internalComponent |
|
27 */ |
|
28 enum TEComParameterOptions |
|
29 { |
|
30 #ifdef __ECOM_SERVER_TESTABILITY__ |
|
31 //these enumerated values are used for ecom component testing |
|
32 EChangeStartupState, |
|
33 EProcessStartupState, |
|
34 EGetStartupState, |
|
35 #endif |
|
36 #ifdef __ECOM_SERVER_PERFORMANCE__ |
|
37 //this enumerated value is used for ecom performance testing |
|
38 EGetStartupStateTimerResult, |
|
39 EGetAccumulatedClientRequestsTimerResult, |
|
40 EGetRegistryCounts, |
|
41 EResetStartupStateTimerCounts, |
|
42 EGetEComPerfTimeRecord, |
|
43 EResetEComPerfTimeRecords, |
|
44 EGetEComServerHeapResult, |
|
45 #endif |
|
46 ELastOption |
|
47 }; |
|
48 |
|
49 #ifdef __ECOM_SERVER_TESTABILITY__ |
|
50 |
|
51 void ChangeStartupStateL(TInt aState); |
|
52 |
|
53 void ProcessCurrentStartupStateL(); |
|
54 |
|
55 TInt GetCurrentStartupStateL(); |
|
56 |
|
57 #endif |
|
58 |
|
59 #ifdef __ECOM_SERVER_PERFORMANCE__ |
|
60 |
|
61 //==================== For Startup State Time Results =================== |
|
62 /** |
|
63 @internalComponent |
|
64 Class for storing start and end timer results for a state. |
|
65 */ |
|
66 class TStartupStateTimerResult |
|
67 { |
|
68 public: |
|
69 /** State for which to store the timer result */ |
|
70 TInt iState; |
|
71 /** Timer result reading in [ms] at the beginning of the state */ |
|
72 TReal iStartTime; |
|
73 /** Timer result reading in [ms] at the end of the state */ |
|
74 TReal iEndTime; |
|
75 }; |
|
76 |
|
77 /** |
|
78 @internalComponent |
|
79 Class for storing start and end timer results for a state and client request type. |
|
80 */ |
|
81 class TStartupStateTimerEntry |
|
82 { |
|
83 public: |
|
84 /** State in which the ECom client request was made */ |
|
85 TInt iState; |
|
86 /** Timer result reading in [ms] at the beginning of the request */ |
|
87 TUint32 iTimerResult; |
|
88 }; |
|
89 |
|
90 class RStartupStateTimerResults |
|
91 { |
|
92 public: // public methods |
|
93 void GetAllTimerResults(); |
|
94 void Close(); |
|
95 TInt Count(); |
|
96 TStartupStateTimerResult& At(TInt aIndex); |
|
97 TInt FindInOrderTimerResult(TInt aState); |
|
98 TInt FindTimerResult(TInt aState); |
|
99 void ResetTimerCountL(); |
|
100 private: // private methods |
|
101 TInt GetTimerResult(TInt aTimerIdx, TUint32& aTimerResult, TInt& aState); |
|
102 private: // private member variables |
|
103 RArray<TStartupStateTimerResult> iTimerResults; |
|
104 }; |
|
105 |
|
106 //==================== For Client Requests Time Results =================== |
|
107 /** |
|
108 @internalComponent |
|
109 Enumeration of ECom client request types |
|
110 */ |
|
111 enum TEComClientRequestType |
|
112 { |
|
113 EEComCreateRequestType, |
|
114 EEComListRequestType, |
|
115 EEComNotifyOnChangeRequestType, |
|
116 EEComCancelNotifyOnChangeRequestType, |
|
117 EEComCollectImplementationsRequestType, |
|
118 EEComListExtendedInterfacesRequestType, |
|
119 EEComNumClientRequestTypes |
|
120 }; |
|
121 |
|
122 /** |
|
123 @internalComponent |
|
124 Class for storing start and end timer results for a state and client request type. |
|
125 */ |
|
126 class TClientRequestTimerEntry |
|
127 { |
|
128 public: |
|
129 /** State in which the ECom client request was made */ |
|
130 TInt iState; |
|
131 /** Timer result reading in [ms] at the beginning of the request */ |
|
132 TUint iStartTime; |
|
133 /** Timer result reading in [ms] at the end of the request */ |
|
134 TUint iEndTime; |
|
135 /** Whether the client request was a list request or a create request */ |
|
136 TEComClientRequestType iClientRequestType; |
|
137 }; |
|
138 |
|
139 /** |
|
140 @internalComponent |
|
141 Class to retrieve timing for ECom client requests during the different stages of start-up |
|
142 */ |
|
143 class RClientRequestTimerResults |
|
144 { |
|
145 public: // public methods |
|
146 void RetrieveResultsL(); |
|
147 void Close(); |
|
148 TReal GetAccumulatedClientRequestTime(TUint& aNumRequests); |
|
149 TReal GetAccumulatedClientRequestTime(TInt aState, TUint& aNumRequests); |
|
150 TReal GetAccumulatedClientRequestTime(TEComClientRequestType aRequestType, TUint& aNumRequests); |
|
151 TReal GetAccumulatedClientRequestTime(TInt aState, TEComClientRequestType aRequestType, TUint& aNumRequests); |
|
152 private: // private methods |
|
153 static TInt GetTimerResult(TInt aTimerIdx, TClientRequestTimerEntry& aTimerEntry); |
|
154 private: // private data |
|
155 /** List of all timer results */ |
|
156 RArray<TClientRequestTimerEntry> iResults; |
|
157 }; |
|
158 |
|
159 /** |
|
160 @internalComponent |
|
161 Class to retrieve ECom plugin counts |
|
162 */ |
|
163 class RegistryCounts |
|
164 { |
|
165 public: |
|
166 // Struct for storing registry counts. |
|
167 struct TRegistryCounts |
|
168 { |
|
169 enum TRegistryCountDriveType |
|
170 { |
|
171 ERoInternal, |
|
172 ENonRoInternal, |
|
173 EAll |
|
174 }; |
|
175 /** The number of drives found */ |
|
176 TInt iDrives; |
|
177 /** The number of plugins found */ |
|
178 TInt iDlls; |
|
179 /** The number of interfaces found */ |
|
180 TInt iInterfaces; |
|
181 /** The number fo implementations found */ |
|
182 TInt iImplementations; |
|
183 }; |
|
184 |
|
185 public: // public methods |
|
186 static void GetRegistryCountsL(TRegistryCounts::TRegistryCountDriveType aType, TRegistryCounts& aCounts); |
|
187 private: // private methods |
|
188 private: // private data |
|
189 }; |
|
190 |
|
191 //==================== For ECom Performance Time Results =================== |
|
192 /** |
|
193 @internalComponent |
|
194 ECom performance time record types. Time records can be retrieved by type. |
|
195 */ |
|
196 enum TEComPerfTimeRecordType |
|
197 { |
|
198 // Used only for validation, not used by any real types |
|
199 ENullType, |
|
200 // Time record types, distinguished by functions it exams |
|
201 ECDiscovererNotifierRunL, |
|
202 ECDiscovererTimerRunL, |
|
203 ECDiscovererRediscoveryScanDirectoryL, |
|
204 }; |
|
205 |
|
206 /** |
|
207 @internalComponent |
|
208 Class for storing a fast count result with type and other information. |
|
209 */ |
|
210 class TEComPerfTimeRecordEntry |
|
211 { |
|
212 public: |
|
213 // Fast counter result. |
|
214 TUint iTime; |
|
215 // The type of time record. |
|
216 TEComPerfTimeRecordType iType; |
|
217 // Additional inforamtion attached with the record. Eg. Drive number of a notifier |
|
218 TInt iInfo; |
|
219 }; |
|
220 |
|
221 /** |
|
222 @internalComponent |
|
223 Class for storing a complete time measurement result (in ms) with type and other information. |
|
224 */ |
|
225 class TEComPerfRealTimeResult |
|
226 { |
|
227 public: |
|
228 // Time result reading in [ms] at the beginning of the measurement. |
|
229 TReal iStartTime; |
|
230 // Time result reading in [ms] at the end of the measurement. |
|
231 TReal iEndTime; |
|
232 // Time result type, indicating which function/method it measures. |
|
233 TEComPerfTimeRecordType iType; |
|
234 // Additional information if needed. |
|
235 TInt iInfo; |
|
236 }; |
|
237 |
|
238 /** |
|
239 @internalComponent |
|
240 Class for storing the heap usage at various startup state |
|
241 */ |
|
242 class TEComPerfHeapUsage |
|
243 { |
|
244 public: |
|
245 /** State for which to store the heap usage */ |
|
246 TInt iState; |
|
247 /** Current committed heap reading */ |
|
248 TInt iHeapSize; |
|
249 }; |
|
250 |
|
251 /** |
|
252 @internalComponent |
|
253 An R Class to retrieve the heap record from the server side |
|
254 */ |
|
255 class REComHeapUsageRecords |
|
256 { |
|
257 public: |
|
258 void OpenL(); |
|
259 void GetAllHeapUsageResultsL(); |
|
260 TInt GetHeapUsageAtState(TInt aState); |
|
261 void Close(); |
|
262 private: |
|
263 TInt GetHeapRecordEntry(TInt aHeapIdx,TEComPerfHeapUsage& aHeapEntry); |
|
264 private: |
|
265 // this will store the actual heap usage at different state |
|
266 RArray<TEComPerfHeapUsage> iHeapRecords; |
|
267 }; |
|
268 |
|
269 /** |
|
270 @internalComponent |
|
271 An R Class to retrieve time records from server side and process them into real time results. |
|
272 APIs of the class are used by test cases. |
|
273 */ |
|
274 class REComPerfTimeRecords |
|
275 { |
|
276 public: // public methods |
|
277 void OpenL(); |
|
278 TInt Count(); |
|
279 void Reset(); |
|
280 void ResetRecordsOnServerL(); |
|
281 void RetrieveResultsByTypeL(TEComPerfTimeRecordType aType, RArray<TEComPerfRealTimeResult>& aTimeResults); |
|
282 void RetrieveResultsInfoByTypeL(TEComPerfTimeRecordType aType, RArray<TInt>& aInfos); |
|
283 void Close(); |
|
284 private: // private methods |
|
285 TInt GetTimeRecordEntry(TInt aTimerIdx, TEComPerfTimeRecordEntry& aTimerEntry); |
|
286 private: // private member variables |
|
287 // Local duplicate of time records on server, filled by Open() |
|
288 RArray<TEComPerfTimeRecordEntry> iTimeRecords; |
|
289 }; |
|
290 |
|
291 //=========================================================== |
|
292 TReal FastCountToMilliseconds(TInt aFastCount); |
|
293 |
|
294 #endif |
|
295 |
|
296 #endif // __ECOMSESSIONAUX_H__ |