|
1 /** |
|
2 * Copyright (c) 2007-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 the License "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 * Trace API |
|
16 * ---------------TTraceContext----------------------- |
|
17 * |
|
18 */ |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 /** |
|
24 @file |
|
25 @publishedPartner |
|
26 @prototype |
|
27 |
|
28 Define the context of a trace packet by setting its attributes. |
|
29 |
|
30 The module UID is defaulted according to the FW_DEFAULT_MODULEUID definition. |
|
31 The HasThreadIdentification is defaulted to the FW_DEFAULT_HAS_THREAD_IDENTIFICATION definition. |
|
32 The HasProgramCounter is defaulted to the FW_DEFAULT_HAS_PC definition. |
|
33 |
|
34 @param aClassification @see TClassification |
|
35 |
|
36 */ |
|
37 TTraceContext::TTraceContext(const TClassification aClassification) |
|
38 :iModuleUid(FW_DEFAULT_MODULEUID), iClassification(aClassification), iHasThreadIdentification(FW_DEFAULT_HAS_THREAD_IDENTIFICATION), iHasProgramCounter(FW_DEFAULT_HAS_PC), iReserved1(0), iReserved2(0) |
|
39 { |
|
40 } |
|
41 |
|
42 /** |
|
43 * Define the context of a trace packet by setting its attributes. |
|
44 * |
|
45 * The HasThreadIdentification is defaulted to the FW_DEFAULT_HAS_THREAD_IDENTIFICATION definition. |
|
46 * The HasProgramCounter is defaulted to the FW_DEFAULT_HAS_PC definition. |
|
47 * |
|
48 * @param aModuleUid @see TModuleUid |
|
49 * @param aClassification @see TClassification |
|
50 */ |
|
51 TTraceContext::TTraceContext(const TModuleUid aModuleUid, const TClassification aClassification) |
|
52 :iModuleUid(aModuleUid), iClassification(aClassification), iHasThreadIdentification(FW_DEFAULT_HAS_THREAD_IDENTIFICATION), iHasProgramCounter(FW_DEFAULT_HAS_PC), iReserved1(0), iReserved2(0) |
|
53 { |
|
54 } |
|
55 |
|
56 /** |
|
57 * Define the context of a trace packet by setting its attributes. |
|
58 * |
|
59 * The module UID is defaulted according to the FW_DEFAULT_MODULEUID definition. |
|
60 * |
|
61 * @param aClassification @see TClassification |
|
62 * @param aHasThreadIdentification Set whether to add thread identification automatically in the trace packet. |
|
63 * @param aHasProgramCounter Set whether to add PC (program counter) automatically in the trace packet. |
|
64 */ |
|
65 TTraceContext::TTraceContext(const TClassification aClassification, const THasThreadIdentification aHasThreadIdentification, const THasProgramCounter aHasProgramCounter) |
|
66 :iModuleUid(FW_DEFAULT_MODULEUID), iClassification(aClassification), iHasThreadIdentification(aHasThreadIdentification), iHasProgramCounter(aHasProgramCounter), iReserved1(0), iReserved2(0) |
|
67 { |
|
68 } |
|
69 |
|
70 |
|
71 /** |
|
72 * Define the context of a trace packet by setting its attributes. |
|
73 * |
|
74 * @param aModuleUid @see TModuleUid |
|
75 * @param aClassification @see TClassification |
|
76 * @param aHasThreadIdentification Set whether to add thread identification automatically in the trace packet. |
|
77 * @param aHasProgramCounter Set whether to add PC (program counter) automatically in the trace packet. |
|
78 */ |
|
79 TTraceContext::TTraceContext(const TModuleUid aModuleUid, const TClassification aClassification, const THasThreadIdentification aHasThreadIdentification, const THasProgramCounter aHasProgramCounter) |
|
80 :iModuleUid(aModuleUid), iClassification(aClassification), iHasThreadIdentification(aHasThreadIdentification), iHasProgramCounter(aHasProgramCounter), iReserved1(0), iReserved2(0) |
|
81 { |
|
82 } |
|
83 |
|
84 //------------------ Trace ----------------------- |
|
85 /** |
|
86 Outputs a trace packet containing variable length data. |
|
87 |
|
88 If the specified data is too big to fit into a single |
|
89 trace record a multipart trace is generated. |
|
90 |
|
91 @param aContext Attributes of the trace point. |
|
92 @param aFormatId A format identifier as specified by @see TFormatId |
|
93 @param aData Additional data to add to trace packet. |
|
94 Must be word aligned, i.e. a multiple of 4. |
|
95 |
|
96 @return The trace packet was/was not logged. |
|
97 |
|
98 @See BTrace::TMultipart |
|
99 */ |
|
100 template<typename T> |
|
101 TBool Trace(const TTraceContext& aContext, TFormatId aFormatId, const T& aData) |
|
102 { |
|
103 return Trace(aContext, aFormatId, &aData, sizeof(aData)); |
|
104 } |
|
105 |