|
1 /* |
|
2 * Copyright (c) 2010 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: |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef PIPROFILEREGINEPRIVATE_H |
|
19 #define PIPROFILEREGINEPRIVATE_H |
|
20 |
|
21 #include <e32base.h> |
|
22 #include <piprofiler/ProfilerAttributes.h> |
|
23 #include <piprofiler/ProfilerEngineStatusChecker.h> |
|
24 |
|
25 class TSamplerAttributes; |
|
26 class PIMainView; |
|
27 class PluginAttributes; |
|
28 class GeneralAttributes; |
|
29 class SettingItem; |
|
30 class CProfilerEngineStatusChecker; |
|
31 class PIProfilerEngine; |
|
32 class PIProfilerEnginePrivate: public MProfilerStatusObserver |
|
33 { |
|
34 |
|
35 public: |
|
36 |
|
37 enum TProfilingMode |
|
38 { |
|
39 EProfilingModeNormal = 0, EProfilingModeTimed |
|
40 }; |
|
41 |
|
42 /** |
|
43 * Constructor |
|
44 */ |
|
45 PIProfilerEnginePrivate(PIProfilerEngine *aEngine); |
|
46 |
|
47 /** |
|
48 * Destructor |
|
49 */ |
|
50 ~PIProfilerEnginePrivate(); |
|
51 |
|
52 /** |
|
53 * Initializesprofiler engine |
|
54 */ |
|
55 bool Init(); |
|
56 |
|
57 /** |
|
58 * Method that is called when UI is ready |
|
59 */ |
|
60 void NotifyUIReady(); |
|
61 |
|
62 /** |
|
63 * Saves plug-in settings into engine |
|
64 */ |
|
65 bool SavePluginSettings(const PluginAttributes &pluginAttributes); |
|
66 |
|
67 /** |
|
68 * Starts normal profiling |
|
69 */ |
|
70 bool StartProfiling(); |
|
71 |
|
72 /** |
|
73 * Starts timed profiling |
|
74 */ |
|
75 bool StartTimedProfiling(); |
|
76 |
|
77 /** |
|
78 * Stops profiling |
|
79 */ |
|
80 void StopProfiling(); |
|
81 |
|
82 /** |
|
83 * MProfilerStatusObserver method that is called when profiler engine's status is changed |
|
84 */ |
|
85 void HandleProfilerStatusChange(KProfilerStatus aStatus); |
|
86 |
|
87 /** |
|
88 * MProfilerStatusObserver method that is called when profiler error is occured. |
|
89 */ |
|
90 void HandleProfilerErrorL(TInt aError); |
|
91 |
|
92 /** |
|
93 * Gets PI Profiler general settings |
|
94 */ |
|
95 void GetGeneralSettings(GeneralAttributes &settings); |
|
96 |
|
97 /** |
|
98 * Saves general settings into engine |
|
99 */ |
|
100 bool SaveGeneralSettings(GeneralAttributes &settings); |
|
101 |
|
102 /** |
|
103 * gets time limit for timed profiling |
|
104 */ |
|
105 int GetTimeLimit(); |
|
106 |
|
107 /** |
|
108 * Sets PI profiler engine to continue running after ui is closed. |
|
109 */ |
|
110 void LeaveProfilingOnAfterClosing(); |
|
111 |
|
112 bool CheckTraceLocationSanity(QString &location); |
|
113 |
|
114 private: |
|
115 |
|
116 /** |
|
117 * Saves general settings into engine |
|
118 */ |
|
119 void SaveGeneralSettingsL(); |
|
120 |
|
121 /** |
|
122 * loads general settings from engine |
|
123 */ |
|
124 TInt LoadGeneralSettingsL(); |
|
125 |
|
126 /** |
|
127 * Starts to profile |
|
128 */ |
|
129 void StartAllSamplerItemsL(TProfilingMode aProfilingMode); |
|
130 |
|
131 // Converters for symbian to qt and qt to symbian |
|
132 |
|
133 /** |
|
134 * TSamplerAttributes -> SamplerAttributes |
|
135 */ |
|
136 static void convertTSamplerAttributesToPluginAttributes(TSamplerAttributes &tSamplerAttributes, |
|
137 PluginAttributes &samplerAttributes); |
|
138 |
|
139 /** |
|
140 * TSettingItem -> SettingItem |
|
141 */ |
|
142 static void convertTSettingItemToSettingItem(TSettingItem &tSettingItem, |
|
143 SettingItem &settingItem); |
|
144 |
|
145 /** |
|
146 * SettingItem -> TSettingItem |
|
147 */ |
|
148 static void convertSettingItemToTSettingItem(TSettingItem &tSettingItem, |
|
149 const SettingItem &settingItem); |
|
150 |
|
151 /** |
|
152 * TGeneralAttributes -> GeneralAttributes |
|
153 */ |
|
154 static void convertTGeneralAttributesToGeneralAttributes( |
|
155 TGeneralAttributes &tSamplerAttributes, GeneralAttributes &samplerAttributes); |
|
156 |
|
157 /** |
|
158 * GeneralAttributes -> TGeneralAttributes |
|
159 */ |
|
160 static void convertGeneralAttributesToTGeneralAttributes( |
|
161 TGeneralAttributes &tSamplerAttributes, GeneralAttributes &samplerAttributes); |
|
162 |
|
163 /** |
|
164 * Launches PI Profiler engine |
|
165 */ |
|
166 int LaunchEngineL(); |
|
167 |
|
168 /** |
|
169 * Terminates PI Profiler engine |
|
170 */ |
|
171 void terminateEngine(); |
|
172 |
|
173 /** |
|
174 * Gets plug-ins from engine |
|
175 */ |
|
176 void addNewSamplers(CArrayFixFlat<TSamplerAttributes>& aAttributes); |
|
177 |
|
178 /** |
|
179 * Loads plug-ins |
|
180 */ |
|
181 void loadPlugins(); |
|
182 |
|
183 /** |
|
184 * Finds PI Profiler Engine process |
|
185 */ |
|
186 TInt FindProcessL(RProcess& aProc); |
|
187 |
|
188 /** |
|
189 * Attaches client into PI Profiler engine |
|
190 */ |
|
191 void AttachClient(); |
|
192 |
|
193 /** |
|
194 * Checks trace location sanity |
|
195 */ |
|
196 TBool CheckTraceLocationSanityL(TBuf8<KPrefixMaxLength>& aAttr); |
|
197 |
|
198 private: |
|
199 |
|
200 // Should Engine leaved on after ui is closed |
|
201 bool iLeaveProfilingOnAfterClosing; |
|
202 |
|
203 // Public part of engine |
|
204 PIProfilerEngine *iPublic; |
|
205 |
|
206 // Sampler Attributes |
|
207 CArrayFixFlat<TSamplerAttributes>* iSamplerAttributes; |
|
208 |
|
209 // General attributes |
|
210 TGeneralAttributes iGeneralAttributes; |
|
211 |
|
212 // Engine status checker |
|
213 CProfilerEngineStatusChecker* iStatusChecker; |
|
214 |
|
215 }; |
|
216 |
|
217 #endif // PIPROFILEREGINEPRIVATE_H |