|
1 /* |
|
2 * Copyright (c) 2008 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 "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: Help class for debugging/optimizing the command stream. |
|
15 * ----------------------------------------------------------------------------- |
|
16 * How to use CAlfCommandDebug |
|
17 * |
|
18 * - alfred.iby |
|
19 * - enable inclusion of alfcommanddebug.dll and its resource |
|
20 * alfcommanddescriptions.rsc |
|
21 * |
|
22 * What information are you interested in? |
|
23 * - Select the printed debug information in alfcommanddebug.cpp in |
|
24 * ConstructL method. |
|
25 * |
|
26 * Decide, which point do you want to debug. You can select more than one option. |
|
27 * |
|
28 * - alfrenderstage - can print all serialized commands |
|
29 * - enable flag and macro _ALF_PRINT_WS_COMMANDS_ in alfrenderstageplugin.mmp |
|
30 * |
|
31 * |
|
32 * - alfhierarcy - can print all hierarchy related commands (creation, destruction, |
|
33 * posting draw, etc) |
|
34 * - define _ALF_LOGGING and undefine it in alfhierarchy.cpp around #include <alflogger.h> . |
|
35 * |
|
36 * - define MACRO HUI_DEBUG_TRACK_DRAWING and #define HUI_DEBUG_TRACK_DRAWING in |
|
37 * alfappservercore.mmp |
|
38 * |
|
39 * |
|
40 * - alfstreamerbridge - can give human readable name for the commands added to |
|
41 * the queue and processed from the queue |
|
42 * |
|
43 * - define _ALF_LOGGING and undefine it in alfstreamerbridge.cpp |
|
44 * around #include <alflogger.h> . |
|
45 * |
|
46 * - define MACRO HUI_DEBUG_TRACK_DRAWING and #define HUI_DEBUG_TRACK_DRAWING in |
|
47 * alfappservercore.mmp |
|
48 * |
|
49 * |
|
50 * - alfbridge - can tag command buffers with the process name that drew the commands. |
|
51 * - define _ALF_LOGGING and undefine it in alfbridge.cpp |
|
52 * around #include <alflogger.h> . |
|
53 * |
|
54 * - define MACRO HUI_DEBUG_TRACK_DRAWING and #define HUI_DEBUG_TRACK_DRAWING |
|
55 * in alfappservercore.mmp |
|
56 * |
|
57 * - huicanvaswspainter.cpp - can print the command names and their parameters |
|
58 * and the process name that drew them (you must enable the above alfbridge debugs, |
|
59 * if you want to see process names) |
|
60 * |
|
61 * - define MACRO HUI_DEBUG_TRACK_DRAWING and #define HUI_DEBUG_TRACK_DRAWING in huitk_base.mmp |
|
62 * |
|
63 * - enable wanted prints in alfcommanddebug.cpp ConstructL function. |
|
64 * |
|
65 * NOTE, Logging for all __ALFLOGSTRING variants can be enabled in alfloggingconfiguration.h . |
|
66 * However, be prepared for massive amount of debug data and even more sluggish performance, |
|
67 * if that is enabled. |
|
68 * |
|
69 */ |
|
70 |
|
71 #ifndef CALFCOMMANDDEBUG_H_ |
|
72 #define CALFCOMMANDDEBUG_H_ |
|
73 |
|
74 #include <e32std.h> |
|
75 #include <e32base.h> |
|
76 #include <s32mem.h> |
|
77 #include <s32strm.h> |
|
78 #include <e32debug.h> |
|
79 #include <e32hashtab.h> |
|
80 #include <gdi.h> |
|
81 #include <w32std.h> |
|
82 #include <alfcommanddescriptions.rsg> |
|
83 |
|
84 class CAlfScreen; |
|
85 class CHuiControlGroup; |
|
86 |
|
87 NONSHARABLE_CLASS( CAlfCommandDebug ) : public CBase |
|
88 { |
|
89 public: |
|
90 |
|
91 IMPORT_C static CAlfCommandDebug* NewL(); |
|
92 |
|
93 IMPORT_C void StartFrame(); |
|
94 |
|
95 IMPORT_C void EndFrame(); |
|
96 |
|
97 IMPORT_C void PrintStatistic(); |
|
98 |
|
99 IMPORT_C void SetDescriptionAndSize( const TUint8& aCommand, const TInt& aSize, TInt aDescriptionList = R_ALF_COMMAND_DESCRIPTION_ARRAY ); |
|
100 |
|
101 IMPORT_C void SetDescription( const TUint8& aCommand, TInt aDescriptionList = R_ALF_COMMAND_DESCRIPTION_ARRAY ); |
|
102 |
|
103 IMPORT_C void SetHandle( const TInt& aHandle ); |
|
104 |
|
105 IMPORT_C void SetPoint( const TPoint& aPoint ); |
|
106 |
|
107 IMPORT_C void SetRect( const TRect& aRect ); |
|
108 |
|
109 IMPORT_C void SetRegion( const TRegion& aRegion ); |
|
110 |
|
111 IMPORT_C void SetColor( TRgb& aColor ); |
|
112 |
|
113 IMPORT_C void SetText( TPtr& aText ); |
|
114 |
|
115 IMPORT_C void Print(); |
|
116 |
|
117 IMPORT_C void AdjustCommand( const TUint8& aCommand, TInt iAdjustment ); |
|
118 |
|
119 IMPORT_C void SetPrint( TBool aPrint ); |
|
120 |
|
121 IMPORT_C TFileName WServClientFileName(TInt aClientWindowGroupId, RWsSession& aSession ); |
|
122 |
|
123 IMPORT_C TBool TrackProcess( HBufC16* aFileName ); |
|
124 |
|
125 IMPORT_C ~CAlfCommandDebug(); |
|
126 |
|
127 IMPORT_C TDesC16& Text(); |
|
128 |
|
129 private: |
|
130 |
|
131 void ConstructL(); |
|
132 |
|
133 class TCommand : public CBase |
|
134 { |
|
135 |
|
136 public: |
|
137 |
|
138 TCommand() : iDescription(NULL), iCount(0), iSize(0){}; |
|
139 |
|
140 HBufC16* iDescription; |
|
141 TUint iCount; |
|
142 TUint iSize; |
|
143 }; |
|
144 |
|
145 void ReadCommandDescriptionsL( RHashMap<TUint32,TCommand>* aDescriptionArray, TInt aId ); |
|
146 |
|
147 |
|
148 |
|
149 private: |
|
150 |
|
151 |
|
152 |
|
153 RHashMap<TUint32,TCommand>* iCommandDescriptions; |
|
154 RHashMap<TUint32,TCommand>* iBridgeCommandDescriptions; |
|
155 |
|
156 TInt iTotalCmdCount; |
|
157 TInt iTotalCmdSize; |
|
158 |
|
159 TInt iFrameCount; |
|
160 Uint64 iFrameTotalSize; |
|
161 |
|
162 TBuf<1024> iText; |
|
163 |
|
164 // Change run-time the content of this of set it in ConstructL to track |
|
165 // certain process drawing in device |
|
166 TFileName iTrackedProcess; |
|
167 |
|
168 enum TLogginMode |
|
169 { |
|
170 EPrintOnlyCommands = 1, |
|
171 EPrintCommandParameters, |
|
172 EPrintStatistics, |
|
173 EPrintStatisticsForLargeBuffers, |
|
174 EPrintSummary |
|
175 }; |
|
176 |
|
177 TLogginMode iMode; |
|
178 |
|
179 public: |
|
180 |
|
181 TInt iPrint; |
|
182 TBool iPrintStatistics; |
|
183 TInt iLargeBufferDefinition; |
|
184 TBool iPrintColors; |
|
185 TBool iPrintRegions; |
|
186 TBool iPrintRects; |
|
187 TBool iPrintPoints; |
|
188 TBool iPrintHandles; |
|
189 TBool iPrintTexts; |
|
190 TBool iPrintSummary; |
|
191 |
|
192 }; |
|
193 |
|
194 #endif /* CALFCOMMANDDEBUG_H_ */ |