33 #define PROFILER_INFO_PRINTF4(p1, p2, p3, p4) iTestStep.Logger().LogExtra(((TText8*)__FILE__), __LINE__, ESevrInfo, (p1), (p2), (p3), (p4)) |
33 #define PROFILER_INFO_PRINTF4(p1, p2, p3, p4) iTestStep.Logger().LogExtra(((TText8*)__FILE__), __LINE__, ESevrInfo, (p1), (p2), (p3), (p4)) |
34 #define PROFILER_INFO_PRINTF5(p1, p2, p3, p4, p5) iTestStep.Logger().LogExtra(((TText8*)__FILE__), __LINE__, ESevrInfo, (p1), (p2), (p3), (p4), (p5)) |
34 #define PROFILER_INFO_PRINTF5(p1, p2, p3, p4, p5) iTestStep.Logger().LogExtra(((TText8*)__FILE__), __LINE__, ESevrInfo, (p1), (p2), (p3), (p4), (p5)) |
35 #define PROFILER_INFO_PRINTF6(p1, p2, p3, p4, p5, p6) iTestStep.Logger().LogExtra(((TText8*)__FILE__), __LINE__, ESevrInfo, (p1), (p2), (p3), (p4), (p5), (p6)) |
35 #define PROFILER_INFO_PRINTF6(p1, p2, p3, p4, p5, p6) iTestStep.Logger().LogExtra(((TText8*)__FILE__), __LINE__, ESevrInfo, (p1), (p2), (p3), (p4), (p5), (p6)) |
36 #define PROFILER_INFO_PRINTF7(p1, p2, p3, p4, p5, p6, p7) iTestStep.Logger().LogExtra(((TText8*)__FILE__), __LINE__, ESevrInfo, (p1), (p2), (p3), (p4), (p5), (p6), (p7)) |
36 #define PROFILER_INFO_PRINTF7(p1, p2, p3, p4, p5, p6, p7) iTestStep.Logger().LogExtra(((TText8*)__FILE__), __LINE__, ESevrInfo, (p1), (p2), (p3), (p4), (p5), (p6), (p7)) |
37 |
37 |
|
38 #define PROFILER_WARN_PRINTF1(p1) iTestStep.Logger().LogExtra(((TText8*)__FILE__), __LINE__, ESevrWarn, (p1)) |
|
39 #define PROFILER_WARN_PRINTF2(p1, p2) iTestStep.Logger().LogExtra(((TText8*)__FILE__), __LINE__, ESevrWarn, (p1), (p2)) |
|
40 #define PROFILER_WARN_PRINTF3(p1, p2, p3) iTestStep.Logger().LogExtra(((TText8*)__FILE__), __LINE__, ESevrWarn, (p1), (p2), (p3)) |
|
41 #define PROFILER_WARN_PRINTF4(p1, p2, p3, p4) iTestStep.Logger().LogExtra(((TText8*)__FILE__), __LINE__, ESevrWarn, (p1), (p2), (p3), (p4)) |
|
42 #define PROFILER_WARN_PRINTF5(p1, p2, p3, p4, p5) iTestStep.Logger().LogExtra(((TText8*)__FILE__), __LINE__, ESevrWarn, (p1), (p2), (p3), (p4), (p5)) |
|
43 #define PROFILER_WARN_PRINTF6(p1, p2, p3, p4, p5, p6) iTestStep.Logger().LogExtra(((TText8*)__FILE__), __LINE__, ESevrWarn, (p1), (p2), (p3), (p4), (p5), (p6)) |
|
44 #define PROFILER_WARN_PRINTF7(p1, p2, p3, p4, p5, p6, p7) iTestStep.Logger().LogExtra(((TText8*)__FILE__), __LINE__, ESevrWarn, (p1), (p2), (p3), (p4), (p5), (p6), (p7)) |
|
45 |
38 #define PROFILER_ERR_PRINTF1(p1) iTestStep.Logger().LogExtra(((TText8*)__FILE__), __LINE__, ESevrErr, (p1)) |
46 #define PROFILER_ERR_PRINTF1(p1) iTestStep.Logger().LogExtra(((TText8*)__FILE__), __LINE__, ESevrErr, (p1)) |
39 #define PROFILER_ERR_PRINTF2(p1, p2) iTestStep.Logger().LogExtra(((TText8*)__FILE__), __LINE__, ESevrErr, (p1), (p2)) |
47 #define PROFILER_ERR_PRINTF2(p1, p2) iTestStep.Logger().LogExtra(((TText8*)__FILE__), __LINE__, ESevrErr, (p1), (p2)) |
40 #define PROFILER_ERR_PRINTF3(p1, p2, p3) iTestStep.Logger().LogExtra(((TText8*)__FILE__), __LINE__, ESevrErr, (p1), (p2), (p3)) ; |
48 #define PROFILER_ERR_PRINTF3(p1, p2, p3) iTestStep.Logger().LogExtra(((TText8*)__FILE__), __LINE__, ESevrErr, (p1), (p2), (p3)) ; |
41 #define PROFILER_ERR_PRINTF4(p1, p2, p3, p4) iTestStep.Logger().LogExtra(((TText8*)__FILE__), __LINE__, ESevrErr, (p1), (p2), (p3), (p4)) |
49 #define PROFILER_ERR_PRINTF4(p1, p2, p3, p4) iTestStep.Logger().LogExtra(((TText8*)__FILE__), __LINE__, ESevrErr, (p1), (p2), (p3), (p4)) |
42 #define PROFILER_ERR_PRINTF5(p1, p2, p3, p4, p5) iTestStep.Logger().LogExtra(((TText8*)__FILE__), __LINE__, ESevrErr, (p1), (p2), (p3), (p4), (p5)) |
50 #define PROFILER_ERR_PRINTF5(p1, p2, p3, p4, p5) iTestStep.Logger().LogExtra(((TText8*)__FILE__), __LINE__, ESevrErr, (p1), (p2), (p3), (p4), (p5)) |
95 { |
104 { |
96 PROFILER_TEST(!iResultsInitalised); |
105 PROFILER_TEST(!iResultsInitalised); |
97 iResultsInitalised = ETrue; |
106 iResultsInitalised = ETrue; |
98 iDiff = 0; |
107 iDiff = 0; |
99 iResults.Reset(); |
108 iResults.Reset(); |
|
109 iResultsTimingOrder.Reset(); |
100 |
110 |
101 StartTimer(); |
111 StartTimer(); |
102 } |
112 } |
103 |
113 |
104 /** |
114 /** |
105 Records set current time. Can be called multiple times so an average can be taken. |
115 Records set current time. Can be called multiple times so an average can be taken. |
106 */ |
116 */ |
107 EXPORT_C void CTProfiler::MarkResultSetL() |
117 EXPORT_C void CTProfiler::MarkResultSetL() |
108 { |
118 { |
109 iResults.InsertInUnsignedKeyOrderAllowRepeatsL((TUint32)StopTimer()); |
119 TUint32 res = (TUint32)StopTimer(); |
|
120 iResults.InsertInUnsignedKeyOrderAllowRepeatsL(res); |
|
121 if(iStoreResultInTimingOrder) |
|
122 { |
|
123 iResultsTimingOrder.AppendL(res); |
|
124 } |
110 iDiff = 0; |
125 iDiff = 0; |
111 PROFILER_TEST(iResultsInitalised); |
126 PROFILER_TEST(iResultsInitalised); |
112 StartTimer(); |
127 StartTimer(); |
113 } |
128 } |
114 |
129 |
115 /** |
130 /** |
|
131 Records set current time. Alike MarkResultSetL() the function doesn't |
|
132 restart the timer at the end. The following operations will not be |
|
133 included into benchmark mesuarment. To resume the profiling the user must |
|
134 start the timer. |
|
135 @see StartTimer() |
|
136 @see MarkResultSetL() |
|
137 Can be called multiple times so an average can be taken. |
|
138 */ |
|
139 EXPORT_C void CTProfiler::MarkResultSetAndSuspendL() |
|
140 { |
|
141 TUint32 res = StopTimer(); |
|
142 iResults.InsertInUnsignedKeyOrderAllowRepeatsL(res); |
|
143 if(iStoreResultInTimingOrder) |
|
144 { |
|
145 iResultsTimingOrder.AppendL(res); |
|
146 } |
|
147 iDiff = 0; |
|
148 PROFILER_TEST(iResultsInitalised); |
|
149 } |
|
150 |
|
151 /** |
116 Frees all memory allocated by results capturing methods like MarkResultSetL(). |
152 Frees all memory allocated by results capturing methods like MarkResultSetL(). |
117 */ |
153 */ |
118 EXPORT_C void CTProfiler::FreeResultsMemory() |
154 EXPORT_C void CTProfiler::FreeResultsMemory() |
119 { |
155 { |
120 iResults.Reset(); |
156 iResults.Reset(); |
|
157 iResultsTimingOrder.Reset(); |
121 } |
158 } |
122 |
159 |
123 /** |
160 /** |
124 Returns the trimmed mean of a set of results. i.e. Trims off the 20% smallest and the 20% largest of the data results. |
161 Returns the trimmed mean of a set of results. i.e. Trims off the 20% smallest and the 20% largest of the data results. |
125 */ |
162 */ |
126 EXPORT_C TUint32 CTProfiler::GetTrimedMean() |
163 EXPORT_C TUint32 CTProfiler::GetTrimedMean() |
127 { |
164 { |
128 TInt64 total = 0; |
165 TInt64 total = 0; |
129 if (iResults.Count() <= 50) |
166 if (iResults.Count() <= 50) |
130 PROFILER_ERR_PRINTF2(_L("Not enough results for trimming - need more than 50, but got %d"), iResults.Count()); |
167 { |
|
168 PROFILER_WARN_PRINTF2(_L("Not enough results for trimming - need more than 50, but got %d"), iResults.Count()); |
|
169 } |
131 if (iResults.Count() == 0) // If iResults is zero then do nothing |
170 if (iResults.Count() == 0) // If iResults is zero then do nothing |
132 { |
171 { |
133 return 0; |
172 return 0; |
134 } |
173 } |
135 PROFILER_TEST(iResults.Count() > 50); //Ensure we have an ability to remove some results in trimming |
174 |
136 TInt twentyPercentCount = iResults.Count()/5; |
175 TInt twentyPercentCount = iResults.Count()/5; |
137 for (TInt count = twentyPercentCount; count < iResults.Count()-twentyPercentCount; count++) |
176 for (TInt count = twentyPercentCount; count < iResults.Count()-twentyPercentCount; count++) |
138 { |
177 { |
139 total += iResults[count]; |
178 total += iResults[count]; |
140 } |
179 } |