56
|
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 for BTrace OST categories
|
|
15 |
//
|
|
16 |
|
|
17 |
#ifndef __BTRACEOSTCATEGORYHANDLER_H__
|
|
18 |
#define __BTRACEOSTCATEGORYHANDLER_H__
|
|
19 |
|
|
20 |
|
|
21 |
// Include files
|
|
22 |
#include <kernel/kernel.h>
|
|
23 |
#include "BTraceCategoryHandler.h"
|
|
24 |
#include "TraceCoreActivation.h"
|
|
25 |
|
|
26 |
#define MAX_TRACE_DATA_SIZE 512
|
|
27 |
#define COMPONENT_GROUP_CACHE_SIZE 12 // 4 * (1 ComponentId + 1 groupId + activation info )
|
|
28 |
#define MAX_MULTIPART_TRACES 4
|
|
29 |
|
|
30 |
// Forward declarations
|
|
31 |
class DBTraceOstCategoryBitmap;
|
|
32 |
|
|
33 |
#ifndef __SMP__
|
|
34 |
|
|
35 |
/**
|
|
36 |
* Multipart trace message.
|
|
37 |
*/
|
|
38 |
class TMultiPartTrace
|
|
39 |
{
|
|
40 |
public:
|
|
41 |
TUint32 iMultiPartId;
|
|
42 |
TUint32 iHeader;
|
|
43 |
TUint32 iHeader2;
|
|
44 |
TUint32 iContext;
|
|
45 |
TUint32 iComponentId;
|
|
46 |
TUint32 iTraceWord;
|
|
47 |
TUint8 iData[MAX_TRACE_DATA_SIZE];
|
|
48 |
TUint32 iPc;
|
|
49 |
TUint32 iDataInserted;
|
|
50 |
};
|
|
51 |
|
|
52 |
#endif // !__SMP__
|
|
53 |
|
|
54 |
/**
|
|
55 |
* Category handler for OST
|
|
56 |
*/
|
|
57 |
NONSHARABLE_CLASS( DBTraceOstCategoryHandler ) : public DBTraceCategoryHandler
|
|
58 |
, public MTraceCoreActivationNotification
|
|
59 |
{
|
|
60 |
public:
|
|
61 |
|
|
62 |
/**
|
|
63 |
* Constructor
|
|
64 |
*/
|
|
65 |
DBTraceOstCategoryHandler();
|
|
66 |
|
|
67 |
/**
|
|
68 |
* Destructor
|
|
69 |
*/
|
|
70 |
~DBTraceOstCategoryHandler();
|
|
71 |
|
|
72 |
/**
|
|
73 |
* Initializes this handler
|
|
74 |
*/
|
|
75 |
TInt Init();
|
|
76 |
|
|
77 |
/**
|
|
78 |
* Set settings
|
|
79 |
*
|
|
80 |
* @param aSettings Settings
|
|
81 |
*/
|
|
82 |
void SetSettings( DTraceCoreSettings* aSettings );
|
|
83 |
|
|
84 |
/**
|
|
85 |
* Traces deactivated
|
|
86 |
*/
|
|
87 |
TBool iAllTracesDeactivated;
|
|
88 |
|
|
89 |
/**
|
|
90 |
* Component/Group cache
|
|
91 |
*/
|
|
92 |
TUint32 iComponentGroupCache[COMPONENT_GROUP_CACHE_SIZE];
|
|
93 |
TUint32* iCacheItem1;
|
|
94 |
TUint32* iCacheItem2;
|
|
95 |
TUint32* iCacheItem3;
|
|
96 |
TUint32* iCacheItem4;
|
|
97 |
|
|
98 |
TUint32* iTemp;
|
|
99 |
|
|
100 |
private:
|
|
101 |
|
|
102 |
/**
|
|
103 |
* Notification that the activation state has changed
|
|
104 |
*
|
|
105 |
* @param aActivation the activation interface that was updated
|
|
106 |
* @param aFromSettings ETrue if activation was due to settings read, EFalse if from some other source
|
|
107 |
* @param aComponentId Component ID of the activation
|
|
108 |
*/
|
|
109 |
void ActivationChanged( MTraceCoreActivation& aActivation, TBool aFromSettings,
|
|
110 |
TUint32 aComponentId);
|
|
111 |
|
|
112 |
/**
|
|
113 |
* MTraceCoreBTraceCategoryHandler implementation for KCategoryNokiaOst
|
|
114 |
*
|
|
115 |
* @param aHeader BTrace header
|
|
116 |
* @param aHeader2 Extra header data
|
|
117 |
* @param aContext The thread context in which this function was called
|
|
118 |
* @param a1 The first trace parameter
|
|
119 |
* @param a2 The second trace parameter
|
|
120 |
* @param a3 The third trace parameter
|
|
121 |
* @param aExtra Extra trace data
|
|
122 |
* @param aPc The program counter value
|
|
123 |
*/
|
|
124 |
TBool HandleFrame( TUint32 aHeader, TUint32 aHeader2, const TUint32 aContext,
|
|
125 |
const TUint32 a1, const TUint32 a2, const TUint32 a3,
|
|
126 |
const TUint32 aExtra, const TUint32 aPc );
|
|
127 |
|
|
128 |
/**
|
|
129 |
* Checks if given trace is a Multipart trace
|
|
130 |
*
|
|
131 |
* @param aHeader Header data
|
|
132 |
* @param aHeader2 Extra header data
|
|
133 |
*/
|
|
134 |
inline TBool CheckMultiPart( TUint32 aHeader, TUint32 aHeader2 );
|
|
135 |
|
|
136 |
/**
|
|
137 |
* Handles this Multipart trace
|
|
138 |
*
|
|
139 |
* @param aHeader BTrace header
|
|
140 |
* @param aHeader2 Extra header data
|
|
141 |
* @param aContext The thread context in which this function was called
|
|
142 |
* @param aTotalMessageLength Total message length of this multipart message
|
|
143 |
* @param aComponentId Component ID
|
|
144 |
* @param aData The data
|
|
145 |
* @param aExtra Extra trace data
|
|
146 |
* @param aPc The program counter value
|
|
147 |
*/
|
|
148 |
TBool HandleMultiPart( TUint32 aHeader, TUint32 aHeader2, const TUint32 aContext,
|
|
149 |
const TUint32 aTotalMessageLength, const TUint32 aComponentId,
|
|
150 |
const TUint32 aData, const TUint32 aExtra, const TUint32 aPc );
|
|
151 |
|
|
152 |
/**
|
|
153 |
* Checks if there is a dropped trace and updates header if so
|
|
154 |
*
|
|
155 |
* @param aHeader Header data
|
|
156 |
*/
|
|
157 |
inline TBool CheckDroppedTrace( TUint32& aHeader );
|
|
158 |
|
|
159 |
#ifndef __SMP__
|
|
160 |
|
|
161 |
/**
|
|
162 |
* Calculates data start offset
|
|
163 |
*
|
|
164 |
* @param aHeader BTrace header
|
|
165 |
*/
|
|
166 |
TUint32 CalculateDataStartOffset( TUint32 aHeader );
|
|
167 |
|
|
168 |
/**
|
|
169 |
* Multipart traces
|
|
170 |
*/
|
|
171 |
TMultiPartTrace iMultiPartTrace;
|
|
172 |
|
|
173 |
#else // !__SMP__
|
|
174 |
|
|
175 |
/**
|
|
176 |
* Find multi part id from multipart array
|
|
177 |
* @return index where the MultiPartActivationInfo with aMultiPartId is found.
|
|
178 |
*/
|
|
179 |
TInt Find( TUint32 aMultiPartId );
|
|
180 |
|
|
181 |
/**
|
|
182 |
* "Remove" multipart from array
|
|
183 |
*/
|
|
184 |
void Remove( TUint32 aIndex );
|
|
185 |
|
|
186 |
/**
|
|
187 |
* Insert multi part activation info to array if it doesn't exist yet.
|
|
188 |
* @return KErrNone if insert ok.
|
|
189 |
*/
|
|
190 |
TInt InsertIfNotExist( TMultiPartActivationInfo &aMultiPartTrace );
|
|
191 |
|
|
192 |
/**
|
|
193 |
* Saved activation item for multipart traces
|
|
194 |
*/
|
|
195 |
TMultiPartActivationInfo iMultipartArray[MAX_MULTIPART_TRACES];
|
|
196 |
|
|
197 |
/**
|
|
198 |
* List of free/used multipart indexes
|
|
199 |
*/
|
|
200 |
TInt iFreeList[MAX_MULTIPART_TRACES];
|
|
201 |
|
|
202 |
#endif // __SMP__
|
|
203 |
|
|
204 |
/**
|
|
205 |
* Trace bitmap for OST category
|
|
206 |
*/
|
|
207 |
DBTraceOstCategoryBitmap* iOstTraceBitmap;
|
|
208 |
|
|
209 |
|
|
210 |
};
|
|
211 |
|
|
212 |
#endif
|
|
213 |
|
|
214 |
// End of File
|