|
1 // Copyright (c) 2007-2009 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 // |
|
15 |
|
16 |
|
17 |
|
18 /** |
|
19 @file te_check_performance_step.cpp |
|
20 @internalTechnology |
|
21 */ |
|
22 |
|
23 #include <hal.h> |
|
24 #include "te_suite_defs.h" |
|
25 #include "te_check_performance_step.h" |
|
26 #include "te_logger.h" |
|
27 #include "te_tracerecord.h" |
|
28 #include "te_tracer.h" |
|
29 #include "te_trace_for_lauterbach.h" |
|
30 |
|
31 |
|
32 _LIT(KLogFilename, "CCheckPerformanceStep.utf"); |
|
33 |
|
34 CCheckPerformanceStep::~CCheckPerformanceStep() |
|
35 /** |
|
36 * Destructor |
|
37 */ |
|
38 { |
|
39 } |
|
40 |
|
41 CCheckPerformanceStep::CCheckPerformanceStep() |
|
42 /** |
|
43 * Constructor |
|
44 */ |
|
45 { |
|
46 // **MUST** call SetTestStepName in the constructor as the controlling |
|
47 // framework uses the test step name immediately following construction to set |
|
48 // up the step's unique logging ID. |
|
49 SetTestStepName(KCheckPerformanceStep); |
|
50 |
|
51 SetLogFilename(KLogFilename); |
|
52 DeleteLogFile(); |
|
53 } |
|
54 |
|
55 TVerdict CCheckPerformanceStep::doTestStepPreambleL() |
|
56 { |
|
57 if(TestStepResult()==EPass) |
|
58 { |
|
59 //SetTestStepResult(EFail); |
|
60 } |
|
61 return TestStepResult(); |
|
62 } |
|
63 |
|
64 |
|
65 |
|
66 TVerdict CCheckPerformanceStep::doTestStepL() |
|
67 /** |
|
68 * @return - TVerdict code |
|
69 * Override of base class pure virtual |
|
70 * Our implementation only gets called if the base class doTestStepPreambleL() did |
|
71 * not leave. That being the case, the current test result value will be EPass. |
|
72 */ |
|
73 { |
|
74 if (TestStepResult()==EPass) |
|
75 { |
|
76 //set up the trace record(s) |
|
77 TTraceConfigs trace; |
|
78 TTraceConfigsOperator::Init(trace); |
|
79 TTraceConfigsOperator::SetOptions(trace, EPrintTDesC8, ETrue, ETrue); |
|
80 TTraceConfigsOperator::SetHeader(trace, TRACE_FATAL, 0, EAddThreadIdentification, ENoProgramCounter, 0); |
|
81 TTraceConfigsOperator::SetData(trace, KData1, KData2, KAny1, KAny8); |
|
82 TTraceConfigsOperator::SetData(trace, KCharString, KCharStringSize); |
|
83 trace.iDesC16.Copy(KAny16); |
|
84 StartLoggingL(trace); |
|
85 |
|
86 //Set up the time variables |
|
87 TUint32 baseline = 0; |
|
88 TUint32 templatebaseline = 0; |
|
89 TUint32 time = 0; |
|
90 TUint32 count = 0; |
|
91 |
|
92 INFO_PRINTF1(_L("---Baseline figures, user side---")); |
|
93 |
|
94 #ifdef __WINS__ |
|
95 INFO_PRINTF1(_L("WARNING these are emulator figures !! - Not Valid")); |
|
96 #endif |
|
97 |
|
98 |
|
99 |
|
100 //Get some baseline figures |
|
101 //To see the variation I call it several times... |
|
102 trace.iApiUsed = EReferenceBaseline; |
|
103 TTraceTester::TimeTraceL(trace, baseline, count); |
|
104 INFO_PRINTF3(_L(" %i ns, %i traces/us - Baseline"), baseline, count); |
|
105 TTraceTester::TimeTraceL(trace, templatebaseline, count); |
|
106 INFO_PRINTF3(_L(" %i ns, %i traces/us - Baseline, variation"), baseline, count); |
|
107 TTraceTester::TimeTraceL(trace, baseline, count); |
|
108 INFO_PRINTF3(_L(" %i ns, %i traces/us - Baseline, variation"), baseline, count); |
|
109 TTraceTester::TimeTraceL(trace, baseline, count); |
|
110 INFO_PRINTF3(_L(" %i ns, %i traces/us - Baseline, variation"), baseline, count); |
|
111 TTraceTester::TimeTraceL(trace, baseline, count); |
|
112 INFO_PRINTF3(_L(" %i ns, %i traces/us - Baseline, variation"), baseline, count); |
|
113 TTraceTester::TimeTraceL(trace, baseline, count); |
|
114 INFO_PRINTF3(_L(" %i ns, %i traces/us - Baseline, variation"), baseline, count); |
|
115 TTraceTester::TimeTraceL(trace, baseline, count); |
|
116 INFO_PRINTF3(_L(" %i ns, %i traces/us - Baseline, variation"), baseline, count); |
|
117 |
|
118 |
|
119 trace.iApiUsed = EReferenceForLoop; |
|
120 TTraceTester::TimeTraceL(trace, time, count); |
|
121 INFO_PRINTF3(_L(" %i ns, %i traces/us - For loop, no baseline"), time, count); |
|
122 TTraceTester::TimeTraceL(trace, time, count); |
|
123 INFO_PRINTF3(_L(" %i ns, %i traces/us - For loop, no baseline, variation"), time, count); |
|
124 TTraceTester::TimeTraceL(trace, time, count); |
|
125 INFO_PRINTF3(_L(" %i ns, %i traces/us - For loop, no baseline, variation"), time, count); |
|
126 |
|
127 trace.iApiUsed = EReferenceInlinedEmpty; |
|
128 TTraceTester::TimeTraceL(trace, templatebaseline, count); |
|
129 INFO_PRINTF3(_L(" %i ns, %i traces/us - InlinedEmpty as baseline"), templatebaseline, count); |
|
130 TTraceTester::TimeTraceL(trace, templatebaseline, count); |
|
131 INFO_PRINTF3(_L(" %i ns, %i traces/us - InlinedEmpty as baseline"), templatebaseline, count); |
|
132 |
|
133 trace.iApiUsed = EReferenceExportedEmpty; |
|
134 TTraceTester::TimeTraceL(trace, templatebaseline, count); |
|
135 INFO_PRINTF3(_L(" %i ns, %i traces/us - ExportedEmpty as baseline"), templatebaseline, count); |
|
136 TTraceTester::TimeTraceL(trace, templatebaseline, count); |
|
137 INFO_PRINTF3(_L(" %i ns, %i traces/us - ExportedEmpty as baseline"), templatebaseline, count); |
|
138 |
|
139 |
|
140 INFO_PRINTF1(_L("---Reference tests---")); |
|
141 //Check inlined vs exported |
|
142 //reference for kernel and user side... |
|
143 trace.iApiUsed = EReferenceForLoop; |
|
144 TTraceTester::TimeTraceL(trace, time, count); |
|
145 time = time - baseline; |
|
146 INFO_PRINTF3(_L(" %i ns, %i traces/us - for(loop)"), time, count); |
|
147 |
|
148 //inlined/exported |
|
149 trace.iApiUsed = EReferenceInlinedEmpty; |
|
150 TTraceTester::TimeTraceL(trace, time, count); |
|
151 time = time - baseline; |
|
152 INFO_PRINTF3(_L(" %i ns, %i traces/us - InlinedEmpty()"), time, count); |
|
153 |
|
154 trace.iApiUsed = EReferenceInlined; |
|
155 TTraceTester::TimeTraceL(trace, time, count); |
|
156 time = time - baseline; |
|
157 INFO_PRINTF3(_L(" %i ns, %i traces/us - Inlined()"), time, count); |
|
158 |
|
159 trace.iApiUsed = EReferenceExportedEmpty; |
|
160 TTraceTester::TimeTraceL(trace, time, count); |
|
161 time = time - baseline; |
|
162 INFO_PRINTF3(_L(" %i ns, %i traces/us - ExportedEmpty()"), time, count); |
|
163 |
|
164 trace.iApiUsed = EReferenceExported; |
|
165 TTraceTester::TimeTraceL(trace, time, count); |
|
166 time = time - baseline; |
|
167 INFO_PRINTF3(_L(" %i ns, %i traces/us - Exported()"), time, count); |
|
168 |
|
169 trace.iApiUsed = EReferenceTraceNormal2Data; |
|
170 TTraceTester::TimeTraceL(trace, time, count); |
|
171 time = time - baseline; |
|
172 INFO_PRINTF3(_L(" %i ns, %i traces/us - OstTrace(TUint32, TUint32) no TraceId"), time, count); |
|
173 |
|
174 trace.iApiUsed = EReferenceTraceTraceId2Data; |
|
175 TTraceTester::TimeTraceL(trace, time, count); |
|
176 time = time - baseline; |
|
177 INFO_PRINTF3(_L(" %i ns, %i traces/us - OstTrace(TUint32, TUint32) with TraceId"), time, count); |
|
178 |
|
179 trace.iApiUsed = EReferenceTraceNormalAny; |
|
180 TTraceTester::TimeTraceL(trace, time, count); |
|
181 time = time - baseline; |
|
182 INFO_PRINTF3(_L(" %i ns, %i traces/us - OstTrace(TAny*, TInt) no TraceId"), time, count); |
|
183 |
|
184 trace.iApiUsed = EReferenceTraceTraceIdAny; |
|
185 TTraceTester::TimeTraceL(trace, time, count); |
|
186 time = time - baseline; |
|
187 INFO_PRINTF3(_L(" %i ns, %i traces/us - OstTrace(TAny*, TInt) with TraceId"), time, count); |
|
188 |
|
189 //Check some real traces |
|
190 INFO_PRINTF1(_L("---Ost, user side---")); |
|
191 trace.iApiUsed = EPerformanceBaseline; |
|
192 TTraceTester::TimeTraceL(trace, baseline, count); |
|
193 //INFO_PRINTF3(_L(" %i ns, %i traces/us - Baseline"), baseline, count); |
|
194 |
|
195 trace.iApiUsed = ETrace; |
|
196 TTraceTester::TimeTraceL(trace, time, count); |
|
197 time -= baseline; |
|
198 INFO_PRINTF3(_L(" %i ns, %i traces/us - static OstTrace();"), time, count); |
|
199 |
|
200 trace.iApiUsed = BTraceFilteredContext8; |
|
201 TTraceTester::TimeTraceL(trace, time, count); |
|
202 time -= baseline; |
|
203 INFO_PRINTF3(_L(" %i ns, %i traces/us - BTraceFilteredContext8 = OstTrace()"), time, count); |
|
204 |
|
205 trace.iApiUsed = ETraceTUint32; |
|
206 TTraceTester::TimeTraceL(trace, time, count); |
|
207 time = time - baseline; |
|
208 INFO_PRINTF3(_L(" %i ns, %i traces/us - OstTrace(TUint32)"), time, count); |
|
209 |
|
210 trace.iApiUsed = BTraceFilteredContextPc12; |
|
211 TTraceTester::TimeTraceL(trace, time, count); |
|
212 time -= baseline; |
|
213 INFO_PRINTF3(_L(" %i ns, %i traces/us - BTraceFilteredContextPc12 = OstTrace(TUint32)"), time, count); |
|
214 |
|
215 trace.iApiUsed = ETraceTUint32TUint32; |
|
216 TTraceTester::TimeTraceL(trace, time, count); |
|
217 time = time - baseline; |
|
218 INFO_PRINTF3(_L(" %i ns, %i traces/us - OstTrace(TUint32, TUint32)"), time, count); |
|
219 |
|
220 trace.iApiUsed = ETraceTAnySize; |
|
221 TTraceTester::TimeTraceL(trace, time, count); |
|
222 time = time - baseline; |
|
223 INFO_PRINTF3(_L(" %i ns, %i traces/us - OstTrace(TAny, aSize)"), time, count); |
|
224 |
|
225 trace.iApiUsed = BTraceFilteredContextPcBig; |
|
226 TTraceTester::TimeTraceL(trace, time, count); |
|
227 time = time - baseline; |
|
228 INFO_PRINTF3(_L(" %i ns, %i traces/us - BTraceFilteredContextPcBig = OstTrace(TAny, aSize)"), time, count); |
|
229 |
|
230 trace.iApiUsed = EPrintfTRefByValueTDesC16; |
|
231 TTraceTester::TimeTraceL(trace, time, count); |
|
232 time = time - baseline; |
|
233 INFO_PRINTF3(_L(" %i ns, %i traces/us - OstPrintf(TRefByValue<TDesC16>)"), time, count); |
|
234 |
|
235 trace.iApiUsed = EPrintfchar; |
|
236 TTraceTester::TimeTraceL(trace, time, count); |
|
237 time = time - baseline; |
|
238 INFO_PRINTF3(_L(" %i ns, %i traces/us - OstPrintf(char*)"), time, count); |
|
239 |
|
240 //context creation |
|
241 INFO_PRINTF1(_L("---TTraceContext alloations---")); |
|
242 //first call the Trace only call |
|
243 trace.iApiUsed = ETrace; |
|
244 TUint32 timeTraceOnly = 0; |
|
245 TTraceTester::TimeTraceL(trace, timeTraceOnly, count); |
|
246 timeTraceOnly -= baseline; |
|
247 |
|
248 //call the context stuff, then subtrace the time it took to make the call |
|
249 trace.iApiUsed = EDefaultComponentId; |
|
250 TUint32 timeIncTrace = 0; |
|
251 TTraceTester::TimeTraceL(trace, timeIncTrace, count); |
|
252 timeIncTrace -= baseline; |
|
253 time = timeIncTrace - timeTraceOnly; |
|
254 INFO_PRINTF3(_L(" %i ns, %i traces/us - DefaultComponentId()"), time, count); |
|
255 |
|
256 //call the context stuff, then subtrace the time it took to make the call |
|
257 trace.iApiUsed = EContextTClassification; |
|
258 TTraceTester::TimeTraceL(trace, timeIncTrace, count); |
|
259 timeIncTrace -= baseline; |
|
260 time = timeIncTrace - timeTraceOnly; |
|
261 INFO_PRINTF3(_L(" %i ns, %i traces/us - TTraceContext(TClassification) (using DefaultComponentId())"), time, count); |
|
262 |
|
263 trace.iApiUsed = EContextTClassificationTHasContextIdTHasProgramCounter; |
|
264 TTraceTester::TimeTraceL(trace, timeIncTrace, count); |
|
265 timeIncTrace -= baseline; |
|
266 time = timeIncTrace - timeTraceOnly; |
|
267 INFO_PRINTF3(_L(" %i ns, %i traces/us - TTraceContext(TClassification, THasThreadId, THasPC) (using DefaultComponentId())"), time, count); |
|
268 |
|
269 trace.iApiUsed = EContextTComponentIdTClassification; |
|
270 TTraceTester::TimeTraceL(trace, timeIncTrace, count); |
|
271 timeIncTrace -= baseline; |
|
272 time = timeIncTrace - timeTraceOnly; |
|
273 INFO_PRINTF3(_L(" %i ns, %i traces/us - TTraceContext(TComponentId, TClassification)"), time, count); |
|
274 |
|
275 trace.iApiUsed = EContextTComponentIdTClassificationTHasContextIdTHasProgramCounter; |
|
276 TTraceTester::TimeTraceL(trace, timeIncTrace, count); |
|
277 timeIncTrace -= baseline; |
|
278 time = timeIncTrace - timeTraceOnly; |
|
279 INFO_PRINTF3(_L(" %i ns, %i traces/us - TTraceContext(TComponentId, TClassification, THasThreadId, THasPC)"), time, count); |
|
280 |
|
281 //kernel traces |
|
282 /*INFO_PRINTF1(_L("---Kernel side, Baseline figures---")); |
|
283 trace.iApiUsed = EPerformanceKernelBaseline; |
|
284 TTraceTester::TimeTraceL(trace, baseline, count); |
|
285 INFO_PRINTF3(_L(" %i ns, %i traces/us - baseline"), baseline, count); |
|
286 TUint32 baseline2 = 0; |
|
287 TTraceTester::TimeTraceL(trace, baseline2, count); |
|
288 INFO_PRINTF3(_L(" %i ns, %i traces/us - baseline to see variation"), baseline2, count); |
|
289 TUint32 baseline3 = 0; |
|
290 TTraceTester::TimeTraceL(trace, baseline3, count); |
|
291 INFO_PRINTF3(_L(" %i ns, %i traces/us - baseline to see variation"), baseline3, count); |
|
292 TInt smallest = 0; |
|
293 TInt biggest = 0; |
|
294 //Very ugly, but just temp thing... |
|
295 //find the smallest baseline |
|
296 if(baseline < baseline2) |
|
297 if(baseline < baseline3) |
|
298 smallest = baseline; |
|
299 else |
|
300 smallest = baseline3; |
|
301 else |
|
302 if(baseline2 < baseline3) |
|
303 smallest = baseline2; |
|
304 else |
|
305 smallest = baseline3; |
|
306 //find the largest baseline |
|
307 if(baseline > baseline2) |
|
308 if(baseline > baseline3) |
|
309 biggest = baseline; |
|
310 else |
|
311 biggest = baseline3; |
|
312 else |
|
313 if(baseline2 > baseline3) |
|
314 biggest = baseline2; |
|
315 else |
|
316 biggest = baseline3; |
|
317 |
|
318 INFO_PRINTF4(_L("Variation of baselines from %i - %i, diff %i ns"), smallest, biggest, (biggest - smallest)); |
|
319 |
|
320 trace.iApiUsed = EReferenceKernelForLoop; |
|
321 TTraceTester::TimeTraceL(trace, time, count); |
|
322 INFO_PRINTF3(_L(" %i ns, %i traces/us - for loop - no baseline"), time, count); |
|
323 TTraceTester::TimeTraceL(trace, time, count); |
|
324 INFO_PRINTF3(_L(" %i ns, %i traces/us - for loop - no baseline"), time, count); |
|
325 TTraceTester::TimeTraceL(trace, time, count); |
|
326 INFO_PRINTF3(_L(" %i ns, %i traces/us - for loop - no baseline"), time, count); |
|
327 |
|
328 INFO_PRINTF1(_L("---Ost calls, kernel side---")); |
|
329 |
|
330 trace.iApiUsed = EUtfKernelTrace; |
|
331 TTraceTester::TimeTraceL(trace, time, count); |
|
332 time -= baseline; |
|
333 INFO_PRINTF3(_L(" %i ns, %i traces/us - TUTraceNormal::Trace()"), time, count); |
|
334 |
|
335 trace.iApiUsed = BTraceKernelFilteredContext8; |
|
336 TTraceTester::TimeTraceL(trace, time, count); |
|
337 time -= baseline; |
|
338 INFO_PRINTF3(_L(" %i ns, %i traces/us - BTraceKernelFilteredContext8, equivalent of TUTraceNormal::Trace()"), time, count); |
|
339 |
|
340 trace.iApiUsed = EKernelTraceTTemplated; |
|
341 TTraceTester::TimeTraceL(trace, time, count); |
|
342 time -= baseline; |
|
343 INFO_PRINTF3(_L(" %i ns, %i traces/us - TUTraceNormal::Trace(const T&)"), time, count); |
|
344 */ |
|
345 StopLogging(); |
|
346 } |
|
347 return TestStepResult(); |
|
348 } |
|
349 |
|
350 |
|
351 TInt CCheckPerformanceStep::FindLargestAndSmallest(RArray<TUint32> /*aList*/, TInt& /*aLargest*/, TInt& /*aSmallest*/) |
|
352 { |
|
353 return KErrNotSupported; |
|
354 } |
|
355 |
|
356 |