|
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 // Trace Core |
|
15 // |
|
16 |
|
17 #include "TraceCoreHandler.h" |
|
18 #include "TraceCore.h" |
|
19 #include "TraceCoreDebug.h" |
|
20 #include "OstTraceDefinitions.h" |
|
21 #ifdef OST_TRACE_COMPILER_IN_USE |
|
22 #include "TraceCoreHandlerTraces.h" |
|
23 #endif |
|
24 |
|
25 |
|
26 |
|
27 /** |
|
28 * Constructor |
|
29 */ |
|
30 DTraceCoreHandler::DTraceCoreHandler() |
|
31 : iWriter( NULL ) |
|
32 , iSettings( NULL ) |
|
33 { |
|
34 } |
|
35 |
|
36 |
|
37 /** |
|
38 * Destructor |
|
39 */ |
|
40 DTraceCoreHandler::~DTraceCoreHandler() |
|
41 { |
|
42 iWriter = NULL; |
|
43 Unregister(); |
|
44 } |
|
45 |
|
46 |
|
47 /** |
|
48 * Called before SetWriter with interrupts enabled |
|
49 * |
|
50 * @param aWriter The new writer |
|
51 */ |
|
52 void DTraceCoreHandler::PrepareSetWriter( DTraceCoreWriter* /*aWriter*/ ) |
|
53 { |
|
54 } |
|
55 |
|
56 |
|
57 /** |
|
58 * Sets active writer |
|
59 * |
|
60 * @param aWriter The new writer |
|
61 */ |
|
62 void DTraceCoreHandler::SetWriter( DTraceCoreWriter* aWriter ) |
|
63 { |
|
64 iWriter = aWriter; |
|
65 } |
|
66 |
|
67 |
|
68 /** |
|
69 * Sets active settings (saver) |
|
70 * |
|
71 * @param aSettings The new settings |
|
72 */ |
|
73 void DTraceCoreHandler::SetSettings( DTraceCoreSettings* aSettings ) |
|
74 { |
|
75 iSettings = aSettings; |
|
76 } |
|
77 |
|
78 |
|
79 /** |
|
80 * Registers this handler to TraceCore |
|
81 */ |
|
82 TInt DTraceCoreHandler::Register() |
|
83 { |
|
84 TInt ret = KErrGeneral; |
|
85 |
|
86 // Get TraceCore |
|
87 DTraceCore* traceCore = DTraceCore::GetInstance(); |
|
88 if ( traceCore != NULL ) |
|
89 { |
|
90 // Register this as a handler |
|
91 ret = traceCore->RegisterHandler( *this ); |
|
92 } |
|
93 OstTrace1( TRACE_IMPORTANT , DTRACECOREHANDLER_REGISTER_NO_TRACECORE, "DTraceCoreHandler::Register - %d", ret); |
|
94 return ret; |
|
95 } |
|
96 |
|
97 |
|
98 /** |
|
99 * Unregisters this handler from trace core |
|
100 */ |
|
101 void DTraceCoreHandler::Unregister() |
|
102 { |
|
103 OstTrace0( TRACE_FLOW, DTRACECOREHANDLER_UNREGISTER_ENTRY, "> DTraceCoreHandler::Unregister"); |
|
104 // Get TraceCore |
|
105 DTraceCore* traceCore = DTraceCore::GetInstance(); |
|
106 if ( traceCore != NULL ) |
|
107 { |
|
108 // Unregister this handler |
|
109 traceCore->UnregisterHandler( *this ); |
|
110 } |
|
111 } |
|
112 |
|
113 // End of File |