|
1 // btrace_parser.h |
|
2 // |
|
3 // Copyright (c) 2008 - 2010 Accenture. All rights reserved. |
|
4 // This component and the accompanying materials are made available |
|
5 // under the terms of the "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 // Accenture - Initial contribution |
|
11 // |
|
12 // Backwards Compatibility: |
|
13 // The interfaces defined in this file should be considered INTERNAL to the |
|
14 // fshell project as they may be subject to change. Expect to have to absorb |
|
15 // downstream compatibility breaks if you use these interfaces from outside |
|
16 // of the fshell project. |
|
17 |
|
18 #ifndef __BTRACE_PARSER_H__ |
|
19 #define __BTRACE_PARSER_H__ |
|
20 |
|
21 #include <e32base.h> |
|
22 #include <fshell/btrace_parser_defs.h> |
|
23 #include <fshell/extrabtrace.h> |
|
24 #include FSHELL_D32BTRACE_HEADER |
|
25 #include <f32file.h> |
|
26 #include <e32property.h> |
|
27 #include <fshell/common.mmh> |
|
28 |
|
29 #ifdef FSHELL_ATRACE_SUPPORT |
|
30 #include <fshell/atrace/atraceconfig.h> |
|
31 #endif |
|
32 |
|
33 class TBtraceHeader; |
|
34 struct TKeyEvent; |
|
35 struct TPointerEvent; |
|
36 class CMultipartFragment; |
|
37 class CFlusher; |
|
38 |
|
39 enum TBtraceParserPanic |
|
40 { |
|
41 EBtpPanicUndefinedCallBack = 0, |
|
42 EBtpPanicIncompatiblePubSubArgs = 1, |
|
43 EBtpPanicThreadIdNotFound = 2, |
|
44 EBtpPanicProcessNameNotFound = 3, |
|
45 EBtpPanicBtraceThreadIdOverflow = 4, |
|
46 EBtpPanicThreadNotFoundForId = 5, |
|
47 EBtpPanicFailedToInsertCpuUsageObject = 6, |
|
48 EBtpPanicBtraceProcessIdOverflow = 7, |
|
49 EBtpPanicUnused1 = 8, |
|
50 EBtpPanicUnused2 = 9, |
|
51 EBtpPanicNegativeTickInterval = 10, |
|
52 EBtpPanicUnused3 = 11, |
|
53 EBtpPanicInvalidReaderMode = 12, |
|
54 EBtpPanicUnexpectedReaderRun = 13, |
|
55 EBtpPanicUnknownCpuContext = 14, |
|
56 EBtpPanicFlusherObserverAlreadySet = 15, |
|
57 EBtpPanicReaderNotReplaying = 16, |
|
58 EBtpPanicNoReplayData = 17, |
|
59 EBtpPanicFailedToFindProcess = 18, |
|
60 EBtpPanicNegativeRefCount = 19, |
|
61 EBtpPanicNestedSynchronizeCalls = 20, |
|
62 EBtpPanicFrameObserverAlreadyExists = 21, |
|
63 EBtpPanicTriedToDisableReplayWhenBtraceNotRunning = 22, |
|
64 EBtpPanicAddObserverCalledWhileIterating = 23, |
|
65 EBtpPanicRemoveObserverCalledWhileIterating = 24, |
|
66 EBtpPanicTooManyDomainEventDataItems = 25, |
|
67 EBtpPanicBtraceWindowGroupIdOverflow = 26, |
|
68 EBtpPanicWindowGroupIdNotFound = 27, |
|
69 EBtpPanicWservWindowGroupIdNotFound = 28 |
|
70 }; |
|
71 |
|
72 void Panic(TBtraceParserPanic aReason); |
|
73 struct SBtraceParserTls; |
|
74 |
|
75 enum TBtraceNotificationPersistence |
|
76 { |
|
77 ENotificationOneShot, |
|
78 ENotificationPersistent, |
|
79 }; |
|
80 |
|
81 class TBtraceUtils |
|
82 { |
|
83 public: |
|
84 IMPORT_C static TUint32 MicroSecondsToNanoTicks(TTimeIntervalMicroSeconds32 aInterval); |
|
85 IMPORT_C static TUint64 MicroSecondsToFastTicks(TTimeIntervalMicroSeconds32 aInterval); |
|
86 IMPORT_C static TTimeIntervalMicroSeconds NanoTicksToMicroSeconds(TUint32 aNanoTicks); |
|
87 IMPORT_C static TTimeIntervalMicroSeconds FastTicksToMicroSeconds(const TUint64& aFastTicks); |
|
88 |
|
89 IMPORT_C static void DebugOverrideTimerSettings(TInt aNanoPeriod, TInt aFastCounterFreq, TBool aFastCountUp); |
|
90 |
|
91 public: |
|
92 static TInt NanoTickPeriod(); |
|
93 static TInt FastCounterFrequency(); |
|
94 static TBool FastCounterCountsUp(); |
|
95 private: |
|
96 static SBtraceParserTls* CreateTls(); |
|
97 static TInt CalculateNanoTickPeriod(); |
|
98 static TInt CalculateFastCounterFrequency(); |
|
99 static TInt CalculateFastCounterCountsUp(); |
|
100 }; |
|
101 |
|
102 class TBtraceTickCount |
|
103 { |
|
104 public: |
|
105 IMPORT_C TBtraceTickCount(); |
|
106 IMPORT_C void SetToNow(); |
|
107 IMPORT_C TUint32 IntervalInNanoTicks(const TBtraceTickCount& aTickCount) const; |
|
108 IMPORT_C TUint64 IntervalInFastTicks(const TBtraceTickCount& aTickCount) const; |
|
109 IMPORT_C TTimeIntervalMicroSeconds IntervalInMicroSeconds(const TBtraceTickCount& aTickCount) const; |
|
110 IMPORT_C TBool operator==(const TBtraceTickCount& aTickCount) const; |
|
111 IMPORT_C TBool operator!=(const TBtraceTickCount& aTickCount) const; |
|
112 IMPORT_C TBool operator>=(const TBtraceTickCount& aTickCount) const; |
|
113 IMPORT_C TBool operator<=(const TBtraceTickCount& aTickCount) const; |
|
114 IMPORT_C TBool operator>(const TBtraceTickCount& aTickCount) const; |
|
115 IMPORT_C TBool operator<(const TBtraceTickCount& aTickCount) const; |
|
116 public: |
|
117 TUint32 iNano; |
|
118 TUint32 iFast; |
|
119 }; |
|
120 |
|
121 |
|
122 class TBtraceFrame |
|
123 { |
|
124 public: |
|
125 TBtraceFrame(const TBtraceHeader& aHeader); |
|
126 public: |
|
127 TUint8 iSize; |
|
128 TUint8 iFlags; |
|
129 TUint8 iCategory; |
|
130 TUint8 iSubCategory; |
|
131 TBtraceTickCount iTickCount; |
|
132 TUint32 iThreadContext; |
|
133 TUint32 iProgramCounter; |
|
134 TPtrC8 iData; |
|
135 }; |
|
136 |
|
137 |
|
138 class MBtraceLog |
|
139 { |
|
140 public: |
|
141 IMPORT_C virtual TBool LogEnabled() = 0; |
|
142 IMPORT_C virtual void Log(const TDesC& aLog) = 0; |
|
143 }; |
|
144 |
|
145 class CBtraceReader; |
|
146 |
|
147 |
|
148 class MBtraceObserver |
|
149 { |
|
150 public: |
|
151 virtual void HandleBtraceFrameL(const TBtraceFrame& aFrame) = 0; |
|
152 virtual void BtraceBufferHasBeenReset() {} // Empty default impl |
|
153 }; |
|
154 |
|
155 class MBtraceFrameObserver |
|
156 { |
|
157 public: |
|
158 virtual void HandleFrameDispatchStart() = 0; |
|
159 virtual void HandleFrameDispatchComplete() = 0; |
|
160 }; |
|
161 |
|
162 NONSHARABLE_CLASS(CBtraceReader) : public CActive |
|
163 { |
|
164 public: |
|
165 enum TMode |
|
166 { |
|
167 EAllowBtraceToOverflow, |
|
168 EFlushOnBtraceThreshold, |
|
169 ELeaveOnBtraceThreshold |
|
170 }; |
|
171 enum TObserverType |
|
172 { |
|
173 ENormal, |
|
174 EIncludeSynchronizationFrames |
|
175 }; |
|
176 public: |
|
177 IMPORT_C static CBtraceReader* NewL(TMode aMode, TInt aBufferSize, TInt aThreshold, MBtraceLog* aLog = NULL); |
|
178 IMPORT_C static CBtraceReader* NewL(const TDesC& aReplayFileName, MBtraceLog* aLog = NULL); |
|
179 IMPORT_C ~CBtraceReader(); |
|
180 IMPORT_C void Reset(); |
|
181 IMPORT_C void SynchronizeL(); |
|
182 IMPORT_C void Start(const TBtraceTickCount& aInitialTickCount); |
|
183 IMPORT_C void Start(const TBtraceTickCount& aInitialTickCount, TTimeIntervalMicroSeconds32 aAutoFlushPeriod); |
|
184 IMPORT_C void DisableBtrace(); |
|
185 IMPORT_C void EnableCategoryL(TUint aCategory); |
|
186 IMPORT_C void DisableCategoryL(TUint aCategory); |
|
187 IMPORT_C void AddObserverL(MBtraceObserver& aObserver); |
|
188 IMPORT_C void AddObserverL(MBtraceObserver& aObserver, TObserverType aType); |
|
189 IMPORT_C void AddObserverL(TUint aCategory, MBtraceObserver& aObserver); |
|
190 IMPORT_C void AddObserverL(TUint aCategory, MBtraceObserver& aObserver, TObserverType aType); |
|
191 IMPORT_C void RemoveObserver(MBtraceObserver& aObserver); |
|
192 IMPORT_C void RemoveObserver(TUint aCategory, MBtraceObserver& aObserver); |
|
193 IMPORT_C void AddFrameObseverL(MBtraceFrameObserver& aObserver); |
|
194 IMPORT_C void RemoveFrameObserver(MBtraceFrameObserver& aObserver); |
|
195 IMPORT_C void GetReplayStartTickCountL(TBtraceTickCount& aTickCount); |
|
196 IMPORT_C void SetBufferSizeL(TInt aBufferSize); |
|
197 IMPORT_C void SetReplayFileNameL(const TDesC& aReplayFileName); // Pass empty desc to disable (not allowed to disable if constructed with the overload that took a replay filename) |
|
198 IMPORT_C const TBtraceTickCount& CurrentTickCount() const; |
|
199 IMPORT_C void RecordBtraceDataToFileL(const TDesC& aRecordFileName); // Pass empty desc to disable |
|
200 IMPORT_C void LogBtraceStatus(); |
|
201 IMPORT_C void SetMultipartReassemblyL(TInt aMaxTrackedFragments); // zero to disable |
|
202 IMPORT_C void FlushL(); |
|
203 public: |
|
204 void Log(const TDesC& aDes) const; |
|
205 void Log(TRefByValue<const TDesC> aFmt, ...) const; |
|
206 private: // From CActive. |
|
207 virtual void RunL(); |
|
208 virtual void DoCancel(); |
|
209 private: |
|
210 CBtraceReader(TMode aMode, TInt aThreshold, MBtraceLog* aLog); |
|
211 void ConstructL(TInt aBufferSize); |
|
212 void ConstructL(const TDesC& aReplayFileName); |
|
213 void QueueRead(); |
|
214 void DoReadL(TBool& aFinished); |
|
215 TInt GetData(TUint8*& aData); |
|
216 void DispatchFrameL(const TBtraceFrame& aFrame); |
|
217 void NotifyObserversOfBufferReset(); |
|
218 void ResetAndReprimeL(); |
|
219 void NewMultipartFrameL(const TBtraceFrame& aFrame, TUint32 aExtra); |
|
220 void AdditionalMultipartFragmentL(const TBtraceFrame& aFrame, TUint32 aExtra, TBool aLast); |
|
221 private: |
|
222 class TObserver |
|
223 { |
|
224 public: |
|
225 TObserver(MBtraceObserver& aObserver, TObserverType aType, TUint aCategory); |
|
226 static TObserver ArrayKey(TUint aCategory); |
|
227 |
|
228 private: |
|
229 TObserver(TUint aCategory); // Only for use by ArrayKey |
|
230 public: |
|
231 MBtraceObserver* iObserver; |
|
232 TObserverType iType; |
|
233 TUint iCategory; |
|
234 }; |
|
235 private: |
|
236 static TBool ObserversEqual(const TObserver& aA, const TObserver& aB); |
|
237 static void DecIteratingObservers(TAny* aSelf); |
|
238 private: |
|
239 const TMode iMode; |
|
240 MBtraceLog* iLog; |
|
241 CFlusher* iFlusher; |
|
242 RBTrace iBtrace; |
|
243 #ifdef FSHELL_ATRACE_SUPPORT |
|
244 RATraceConfig iAtraceConfig; |
|
245 #endif |
|
246 TInt iThreshold; |
|
247 RArray<TObserver> iObservers; // Sorted by TObserver::iCategory |
|
248 TInt iNumBytesRead; |
|
249 TInt iNumFramesRead; |
|
250 TBtraceTickCount iCurrentTickCount; |
|
251 TBtraceTickCount iInitialTickCount; |
|
252 TPtrC8 iBtraceBuffer; |
|
253 HBufC8* iReplayData; |
|
254 RFs iFs; |
|
255 RFile iReplayFile; |
|
256 TBool iSynchronizing; |
|
257 MBtraceFrameObserver* iFrameObserver; |
|
258 RFile iRecordFile; |
|
259 TInt iIteratingObservers; |
|
260 TInt iNextSyncFrameId; |
|
261 TInt iSyncFrameIdToWaitFor; |
|
262 TInt iMaxTrackedMultipartFragments; |
|
263 RPointerArray<CMultipartFragment> iMultipartFragments; |
|
264 }; |
|
265 |
|
266 class CRefCountedObject : public CBase |
|
267 { |
|
268 public: |
|
269 IMPORT_C void IncRef(); |
|
270 IMPORT_C void DecRef(); |
|
271 IMPORT_C TInt RefCount() const; |
|
272 protected: |
|
273 CRefCountedObject(); |
|
274 private: |
|
275 TInt iRefCount; |
|
276 }; |
|
277 |
|
278 class TBtraceIdBase |
|
279 { |
|
280 public: |
|
281 IMPORT_C void Set(TUint aValue); |
|
282 IMPORT_C TUint Value() const; |
|
283 IMPORT_C TBool operator==(const TBtraceIdBase& aId) const; |
|
284 protected: |
|
285 TBtraceIdBase(); |
|
286 TBtraceIdBase(TUint aId); |
|
287 TBtraceIdBase(const TBtraceIdBase& aId); |
|
288 private: |
|
289 TUint iId; |
|
290 }; |
|
291 |
|
292 class TBtraceThreadId : public TBtraceIdBase |
|
293 { |
|
294 public: |
|
295 IMPORT_C TBtraceThreadId(); |
|
296 IMPORT_C explicit TBtraceThreadId(TUint aId); |
|
297 IMPORT_C TBtraceThreadId(const TBtraceThreadId& aId); |
|
298 }; |
|
299 |
|
300 class TBtraceProcessId : public TBtraceIdBase |
|
301 { |
|
302 public: |
|
303 IMPORT_C TBtraceProcessId(); |
|
304 IMPORT_C explicit TBtraceProcessId(TUint aId); |
|
305 IMPORT_C TBtraceProcessId(const TBtraceProcessId& aId); |
|
306 }; |
|
307 |
|
308 class TBtraceWindowGroupId : public TBtraceIdBase |
|
309 { |
|
310 public: |
|
311 IMPORT_C TBtraceWindowGroupId(); |
|
312 IMPORT_C explicit TBtraceWindowGroupId(TUint aId); |
|
313 IMPORT_C TBtraceWindowGroupId(const TBtraceWindowGroupId& aId); |
|
314 }; |
|
315 |
|
316 |
|
317 class MBtraceContextObserver |
|
318 { |
|
319 public: |
|
320 IMPORT_C virtual void HandleThreadSeenL(const TBtraceTickCount& aTickCount, const TBtraceThreadId& aId, TUint aUserId); |
|
321 IMPORT_C virtual void HandleThreadGoneL(const TBtraceTickCount& aTickCount, const TBtraceThreadId& aId, TUint aUserId); |
|
322 IMPORT_C virtual void HandleThreadExitL(const TBtraceTickCount& aTickCount, const TBtraceThreadId& aId, TExitType aExitType, TInt aReason, const TDesC& aCategory, TUint aUserId); |
|
323 IMPORT_C virtual void HandleWindowGroupSeenL(const TBtraceTickCount& aTickCount, const TBtraceWindowGroupId& aId, TUint aUserId); |
|
324 }; |
|
325 |
|
326 NONSHARABLE_CLASS(CBtraceContext) : public CRefCountedObject, public MBtraceObserver |
|
327 { |
|
328 public: |
|
329 enum TMode |
|
330 { |
|
331 ENormal |
|
332 }; |
|
333 enum TExitTypes |
|
334 { |
|
335 EKill = 0x00000001, |
|
336 ETerminate = 0x00000002, |
|
337 EPanic = 0x00000004 |
|
338 }; |
|
339 public: |
|
340 IMPORT_C static CBtraceContext* NewL(CBtraceReader& aReader, TMode aMode = ENormal); |
|
341 IMPORT_C ~CBtraceContext(); |
|
342 IMPORT_C const TDesC& ThreadName(const TBtraceThreadId& aId) const; |
|
343 IMPORT_C void GetFullThreadName(const TBtraceThreadId& aId, TDes& aFullName) const; |
|
344 IMPORT_C TThreadId ThreadId(const TBtraceThreadId& aId) const; |
|
345 IMPORT_C const TDesC& ProcessName(const TBtraceProcessId& aId) const; |
|
346 IMPORT_C TInt WindowGroupId(const TBtraceWindowGroupId& aId) const; |
|
347 IMPORT_C const TDesC& WindowGroupName(const TBtraceWindowGroupId& aId) const; |
|
348 IMPORT_C const TBtraceThreadId* FindThread(TUint32 aNThreadAddress) const; |
|
349 IMPORT_C const TBtraceThreadId* FindThread(const TThreadId& aId) const; |
|
350 IMPORT_C const TBtraceWindowGroupId* FindWindowGroup(TInt aWServWgId) const; |
|
351 IMPORT_C void FindThreadsL(const TDesC& aPattern, RArray<TBtraceThreadId>& aThreads) const; |
|
352 IMPORT_C void FindWindowGroupsL(const TDesC& aPattern, RArray<TBtraceWindowGroupId>& aWindowGroups) const; |
|
353 IMPORT_C void FindWindowGroupsByThreadName(const TDesC& aPattern, RArray<TBtraceWindowGroupId>& aWindowGroups) const; |
|
354 IMPORT_C void NotifyThreadSeenL(const TDesC& aPattern, MBtraceContextObserver& aObserver, TUint aId); |
|
355 IMPORT_C void NotifyThreadSeenL(const TDesC& aPattern, MBtraceContextObserver& aObserver, TUint aId, TBtraceNotificationPersistence aPersistence); |
|
356 IMPORT_C void CancelNotifyThreadSeen(MBtraceContextObserver& aObserver); |
|
357 IMPORT_C void NotifyThreadGoneL(const TDesC& aPattern, MBtraceContextObserver& aObserver, TUint aId); |
|
358 IMPORT_C void NotifyThreadGoneL(const TDesC& aPattern, MBtraceContextObserver& aObserver, TUint aId, TBtraceNotificationPersistence aPersistence); |
|
359 IMPORT_C void CancelNotifyThreadGone(MBtraceContextObserver& aObserver); |
|
360 IMPORT_C void NotifyThreadExitL(const TDesC& aPattern, TUint aExitTypes, TInt* aReason, const TDesC* aCategory, MBtraceContextObserver& aObserver, TUint aId, TBtraceNotificationPersistence aPersistence); // Note, the pointer parameters are optional. |
|
361 IMPORT_C void CancelNotifyThreadExit(MBtraceContextObserver& aObserver); |
|
362 IMPORT_C void NotifyWindowGroupSeenL(const TDesC& aPattern, MBtraceContextObserver& aObserver, TUint aId, TBtraceNotificationPersistence aPersistence); |
|
363 IMPORT_C void NotifyWindowGroupSeenByThreadNameL(const TDesC& aPattern, MBtraceContextObserver& aObserver, TUint aId, TBtraceNotificationPersistence aPersistence); |
|
364 IMPORT_C void CancelNotifyWindowGroupSeen(MBtraceContextObserver& aObserver); |
|
365 private: |
|
366 CBtraceContext(CBtraceReader& aReader, TMode aMode); |
|
367 void ConstructL(); |
|
368 TUint GetNextThreadId(); |
|
369 TUint GetNextProcessId(); |
|
370 TUint GetNextWindowGroupId(); |
|
371 private: // From MBtraceObserver. |
|
372 virtual void HandleBtraceFrameL(const TBtraceFrame& aFrame); |
|
373 virtual void BtraceBufferHasBeenReset(); |
|
374 private: |
|
375 class TThread |
|
376 { |
|
377 public: |
|
378 TThread(TUint32 aNThreadAddress, TUint32 aOwningProcess, const TDesC8& aName); |
|
379 public: |
|
380 TUint32 iNThreadAddress; |
|
381 TBtraceThreadId iId; |
|
382 TUint32 iOwningProcess; |
|
383 TUint32 iKernelId; |
|
384 TName iName; |
|
385 }; |
|
386 class TProcess |
|
387 { |
|
388 public: |
|
389 TProcess(TUint32 aDProcessAddress); |
|
390 TProcess(TUint32 aDProcessAddress, const TDesC8& aName); |
|
391 public: |
|
392 TUint32 iDProcessAddress; |
|
393 TBtraceProcessId iId; |
|
394 TName iName; |
|
395 TInt iReferenceCount; |
|
396 }; |
|
397 class TWindowGroup |
|
398 { |
|
399 public: |
|
400 TWindowGroup(TInt aWindowGroupId); |
|
401 TWindowGroup(const TDesC& aName); |
|
402 TWindowGroup(TInt aWindowGroupId, TThreadId aThreadId, const TDesC& aName); |
|
403 public: |
|
404 TBtraceWindowGroupId iId; |
|
405 TInt iWindowGroupId; |
|
406 TThreadId iThreadId; |
|
407 TFullName iName; |
|
408 }; |
|
409 class TThreadSeenNotif |
|
410 { |
|
411 public: |
|
412 TThreadSeenNotif(TUint aId, const TDesC& aPattern, MBtraceContextObserver& aObserver, TBtraceNotificationPersistence aPersistence); |
|
413 public: |
|
414 TUint iId; |
|
415 TName iPattern; |
|
416 MBtraceContextObserver& iObserver; |
|
417 TBtraceNotificationPersistence iPersistence; |
|
418 }; |
|
419 class TThreadGoneNotif |
|
420 { |
|
421 public: |
|
422 TThreadGoneNotif(TUint aId, const TDesC& aPattern, MBtraceContextObserver& aObserver, TBtraceNotificationPersistence aPersistence); |
|
423 public: |
|
424 TUint iId; |
|
425 TName iPattern; |
|
426 MBtraceContextObserver& iObserver; |
|
427 TBtraceNotificationPersistence iPersistence; |
|
428 }; |
|
429 class TThreadExitNotif |
|
430 { |
|
431 public: |
|
432 TThreadExitNotif(TUint aId, const TDesC& aPattern, TUint aExitTypes, TInt* aReason, const TDesC* aCategory, MBtraceContextObserver& aObserver, TBtraceNotificationPersistence aPersistence); |
|
433 TBool Matches(const TDesC& aThreadName, TExitType aExitType, TInt aReason, const TDesC& aCategory) const; |
|
434 private: |
|
435 TBool MatchesType(TExitType aExitType) const; |
|
436 public: |
|
437 TUint iId; |
|
438 TName iPattern; |
|
439 TUint iExitTypes; |
|
440 TInt* iReason; |
|
441 const TDesC* iCategory; |
|
442 MBtraceContextObserver& iObserver; |
|
443 TBtraceNotificationPersistence iPersistence; |
|
444 }; |
|
445 class TWindowGroupSeenNotif |
|
446 { |
|
447 public: |
|
448 enum TPatternType |
|
449 { |
|
450 EWindowGroupName, |
|
451 EThreadName |
|
452 }; |
|
453 public: |
|
454 TWindowGroupSeenNotif(TUint aId, const TDesC& aPattern, TPatternType aPatternType, MBtraceContextObserver& aObserver, TBtraceNotificationPersistence aPersistence); |
|
455 public: |
|
456 TUint iId; |
|
457 TName iPattern; |
|
458 TPatternType iPatternType; |
|
459 MBtraceContextObserver& iObserver; |
|
460 TBtraceNotificationPersistence iPersistence; |
|
461 }; |
|
462 private: |
|
463 void SeenL(const TThread& aThread, const TBtraceTickCount& aTickCount); |
|
464 void GoneL(const TThread& aThread, const TBtraceTickCount& aTickCount); |
|
465 void ExitedL(const TThread& aThread, TExitType aExitType, TInt aReason, const TDesC& aCategory, const TBtraceTickCount& aTickCount); |
|
466 void AppendL(const TThread& aThread, const TBtraceTickCount& aTickCount); |
|
467 void AppendL(const TProcess& aProcess, const TBtraceTickCount& aTickCount); |
|
468 void RemoveThread(TInt aPosition); |
|
469 void SeenAllThreadsL(const TProcess& aProcess, const TBtraceTickCount& aTickCount); |
|
470 void SeenL(const TWindowGroup& aWindowGroup, const TBtraceTickCount& aTickCount); |
|
471 static TBool ThreadMatchesId(const TThread& aLeft, const TThread& aRight); |
|
472 static TBool ThreadMatchesKernelId(const TThread& aLeft, const TThread& aRight); |
|
473 static TBool ThreadMatchesNThreadAddress(const TThread& aLeft, const TThread& aRight); |
|
474 static TBool ProcessMatchesId(const TProcess& aLeft, const TProcess& aRight); |
|
475 static TBool ProcessMatchesDProcessAddress(const TProcess& aLeft, const TProcess& aRight); |
|
476 static TBool WindowGroupMatchesId(const TWindowGroup& aLeft, const TWindowGroup& aRight); |
|
477 static TBool WindowGroupMatchesThreadId(const TWindowGroup& aLeft, const TWindowGroup& aRight); |
|
478 static TBool WindowGroupMatchesWServId(const TWindowGroup& aLeft, const TWindowGroup& aRight); |
|
479 private: |
|
480 TMode iMode; |
|
481 CBtraceReader& iReader; |
|
482 TUint iNextBtraceThreadId; |
|
483 TUint iNextBtraceProcessId; |
|
484 TUint iNextBtraceWindowGroupId; |
|
485 RArray<TThread> iThreads; |
|
486 RArray<TProcess> iProcesses; |
|
487 RArray<TWindowGroup> iWindowGroups; |
|
488 RArray<TThreadSeenNotif> iThreadSeenNotifs; |
|
489 RArray<TThreadGoneNotif> iThreadGoneNotifs; |
|
490 RArray<TThreadExitNotif> iThreadExitNotifs; |
|
491 RArray<TWindowGroupSeenNotif> iWindowGroupSeenNotifs; |
|
492 }; |
|
493 |
|
494 |
|
495 class MBtraceCpuUsageObserver |
|
496 { |
|
497 public: |
|
498 enum TContextSwitchType |
|
499 { |
|
500 EToThisThread, |
|
501 EFromThisThread |
|
502 }; |
|
503 enum TIdleType |
|
504 { |
|
505 ENeverScheduled, |
|
506 EScheduledAtLeastOnce |
|
507 }; |
|
508 class TCpuUsage |
|
509 { |
|
510 public: |
|
511 TCpuUsage(const TBtraceThreadId& aId); |
|
512 TCpuUsage(const TBtraceThreadId& aId, const TBtraceTickCount& aTickCount); |
|
513 public: |
|
514 TBtraceThreadId iId; |
|
515 TUint64 iNumFastTicks; |
|
516 private: |
|
517 friend class CBtraceCpuUsage; |
|
518 TBtraceTickCount iSwitchedInAt; |
|
519 }; |
|
520 public: |
|
521 virtual void HandleCpuUsageL(const TBtraceTickCount& aTickCount, const TArray<TCpuUsage>& aCpuUsage) = 0; |
|
522 virtual void HandleContextSwitchL(const TBtraceTickCount& aTickCount, const TBtraceThreadId& aId, TContextSwitchType aType) = 0; |
|
523 virtual void HandleThreadIdleL(const TBtraceTickCount& aTickCount, const TBtraceThreadId& aId, TIdleType aIdleType) = 0; |
|
524 }; |
|
525 |
|
526 NONSHARABLE_CLASS(CBtraceCpuUsage) : public CRefCountedObject, public MBtraceObserver |
|
527 { |
|
528 public: |
|
529 IMPORT_C static CBtraceCpuUsage* NewL(CBtraceReader& aReader, CBtraceContext& aContext); |
|
530 IMPORT_C ~CBtraceCpuUsage(); |
|
531 IMPORT_C void NotifyCpuUsageL(TUint32 aNanoTickCount, TTimeIntervalMicroSeconds32 aPeriod, MBtraceCpuUsageObserver& aObserver); |
|
532 IMPORT_C void NotifyCpuUsageL(TUint32 aNanoTickCount, TTimeIntervalMicroSeconds32 aPeriod, MBtraceCpuUsageObserver& aObserver, TBtraceNotificationPersistence aPersistence); |
|
533 IMPORT_C void NotifyContextSwitchL(const TBtraceThreadId& aId, MBtraceCpuUsageObserver& aObserver); |
|
534 IMPORT_C void NotifyThreadIdleL(const TBtraceThreadId& aId, const TBtraceTickCount& aFromTickCount, TTimeIntervalMicroSeconds32 aPeriod, MBtraceCpuUsageObserver& aObserver); |
|
535 IMPORT_C void NotifyThreadIdleL(const TBtraceThreadId& aId, const TBtraceTickCount& aFromTickCount, TTimeIntervalMicroSeconds32 aPeriod, MBtraceCpuUsageObserver& aObserver, TBtraceNotificationPersistence aPersistence); |
|
536 IMPORT_C void CancelNotifyThreadIdle(MBtraceCpuUsageObserver& aObserver); |
|
537 private: |
|
538 CBtraceCpuUsage(CBtraceReader& aReader, CBtraceContext& aContext); |
|
539 void ConstructL(); |
|
540 private: // From MBtraceObserver. |
|
541 virtual void HandleBtraceFrameL(const TBtraceFrame& aFrame); |
|
542 private: |
|
543 class RCpuUsageNotif |
|
544 { |
|
545 public: |
|
546 RCpuUsageNotif(TUint32 aStartTickCount, TUint32 aNumNanoTicks, MBtraceCpuUsageObserver& aObserver, TBtraceNotificationPersistence aPersistence); |
|
547 void Close(); |
|
548 public: |
|
549 TUint32 iStartTickCount; |
|
550 TUint32 iNumNanoTicks; |
|
551 MBtraceCpuUsageObserver* iObserver; |
|
552 RArray<MBtraceCpuUsageObserver::TCpuUsage> iUsage; |
|
553 TBtraceNotificationPersistence iPersistence; |
|
554 }; |
|
555 class TContextSwitchNotif |
|
556 { |
|
557 public: |
|
558 TContextSwitchNotif(const TBtraceThreadId& aId); |
|
559 TContextSwitchNotif(const TBtraceThreadId& aId, MBtraceCpuUsageObserver& aObserver); |
|
560 public: |
|
561 TBtraceThreadId iId; |
|
562 MBtraceCpuUsageObserver* iObserver; |
|
563 }; |
|
564 class TThreadIdleNotif |
|
565 { |
|
566 public: |
|
567 TThreadIdleNotif(const TBtraceThreadId& aId); |
|
568 TThreadIdleNotif(const TBtraceThreadId& aId, const TBtraceTickCount& aFromTickCount, TUint aNumNanoTicks, MBtraceCpuUsageObserver& aObserver, TBtraceNotificationPersistence aPersistence); |
|
569 public: |
|
570 TBtraceThreadId iId; |
|
571 TUint32 iNumNanoTicks; |
|
572 MBtraceCpuUsageObserver* iObserver; |
|
573 TBtraceTickCount iLastSwitchedOut; |
|
574 TBool iEverScheduled; |
|
575 TBtraceNotificationPersistence iPersistence; |
|
576 }; |
|
577 private: |
|
578 void HandleContextSwitchL(const TBtraceTickCount& aTickCount, const TBtraceThreadId& aNewBtraceThreadId); |
|
579 void TestCpuUsagePeriodL(const TBtraceTickCount& aTickCount); |
|
580 void TestThreadIdlenessL(const TBtraceTickCount& aTickCount); |
|
581 private: |
|
582 CBtraceReader& iReader; |
|
583 CBtraceContext& iContext; |
|
584 RArray<RCpuUsageNotif> iCpuUsageNotifs; |
|
585 RArray<TContextSwitchNotif> iContextSwitchNotifs; |
|
586 RArray<TThreadIdleNotif> iThreadIdleNotifs; |
|
587 TBtraceThreadId iLastBtractThreadId; |
|
588 TInt iNumIgnoredFrames; |
|
589 TInt iNumProcessedFrames; |
|
590 TInt iNumRelevantFrames; |
|
591 }; |
|
592 |
|
593 |
|
594 class MBtraceKeyPressObserver |
|
595 { |
|
596 public: |
|
597 virtual void HandleKeyPressL(const TBtraceTickCount& aTickCount, const TKeyEvent& aKey) = 0; |
|
598 virtual void HandlePointerPressL(const TBtraceTickCount& aTickCount, const TPointerEvent& aPointer) = 0; |
|
599 virtual void HandleUnclassifiedDataL(const TBtraceTickCount& aTickCount, const TInt aCommandClass, const TInt aOpcode, const TAny* aData) = 0; |
|
600 virtual void HandleRawKeyL(const TBtraceTickCount& aTickCount, TBool aKeyUp, TInt aScanCode) = 0; |
|
601 }; |
|
602 |
|
603 NONSHARABLE_CLASS(CBtraceKeyPress) : public CRefCountedObject, public MBtraceObserver |
|
604 { |
|
605 public: |
|
606 IMPORT_C static CBtraceKeyPress* NewL(CBtraceReader& aReader); |
|
607 IMPORT_C ~CBtraceKeyPress(); |
|
608 IMPORT_C void NotifyKeyEventL(MBtraceKeyPressObserver& aObserver); |
|
609 IMPORT_C void NotifyKeyEventL(MBtraceKeyPressObserver& aObserver, TBtraceNotificationPersistence aPersistence); |
|
610 IMPORT_C void CancelNotifyKeyEvent(MBtraceKeyPressObserver& aObserver); |
|
611 IMPORT_C void NotifyPointerEventL(MBtraceKeyPressObserver& aObserver); |
|
612 IMPORT_C void NotifyPointerEventL(MBtraceKeyPressObserver& aObserver, TBtraceNotificationPersistence aPersistence); |
|
613 IMPORT_C void CancelNotifyPointerEvent(MBtraceKeyPressObserver& aObserver); |
|
614 IMPORT_C void NotifyUnclassifiedDataL(MBtraceKeyPressObserver& aObserver); |
|
615 IMPORT_C void NotifyUnclassifiedDataL(MBtraceKeyPressObserver& aObserver, TBtraceNotificationPersistence aPersistence); |
|
616 IMPORT_C void CancelNotifyUnclassifiedData(MBtraceKeyPressObserver& aObserver); |
|
617 IMPORT_C void NotifyRawKeyEventL(MBtraceKeyPressObserver& aObserver); |
|
618 IMPORT_C void NotifyRawKeyEventL(MBtraceKeyPressObserver& aObserver, TBtraceNotificationPersistence aPersistence); |
|
619 IMPORT_C void CancelNotifyRawKeyEvent(MBtraceKeyPressObserver& aObserver); |
|
620 private: |
|
621 CBtraceKeyPress(CBtraceReader& aReader); |
|
622 void ConstructL(); |
|
623 void SeenKeyL(const TBtraceTickCount& aTickCount, const TKeyEvent& aKey); |
|
624 void SeenPointerL(const TBtraceTickCount& aTickCount, const TPointerEvent& aKey); |
|
625 void SeenUnclassifiedL(const TBtraceTickCount& aTickCount, const TInt aCommandClass, const TInt aOpcode, const TAny* aData); |
|
626 void SeenRawKeyL(const TBtraceTickCount& aTickCount, TBool aKeyUp, TInt aScanCode); |
|
627 private: // From MBtraceObserver. |
|
628 virtual void HandleBtraceFrameL(const TBtraceFrame& aFrame); |
|
629 private: |
|
630 class TKeyPressNotif |
|
631 { |
|
632 public: |
|
633 TKeyPressNotif(MBtraceKeyPressObserver& aObserver, TBtraceNotificationPersistence aPersistence); |
|
634 public: |
|
635 MBtraceKeyPressObserver* iObserver; |
|
636 TBtraceNotificationPersistence iPersistence; |
|
637 }; |
|
638 CBtraceReader& iReader; |
|
639 RArray<TKeyPressNotif> iKeyNotifs; |
|
640 RArray<TKeyPressNotif> iPointerNotifs; |
|
641 RArray<TKeyPressNotif> iGenericNotifs; |
|
642 RArray<TKeyPressNotif> iRawKeyNotifs; |
|
643 }; |
|
644 |
|
645 |
|
646 class MBtraceTextOnScreenObserver |
|
647 { |
|
648 public: |
|
649 virtual void HandleTextSeenL(const TBtraceTickCount& aTickCount, const TDesC& aText, TInt aWindowGroupId) = 0; |
|
650 }; |
|
651 |
|
652 NONSHARABLE_CLASS(CBtraceTextOnScreen) : public CRefCountedObject, public MBtraceObserver |
|
653 { |
|
654 public: |
|
655 enum TMatchMode |
|
656 { |
|
657 EWildNonSpanning, |
|
658 ESpanningNonWild |
|
659 }; |
|
660 public: |
|
661 IMPORT_C static CBtraceTextOnScreen* NewL(CBtraceReader& aReader); |
|
662 IMPORT_C ~CBtraceTextOnScreen(); |
|
663 IMPORT_C void NotifyTextOnScreenL(const TDesC& aText, MBtraceTextOnScreenObserver& aObserver); |
|
664 IMPORT_C void NotifyTextOnScreenL(const TDesC& aText, MBtraceTextOnScreenObserver& aObserver, TBtraceNotificationPersistence aPersistence); |
|
665 IMPORT_C void NotifyTextOnScreenL(const TDesC& aText, TMatchMode aMatchMode, MBtraceTextOnScreenObserver& aObserver, TBtraceNotificationPersistence aPersistence); |
|
666 IMPORT_C void NotifyTextOnScreenL(const TDesC& aText, TInt aWindowGroupId, TMatchMode aMatchMode, MBtraceTextOnScreenObserver& aObserver); |
|
667 IMPORT_C void NotifyTextOnScreenL(const TDesC& aText, TInt aWindowGroupId, TMatchMode aMatchMode, MBtraceTextOnScreenObserver& aObserver, TBtraceNotificationPersistence aPersistence); |
|
668 IMPORT_C void CancelNotifyTextOnScreen(MBtraceTextOnScreenObserver& aObserver); |
|
669 private: |
|
670 CBtraceTextOnScreen(CBtraceReader& aReader); |
|
671 void ConstructL(); |
|
672 void SeenL(const TBtraceTickCount& aTickCount, const TDesC& aData, TInt aWindowGroupId); |
|
673 private: // From MBtraceObserver. |
|
674 virtual void HandleBtraceFrameL(const TBtraceFrame& aFrame); |
|
675 private: |
|
676 class TTextOnScreenNotif |
|
677 { |
|
678 public: |
|
679 TTextOnScreenNotif(const TDesC& aText, MBtraceTextOnScreenObserver& aObserver, TBtraceNotificationPersistence aPersistence); |
|
680 TTextOnScreenNotif(const TDesC& aText, TMatchMode aMatchMode, MBtraceTextOnScreenObserver& aObserver, TBtraceNotificationPersistence aPersistence); |
|
681 TTextOnScreenNotif(const TDesC& aText, TInt aWindowGroupId, TMatchMode aMatchMode, MBtraceTextOnScreenObserver& aObserver, TBtraceNotificationPersistence aPersistence); |
|
682 public: |
|
683 TPtrC iTxtPtr; |
|
684 TInt iWindowGroupId; |
|
685 TInt iMatchedChars; |
|
686 TMatchMode iMatchMode; |
|
687 MBtraceTextOnScreenObserver* iObserver; |
|
688 TBtraceNotificationPersistence iPersistence; |
|
689 }; |
|
690 CBtraceReader& iReader; |
|
691 RArray<TTextOnScreenNotif> iScreenNotifs; |
|
692 }; |
|
693 |
|
694 |
|
695 // |
|
696 // An observer to identify the occurrence of generic events (see btrace_parser_defs.h) |
|
697 // |
|
698 class MBtraceGenericObserver |
|
699 { |
|
700 public: |
|
701 virtual void HandleGenericEvent0L(const TBtraceTickCount& aTickCount, TUint8 aSubCategory) = 0; |
|
702 virtual void HandleGenericEvent1L(const TBtraceTickCount& aTickCount, TUint8 aSubCategory, TUint32 aData1) = 0; |
|
703 virtual void HandleGenericEvent2L(const TBtraceTickCount& aTickCount, TUint8 aSubCategory, TUint32 aData1, TUint32 aData2) = 0; |
|
704 virtual void HandleGenericEvent3L(const TBtraceTickCount& aTickCount, TUint8 aSubCategory, TUint32 aData1, TUint32 aData2, TUint32 aData3) = 0; |
|
705 }; |
|
706 |
|
707 NONSHARABLE_CLASS(CBtraceGeneric) : public CRefCountedObject, public MBtraceObserver |
|
708 { |
|
709 public: |
|
710 IMPORT_C static CBtraceGeneric* NewL(CBtraceReader& aReader); |
|
711 IMPORT_C ~CBtraceGeneric(); |
|
712 IMPORT_C void NotifyGenericEventL(MBtraceGenericObserver& aObserver); |
|
713 private: |
|
714 CBtraceGeneric(CBtraceReader& aReader); |
|
715 void ConstructL(); |
|
716 // MBtraceObserver pure virtuals |
|
717 virtual void HandleBtraceFrameL(const TBtraceFrame& aFrame); |
|
718 void SeenGeneric0L(const TBtraceTickCount& aTickCount, TUint8 aSubCategory); |
|
719 void SeenGeneric1L(const TBtraceTickCount& aTickCount, TUint8 aSubCategory, TUint32 aData1); |
|
720 void SeenGeneric2L(const TBtraceTickCount& aTickCount, TUint8 aSubCategory, TUint32 aData1, TUint32 aData2); |
|
721 void SeenGeneric3L(const TBtraceTickCount& aTickCount, TUint8 aSubCategory, TUint32 aData1, TUint32 aData2, TUint32 aData3); |
|
722 private: |
|
723 CBtraceReader& iReader; |
|
724 //TODO TBtraceNotificationPersistence iPersistence |
|
725 RPointerArray<MBtraceGenericObserver> iObservers; // pointers not owned |
|
726 }; |
|
727 |
|
728 |
|
729 class MBtraceDomainEventObserver |
|
730 { |
|
731 public: |
|
732 virtual void HandleDomainEventL(const TBtraceTickCount& aTickCount, MBtraceDomainEventObserver& aObserver) = 0; |
|
733 }; |
|
734 |
|
735 NONSHARABLE_CLASS(CBtraceDomainEvent) : public CRefCountedObject, public MBtraceObserver |
|
736 { |
|
737 public: |
|
738 IMPORT_C static CBtraceDomainEvent* NewL(CBtraceReader& aReader); |
|
739 IMPORT_C ~CBtraceDomainEvent(); |
|
740 IMPORT_C void NotifyDomainEventL(TUint aSubCategory, MBtraceDomainEventObserver& aObserver, TBtraceNotificationPersistence aPersistence); |
|
741 IMPORT_C void NotifyDomainEventL(TUint aSubCategory, TUint aData1, MBtraceDomainEventObserver& aObserver, TBtraceNotificationPersistence aPersistence); |
|
742 IMPORT_C void NotifyDomainEventL(TUint aSubCategory, TUint aData1, TUint aData2, MBtraceDomainEventObserver& aObserver, TBtraceNotificationPersistence aPersistence); |
|
743 IMPORT_C void NotifyDomainEventL(TUint aSubCategory, TUint aData1, TUint aData2, TUint aData3, MBtraceDomainEventObserver& aObserver, TBtraceNotificationPersistence aPersistence); |
|
744 IMPORT_C void CancelNotifyDomainEvent(MBtraceDomainEventObserver& aObserver); |
|
745 private: |
|
746 CBtraceDomainEvent(CBtraceReader& aReader); |
|
747 void ConstructL(); |
|
748 private: // From MBtraceObserver. |
|
749 virtual void HandleBtraceFrameL(const TBtraceFrame& aFrame); |
|
750 private: |
|
751 class TDomainEventNotif |
|
752 { |
|
753 public: |
|
754 TDomainEventNotif(TUint aSubCategory); |
|
755 TDomainEventNotif(TUint aSubCategory, MBtraceDomainEventObserver& aObserver, TBtraceNotificationPersistence aPersistence); |
|
756 void AddDataItem(TUint aData); |
|
757 TBool operator==(const TDomainEventNotif& aNotif) const; |
|
758 public: |
|
759 enum { KMaxNumDataItems = 3 }; |
|
760 public: |
|
761 TUint iSubCategory; |
|
762 MBtraceDomainEventObserver* iObserver; |
|
763 TBtraceNotificationPersistence iPersistence; |
|
764 TInt iDataCount; |
|
765 TFixedArray<TUint, KMaxNumDataItems> iData; |
|
766 }; |
|
767 private: |
|
768 CBtraceReader& iReader; |
|
769 RArray<TDomainEventNotif> iNotifs; |
|
770 }; |
|
771 |
|
772 |
|
773 class MBtraceAppResponseObserver |
|
774 { |
|
775 public: |
|
776 virtual void HandleAppResponseSeenL(const TBtraceTickCount& aTickCount) = 0; |
|
777 }; |
|
778 |
|
779 NONSHARABLE_CLASS(CBtraceAppResponse) : public CRefCountedObject, public MBtraceObserver |
|
780 { |
|
781 public: |
|
782 IMPORT_C static CBtraceAppResponse* NewL(CBtraceReader& aReader); |
|
783 IMPORT_C ~CBtraceAppResponse(); |
|
784 IMPORT_C void NotifyAppResponseL(MBtraceAppResponseObserver& aObserver, const TProcessId& aProcessId); |
|
785 IMPORT_C void NotifyAppResponseL(MBtraceAppResponseObserver& aObserver, const TProcessId& aProcessId, TBtraceNotificationPersistence aPersistence); |
|
786 IMPORT_C void CancelNotifyAppResponse(MBtraceAppResponseObserver& aObserver); |
|
787 private: |
|
788 CBtraceAppResponse(CBtraceReader& aReader); |
|
789 void ConstructL(); |
|
790 void SeenAppResponseL(const TBtraceTickCount& aTickCount, const TProcessId& aProcessId); |
|
791 private: // From MBtraceObserver. |
|
792 virtual void HandleBtraceFrameL(const TBtraceFrame& aFrame); |
|
793 private: |
|
794 class TAppResponseNotif |
|
795 { |
|
796 public: |
|
797 TAppResponseNotif(MBtraceAppResponseObserver& aObserver, const TProcessId& aProcessId, TBtraceNotificationPersistence aPersistence); |
|
798 public: |
|
799 MBtraceAppResponseObserver& iObserver; |
|
800 TProcessId iProcessId; |
|
801 TBtraceNotificationPersistence iPersistence; |
|
802 }; |
|
803 private: |
|
804 CBtraceReader& iReader; |
|
805 RArray<TAppResponseNotif> iNotifs; |
|
806 }; |
|
807 |
|
808 |
|
809 class MBtraceScreenUpdateObserver |
|
810 { |
|
811 public: |
|
812 virtual void HandleScreenUpdateL(const TBtraceTickCount& aTickCount, TInt aScreenNumber, const TRect& aRect) = 0; |
|
813 }; |
|
814 |
|
815 NONSHARABLE_CLASS(CBtraceScreenUpdate) : public CRefCountedObject, public MBtraceObserver |
|
816 { |
|
817 public: |
|
818 IMPORT_C static CBtraceScreenUpdate* NewL(CBtraceReader& aReader); |
|
819 IMPORT_C ~CBtraceScreenUpdate(); |
|
820 IMPORT_C void NotifyScreenUpdateL(MBtraceScreenUpdateObserver& aObserver); |
|
821 IMPORT_C void NotifyScreenUpdateL(MBtraceScreenUpdateObserver& aObserver, TBtraceNotificationPersistence aPersistence); |
|
822 IMPORT_C void NotifyScreenUpdateL(TInt aScreenNumber, const TRect& aRect, MBtraceScreenUpdateObserver& aObserver); |
|
823 IMPORT_C void NotifyScreenUpdateL(TInt aScreenNumber, const TRect& aRect, MBtraceScreenUpdateObserver& aObserver, TBtraceNotificationPersistence aPersistence); |
|
824 IMPORT_C void CancelNotifyScreenUpdate(MBtraceScreenUpdateObserver& aObserver); |
|
825 private: |
|
826 CBtraceScreenUpdate(CBtraceReader& aReader); |
|
827 void ConstructL(); |
|
828 void HandleScreenUpdateL(const TBtraceTickCount& aTickCount, TInt aScreenNumber, const TRect& aRect); |
|
829 private: // From MBtraceObserver. |
|
830 virtual void HandleBtraceFrameL(const TBtraceFrame& aFrame); |
|
831 private: |
|
832 class TScreenUpdateNotif |
|
833 { |
|
834 public: |
|
835 TScreenUpdateNotif(MBtraceScreenUpdateObserver& aObserver, TBtraceNotificationPersistence aPersistence); |
|
836 TScreenUpdateNotif(TInt aScreenNumber, const TRect& aRect, MBtraceScreenUpdateObserver& aObserver, TBtraceNotificationPersistence aPersistence); |
|
837 public: |
|
838 TBool iNotifyAll; |
|
839 TInt iScreenNumber; |
|
840 TRect iRect; |
|
841 MBtraceScreenUpdateObserver* iObserver; |
|
842 TBtraceNotificationPersistence iPersistence; |
|
843 }; |
|
844 private: |
|
845 CBtraceReader& iReader; |
|
846 RArray<TScreenUpdateNotif> iNotifs; |
|
847 }; |
|
848 |
|
849 class MBtracePubSubObserver |
|
850 { |
|
851 public: |
|
852 virtual void HandlePropertyChangedL(const TBtraceTickCount& aTickCount, TUint aCategory, TUint aKey, TInt aNewValue) = 0; |
|
853 virtual void HandlePropertyChangedL(const TBtraceTickCount& aTickCount, TUint aCategory, TUint aKey, const TDesC8& aNewValue) = 0; |
|
854 }; |
|
855 |
|
856 NONSHARABLE_CLASS(CBtracePubSub) : public CRefCountedObject, public MBtraceObserver |
|
857 { |
|
858 public: |
|
859 IMPORT_C static CBtracePubSub* NewL(CBtraceReader& aReader); |
|
860 IMPORT_C ~CBtracePubSub(); |
|
861 IMPORT_C void NotifyPropertyChangedL(MBtracePubSubObserver& aObserver); |
|
862 IMPORT_C void NotifyPropertyChangedL(TUint* aCategory, TUint* aKey, MBtracePubSubObserver& aObserver, TBtraceNotificationPersistence aPersistence); // Note, the pointer parameters are optional. |
|
863 IMPORT_C void NotifyIntegerPropertyChangedL(TUint* aCategory, TUint* aKey, TInt* aValue, MBtracePubSubObserver& aObserver, TBtraceNotificationPersistence aPersistence); // Note, the pointer parameters are optional. |
|
864 IMPORT_C void NotifyDataPropertyChangedL(TUint* aCategory, TUint* aKey, const TDesC8* aValue, MBtracePubSubObserver& aObserver, TBtraceNotificationPersistence aPersistence); // Note, the pointer parameters are optional. |
|
865 IMPORT_C void CancelNotifyPropertyChanged(MBtracePubSubObserver& aObserver); |
|
866 private: |
|
867 CBtracePubSub(CBtraceReader& aReader); |
|
868 void ConstructL(); |
|
869 private: // From MBtraceObserver. |
|
870 virtual void HandleBtraceFrameL(const TBtraceFrame& aFrame); |
|
871 private: |
|
872 class TPubSubNotif |
|
873 { |
|
874 public: |
|
875 TPubSubNotif(TUint* aCategory, TUint* aKey, TInt* aIntegerValue, const TDesC8* aDataValue, MBtracePubSubObserver& aObserver, TBtraceNotificationPersistence aPersistence); |
|
876 TBool Matches(TUint aCategory, TUint aKey, TInt aIntegerValue) const; |
|
877 TBool Matches(TUint aCategory, TUint aKey, const TDesC8& aDataValue) const; |
|
878 public: |
|
879 TUint* iCategory; |
|
880 TUint* iKey; |
|
881 TInt* iIntegerValue; |
|
882 const TDesC8* iDataValue; |
|
883 MBtracePubSubObserver& iObserver; |
|
884 TBtraceNotificationPersistence iPersistence; |
|
885 }; |
|
886 private: |
|
887 CBtraceReader& iReader; |
|
888 RArray<TPubSubNotif> iNotifs; |
|
889 }; |
|
890 |
|
891 class MBtraceFocusChangeObserver |
|
892 { |
|
893 public: |
|
894 virtual void HandleFocusChangedL(const TBtraceTickCount& aTickCount, const TBtraceWindowGroupId& aWindowGroupId) = 0; |
|
895 }; |
|
896 |
|
897 NONSHARABLE_CLASS(CBtraceFocusChange) : public CRefCountedObject, public MBtraceObserver |
|
898 { |
|
899 public: |
|
900 IMPORT_C static CBtraceFocusChange* NewL(CBtraceReader& aReader, CBtraceContext& aContext); |
|
901 IMPORT_C ~CBtraceFocusChange(); |
|
902 IMPORT_C void NotifyFocusChangedL(const TDesC& aWindowGroupNamePattern, MBtraceFocusChangeObserver& aObserver); |
|
903 IMPORT_C void NotifyFocusChangedL(const TDesC& aWindowGroupNamePattern, MBtraceFocusChangeObserver& aObserver, TBtraceNotificationPersistence aPersistence); |
|
904 IMPORT_C void CancelNotifyFocusChanged(MBtraceFocusChangeObserver& aObserver); |
|
905 private: |
|
906 CBtraceFocusChange(CBtraceReader& aReader, CBtraceContext& aContext); |
|
907 void ConstructL(); |
|
908 private: // From MBtraceObserver. |
|
909 virtual void HandleBtraceFrameL(const TBtraceFrame& aFrame); |
|
910 private: |
|
911 class TFocusChangeNotif |
|
912 { |
|
913 public: |
|
914 TFocusChangeNotif(const TDesC& aWindowGroupNamePattern, MBtraceFocusChangeObserver& aObserver, TBtraceNotificationPersistence aPersistence); |
|
915 public: |
|
916 TPtrC iWindowGroupNamePattern; |
|
917 MBtraceFocusChangeObserver& iObserver; |
|
918 TBtraceNotificationPersistence iPersistence; |
|
919 }; |
|
920 private: |
|
921 CBtraceReader& iReader; |
|
922 CBtraceContext& iContext; |
|
923 RArray<TFocusChangeNotif> iNotifs; |
|
924 }; |
|
925 |
|
926 |
|
927 #endif // __BTRACE_PARSER_H__ |