|
1 // Copyright (c) 2007-2010 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 // Handler interface for BTrace categories |
|
15 // |
|
16 |
|
17 #ifndef __TRACECOREBTRACEHANDLER_H__ |
|
18 #define __TRACECOREBTRACEHANDLER_H__ |
|
19 |
|
20 |
|
21 // Include files |
|
22 #include "TraceCoreHandler.h" |
|
23 |
|
24 |
|
25 // Forward declarations |
|
26 class DTraceCoreWriter; |
|
27 class DTraceCoreSettings; |
|
28 class DBTraceCategoryHandler; |
|
29 class DBTraceOstCategoryHandler; |
|
30 class DBTraceKernelCategoryHandler; |
|
31 class DBTracePrintfCategoryHandler; |
|
32 |
|
33 |
|
34 /** |
|
35 * TraceCoreHandler implementation for BTrace |
|
36 */ |
|
37 NONSHARABLE_CLASS( DTraceCoreBTraceHandler ) : public DTraceCoreHandler |
|
38 { |
|
39 public: |
|
40 |
|
41 /** |
|
42 * Constructor |
|
43 */ |
|
44 DTraceCoreBTraceHandler(); |
|
45 |
|
46 /** |
|
47 * Destructor |
|
48 */ |
|
49 ~DTraceCoreBTraceHandler(); |
|
50 |
|
51 /** |
|
52 * Initializes this handler |
|
53 */ |
|
54 TInt Init(); |
|
55 |
|
56 /** |
|
57 * Delegates the writer to category handlers |
|
58 * |
|
59 * @param aWriter The new writer |
|
60 */ |
|
61 void PrepareSetWriter( DTraceCoreWriter* aWriter ); |
|
62 |
|
63 /** |
|
64 * Delegates the writer to category handlers |
|
65 * |
|
66 * @param aWriter The new writer |
|
67 */ |
|
68 void SetWriter( DTraceCoreWriter* aWriter ); |
|
69 |
|
70 /** |
|
71 * Delegates the settings (saver) to category handlers |
|
72 */ |
|
73 void SetSettings( DTraceCoreSettings* aSettings ); |
|
74 |
|
75 /** |
|
76 * Registers a category handler. This overwrites the existing category handler for given category |
|
77 * |
|
78 * @param aCategory The category to be processed with the category handler |
|
79 * @param aHandler The handler which processes the category |
|
80 */ |
|
81 void RegisterCategoryHandler( TUint8 aCategory, DBTraceCategoryHandler& aHandler ); |
|
82 |
|
83 /** |
|
84 * Unregisters a category handler |
|
85 * |
|
86 * @param aCategory The category to be removed |
|
87 */ |
|
88 void UnregisterCategoryHandler( TUint8 aCategory ); |
|
89 |
|
90 private: |
|
91 |
|
92 /** |
|
93 * Callback function that is registered to BTrace |
|
94 * |
|
95 * @param aHeader BTrace header |
|
96 * @param aHeader2 Extra header data |
|
97 * @param aContext The thread context in which this function was called |
|
98 * @param a1 The first trace parameter |
|
99 * @param a2 The second trace parameter |
|
100 * @param a3 The third trace parameter |
|
101 * @param aExtra Extra trace data |
|
102 * @param aPc The program counter value |
|
103 */ |
|
104 static TBool BTraceHandlerFunc( TUint32 aHeader, TUint32 aHeader2, const TUint32 aContext, |
|
105 const TUint32 a1, const TUint32 a2, const TUint32 a3, const TUint32 aExtra, const TUint32 aPc ); |
|
106 |
|
107 /** |
|
108 * Gets the category handler for given BTrace header |
|
109 * |
|
110 * @param aHeader BTrace header |
|
111 */ |
|
112 inline DBTraceCategoryHandler* GetCategoryHandler( TUint32 aHeader ); |
|
113 |
|
114 /** |
|
115 * Starts the OST category handler |
|
116 */ |
|
117 TInt StartOstHandler(); |
|
118 /** |
|
119 * Starts the kernel category handler |
|
120 */ |
|
121 TInt StartKernelHandler(); |
|
122 |
|
123 private: |
|
124 |
|
125 /** |
|
126 * Static instance, accessed from the BTrace handler callback |
|
127 */ |
|
128 static DTraceCoreBTraceHandler* iInstance; |
|
129 |
|
130 /** |
|
131 * Registered category handlers |
|
132 */ |
|
133 DBTraceCategoryHandler** iCategoryHandlers; |
|
134 |
|
135 /** |
|
136 * Category handler for OST |
|
137 */ |
|
138 DBTraceOstCategoryHandler* iOstHandler; |
|
139 |
|
140 /** |
|
141 * Category handler for Symbian BTrace categories |
|
142 */ |
|
143 DBTraceKernelCategoryHandler* iKernelHandler; |
|
144 |
|
145 }; |
|
146 |
|
147 #endif // __TRACECOREBTRACEHANDLER_H__ |
|
148 |
|
149 // End of File |