sl@0
|
1 |
// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
2 |
// All rights reserved.
|
sl@0
|
3 |
// This component and the accompanying materials are made available
|
sl@0
|
4 |
// under the terms of the License "Eclipse Public License v1.0"
|
sl@0
|
5 |
// which accompanies this distribution, and is available
|
sl@0
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
7 |
//
|
sl@0
|
8 |
// Initial Contributors:
|
sl@0
|
9 |
// Nokia Corporation - initial contribution.
|
sl@0
|
10 |
//
|
sl@0
|
11 |
// Contributors:
|
sl@0
|
12 |
//
|
sl@0
|
13 |
// Description:
|
sl@0
|
14 |
// e32test\mmu\paging_info.cpp
|
sl@0
|
15 |
//
|
sl@0
|
16 |
//
|
sl@0
|
17 |
|
sl@0
|
18 |
#include <e32debug.h>
|
sl@0
|
19 |
#include <e32svr.h>
|
sl@0
|
20 |
#include <u32hal.h>
|
sl@0
|
21 |
#include <hal.h>
|
sl@0
|
22 |
#include "paging_info.h"
|
sl@0
|
23 |
|
sl@0
|
24 |
|
sl@0
|
25 |
const TUint8* BenchmarkNames[] =
|
sl@0
|
26 |
{
|
sl@0
|
27 |
(const TUint8*)"Read rom page",
|
sl@0
|
28 |
(const TUint8*)"Read code page",
|
sl@0
|
29 |
(const TUint8*)"Decompress",
|
sl@0
|
30 |
(const TUint8*)"Set code page free",
|
sl@0
|
31 |
(const TUint8*)"Set code page old",
|
sl@0
|
32 |
(const TUint8*)"Read media",
|
sl@0
|
33 |
(const TUint8*)"Fixup code page",
|
sl@0
|
34 |
(const TUint8*)"Read data page",
|
sl@0
|
35 |
(const TUint8*)"Write data page",
|
sl@0
|
36 |
(const TUint8*)"Del notify data page",
|
sl@0
|
37 |
(const TUint8*)"Read media data page",
|
sl@0
|
38 |
(const TUint8*)"Write media data page",
|
sl@0
|
39 |
};
|
sl@0
|
40 |
|
sl@0
|
41 |
__ASSERT_COMPILE(sizeof(BenchmarkNames)/sizeof(TUint8*) == EMaxPagingBm);
|
sl@0
|
42 |
|
sl@0
|
43 |
|
sl@0
|
44 |
TInt PagingInfo::ResetConcurrency(TInt aLocDrvNo, TMediaPagingStats aMediaStats)
|
sl@0
|
45 |
{
|
sl@0
|
46 |
TInt r = UserSvr::HalFunction(EHalGroupVM, EVMHalResetConcurrencyInfo, NULL, NULL);
|
sl@0
|
47 |
if (r!=KErrNotSupported && r!=KErrNone)
|
sl@0
|
48 |
return r;
|
sl@0
|
49 |
if(aLocDrvNo>=0)
|
sl@0
|
50 |
r=UserSvr::HalFunction(EHalGroupMedia,EMediaHalResetConcurrencyInfo,(TAny*)aLocDrvNo,(TAny*)aMediaStats);
|
sl@0
|
51 |
if(r==KErrNotSupported)
|
sl@0
|
52 |
r = KErrNone;
|
sl@0
|
53 |
return r;
|
sl@0
|
54 |
}
|
sl@0
|
55 |
|
sl@0
|
56 |
|
sl@0
|
57 |
TInt PagingInfo::PrintConcurrency(TInt aLocDrvNo, TMediaPagingStats aMediaStats)
|
sl@0
|
58 |
{
|
sl@0
|
59 |
SPagingConcurrencyInfo info;
|
sl@0
|
60 |
TInt r = UserSvr::HalFunction(EHalGroupVM, EVMHalGetConcurrencyInfo, &info, NULL);
|
sl@0
|
61 |
if (r!=KErrNotSupported && r!=KErrNone)
|
sl@0
|
62 |
return r;
|
sl@0
|
63 |
if (r == KErrNone)
|
sl@0
|
64 |
{
|
sl@0
|
65 |
RDebug::Printf("Concurrency info:");
|
sl@0
|
66 |
RDebug::Printf(" Max waiting threads == %d", info.iMaxWaitingCount);
|
sl@0
|
67 |
RDebug::Printf(" Max paging threads == %d", info.iMaxPagingCount);
|
sl@0
|
68 |
}
|
sl@0
|
69 |
if(aLocDrvNo>=0)
|
sl@0
|
70 |
{
|
sl@0
|
71 |
if(aMediaStats==EMediaPagingStatsAll || aMediaStats==EMediaPagingStatsRom)
|
sl@0
|
72 |
{
|
sl@0
|
73 |
SMediaROMPagingConcurrencyInfo info;
|
sl@0
|
74 |
r=UserSvr::HalFunction(EHalGroupMedia,EMediaHalGetROMConcurrencyInfo,(TAny*)aLocDrvNo,&info);
|
sl@0
|
75 |
if (r!=KErrNotSupported && r!=KErrNone)
|
sl@0
|
76 |
return r;
|
sl@0
|
77 |
if(r==KErrNone)
|
sl@0
|
78 |
{
|
sl@0
|
79 |
RDebug::Printf("ROM paging media concurrency stats on drive %d:",aLocDrvNo);
|
sl@0
|
80 |
RDebug::Printf(" Total page-in issued whilst processing other page-ins : %d",info.iTotalConcurrentReqs);
|
sl@0
|
81 |
RDebug::Printf(" Total page-in issued with at least one queue not empty : %d",info.iTotalReqIssuedNonEmptyQ);
|
sl@0
|
82 |
RDebug::Printf(" Max pending page-in in the main queue : %d",info.iMaxReqsInPending);
|
sl@0
|
83 |
RDebug::Printf(" Max pending page-in in the deferred queue : %d",info.iMaxReqsInDeferred);
|
sl@0
|
84 |
RDebug::Printf(" Total page-in first-time deferred during this session : %d",info.iTotalFirstTimeDeferrals);
|
sl@0
|
85 |
RDebug::Printf(" Total page-in re-deferred during this session : %d",info.iTotalReDeferrals);
|
sl@0
|
86 |
RDebug::Printf(" Maximum deferrals of any single page-in : %d",info.iMaxDeferrals);
|
sl@0
|
87 |
RDebug::Printf(" Total times the main queue was emptied during asynchronous request : %d",info.iTotalSynchEmptiedMainQ);
|
sl@0
|
88 |
RDebug::Printf(" Total page-in serviced from main queue during asynchronous request : %d",info.iTotalSynchServicedFromMainQ);
|
sl@0
|
89 |
RDebug::Printf(" Total page-in deferred from main queue during asynchronous request : %d",info.iTotalSynchDeferredFromMainQ);
|
sl@0
|
90 |
RDebug::Printf(" Total page-in DFC run with an empty main queue : %d",info.iTotalRunDry);
|
sl@0
|
91 |
RDebug::Printf(" Total dry runs of paging DFC avoided : %d",info.iTotalDryRunsAvoided);
|
sl@0
|
92 |
}
|
sl@0
|
93 |
}
|
sl@0
|
94 |
|
sl@0
|
95 |
if(aMediaStats==EMediaPagingStatsAll || aMediaStats==EMediaPagingStatsCode)
|
sl@0
|
96 |
{
|
sl@0
|
97 |
SMediaCodePagingConcurrencyInfo infoCode;
|
sl@0
|
98 |
r=UserSvr::HalFunction(EHalGroupMedia,EMediaHalGetCodeConcurrencyInfo,(TAny*)aLocDrvNo,&infoCode);
|
sl@0
|
99 |
if(r==KErrNone)
|
sl@0
|
100 |
{
|
sl@0
|
101 |
RDebug::Printf("Media Code Paging concurrency stats on drive %d", aLocDrvNo);
|
sl@0
|
102 |
RDebug::Printf(" Total page-in issued whilst processing other page in requests : %d", infoCode.iTotalConcurrentReqs);
|
sl@0
|
103 |
RDebug::Printf(" Total page-in issued with at least one queue not empty : %d", infoCode.iTotalReqIssuedNonEmptyQ);
|
sl@0
|
104 |
RDebug::Printf(" Max pending page-in in the main queue : %d", infoCode.iMaxReqsInPending);
|
sl@0
|
105 |
RDebug::Printf(" Max pending page-in requests in the deferred queue : %d", infoCode.iMaxReqsInDeferred);
|
sl@0
|
106 |
RDebug::Printf(" Total page-in first-time deferred : %d", infoCode.iTotalFirstTimeDeferrals);
|
sl@0
|
107 |
RDebug::Printf(" Total page-in re-deferred during this session (from deferred queue): %d", infoCode.iTotalReDeferrals);
|
sl@0
|
108 |
RDebug::Printf(" Max number of deferrals of any single page in : %d", infoCode.iMaxDeferrals);
|
sl@0
|
109 |
RDebug::Printf(" Total pagein serviced from main queue during asynchronous request : %d", infoCode.iTotalSynchServicedFromMainQ);
|
sl@0
|
110 |
RDebug::Printf(" Total pagein deferred from main queue during asynchronous request : %d", infoCode.iTotalSynchDeferredFromMainQ);
|
sl@0
|
111 |
}
|
sl@0
|
112 |
}
|
sl@0
|
113 |
}
|
sl@0
|
114 |
if (r == KErrNotSupported)
|
sl@0
|
115 |
r = KErrNone;
|
sl@0
|
116 |
return r;
|
sl@0
|
117 |
}
|
sl@0
|
118 |
|
sl@0
|
119 |
|
sl@0
|
120 |
TInt PagingInfo::ResetEvents()
|
sl@0
|
121 |
{
|
sl@0
|
122 |
return UserSvr::HalFunction(EHalGroupVM,EVMHalResetEventInfo,0,0);
|
sl@0
|
123 |
}
|
sl@0
|
124 |
|
sl@0
|
125 |
|
sl@0
|
126 |
TInt PagingInfo::PrintEvents()
|
sl@0
|
127 |
{
|
sl@0
|
128 |
SVMEventInfo info;
|
sl@0
|
129 |
TPckg<SVMEventInfo> infoBuf(info);
|
sl@0
|
130 |
TInt r = UserSvr::HalFunction(EHalGroupVM,EVMHalGetEventInfo,&infoBuf,0);
|
sl@0
|
131 |
if(r!=KErrNone)
|
sl@0
|
132 |
return r;
|
sl@0
|
133 |
RDebug::Printf("Event info:");
|
sl@0
|
134 |
RDebug::Printf(" Page fault events: %Ld", info.iPageFaultCount);
|
sl@0
|
135 |
RDebug::Printf(" Page in events: %Ld", info.iPageInReadCount);
|
sl@0
|
136 |
return KErrNone;
|
sl@0
|
137 |
}
|
sl@0
|
138 |
|
sl@0
|
139 |
|
sl@0
|
140 |
TInt PagingInfo::ResetBenchmarks(TInt aLocDrvNo, TMediaPagingStats aMediaStats)
|
sl@0
|
141 |
{
|
sl@0
|
142 |
TInt r = KErrNone;
|
sl@0
|
143 |
for (TInt i = 0 ; r == KErrNone && i < EMaxPagingBm ; ++i)
|
sl@0
|
144 |
{
|
sl@0
|
145 |
r = UserSvr::HalFunction(EHalGroupVM, EVMHalResetPagingBenchmark, (TAny*)i, NULL);
|
sl@0
|
146 |
if (r!=KErrNotSupported && r!=KErrNone)
|
sl@0
|
147 |
return r;
|
sl@0
|
148 |
}
|
sl@0
|
149 |
if(aLocDrvNo>=0)
|
sl@0
|
150 |
r=UserSvr::HalFunction(EHalGroupMedia,EMediaHalResetPagingBenchmark,(TAny*)aLocDrvNo,(TAny*)aMediaStats);
|
sl@0
|
151 |
if(r==KErrNotSupported)
|
sl@0
|
152 |
r = KErrNone;
|
sl@0
|
153 |
return r;
|
sl@0
|
154 |
}
|
sl@0
|
155 |
|
sl@0
|
156 |
|
sl@0
|
157 |
TInt PagingInfo::PrintBenchmarks(TInt aLocDrvNo, TMediaPagingStats aMediaStats)
|
sl@0
|
158 |
{
|
sl@0
|
159 |
RDebug::Printf("Paging benchmarks:");
|
sl@0
|
160 |
RDebug::Printf(" Name: Count: Min (us): Max(us): Avg(us):");
|
sl@0
|
161 |
|
sl@0
|
162 |
TInt freq = 0;
|
sl@0
|
163 |
TReal min;
|
sl@0
|
164 |
TReal max;
|
sl@0
|
165 |
TReal avg;
|
sl@0
|
166 |
TInt r = HAL::Get(HAL::EFastCounterFrequency, freq);
|
sl@0
|
167 |
if (r != KErrNone)
|
sl@0
|
168 |
return r;
|
sl@0
|
169 |
|
sl@0
|
170 |
TReal mult = 1000000.0 / freq;
|
sl@0
|
171 |
|
sl@0
|
172 |
for (TInt i = 0 ; i < EMaxPagingBm ; ++i)
|
sl@0
|
173 |
{
|
sl@0
|
174 |
SPagingBenchmarkInfo info;
|
sl@0
|
175 |
r = UserSvr::HalFunction(EHalGroupVM, EVMHalGetPagingBenchmark, (TAny*)i, &info);
|
sl@0
|
176 |
if (r!=KErrNotSupported && r!=KErrNone)
|
sl@0
|
177 |
return r;
|
sl@0
|
178 |
if (r == KErrNone)
|
sl@0
|
179 |
{
|
sl@0
|
180 |
min = 0.0;
|
sl@0
|
181 |
max = 0.0;
|
sl@0
|
182 |
avg = 0.0;
|
sl@0
|
183 |
if (info.iCount != 0)
|
sl@0
|
184 |
{
|
sl@0
|
185 |
min = info.iMinTime * mult;
|
sl@0
|
186 |
max = info.iMaxTime * mult;
|
sl@0
|
187 |
avg = (info.iTotalTime * mult) / info.iCount;
|
sl@0
|
188 |
}
|
sl@0
|
189 |
const TUint8* name = BenchmarkNames[i];
|
sl@0
|
190 |
RDebug::Printf(" %-30s %6d %9.1f %9.1f %9.1f", name, info.iCount, min, max, avg);
|
sl@0
|
191 |
}
|
sl@0
|
192 |
}
|
sl@0
|
193 |
|
sl@0
|
194 |
if(aLocDrvNo>=0)
|
sl@0
|
195 |
{
|
sl@0
|
196 |
if(aMediaStats==EMediaPagingStatsAll || aMediaStats==EMediaPagingStatsRom)
|
sl@0
|
197 |
{
|
sl@0
|
198 |
SPagingBenchmarkInfo info;
|
sl@0
|
199 |
r=UserSvr::HalFunction(EHalGroupMedia,EMediaHalGetROMPagingBenchmark,(TAny*)aLocDrvNo,&info);
|
sl@0
|
200 |
if (r!=KErrNotSupported && r!=KErrNone)
|
sl@0
|
201 |
return r;
|
sl@0
|
202 |
if(r==KErrNone)
|
sl@0
|
203 |
{
|
sl@0
|
204 |
if (info.iCount != 0)
|
sl@0
|
205 |
{
|
sl@0
|
206 |
min = info.iMinTime * mult;
|
sl@0
|
207 |
max = info.iMaxTime * mult;
|
sl@0
|
208 |
avg = (info.iTotalTime * mult) / info.iCount;
|
sl@0
|
209 |
RDebug::Printf("ROM paging media benchmarks on drive %d:",aLocDrvNo);
|
sl@0
|
210 |
RDebug::Printf(" %-30s %6d %9.1f %9.1f %9.1f", "Page-in latency", info.iCount, min, max, avg);
|
sl@0
|
211 |
}
|
sl@0
|
212 |
}
|
sl@0
|
213 |
}
|
sl@0
|
214 |
|
sl@0
|
215 |
if(aMediaStats==EMediaPagingStatsAll || aMediaStats==EMediaPagingStatsCode)
|
sl@0
|
216 |
{
|
sl@0
|
217 |
SPagingBenchmarkInfo info;
|
sl@0
|
218 |
r=UserSvr::HalFunction(EHalGroupMedia,EMediaHalGetCodePagingBenchmark,(TAny*)aLocDrvNo,&info);
|
sl@0
|
219 |
if (r!=KErrNotSupported && r!=KErrNone)
|
sl@0
|
220 |
return r;
|
sl@0
|
221 |
if(r==KErrNone)
|
sl@0
|
222 |
{
|
sl@0
|
223 |
if (info.iCount != 0)
|
sl@0
|
224 |
{
|
sl@0
|
225 |
min = info.iMinTime * mult;
|
sl@0
|
226 |
max = info.iMaxTime * mult;
|
sl@0
|
227 |
avg = (info.iTotalTime * mult) / info.iCount;
|
sl@0
|
228 |
RDebug::Printf("Code paging media benchmarks on drive %d:",aLocDrvNo);
|
sl@0
|
229 |
RDebug::Printf(" %-30s %6d %9.1f %9.1f %9.1f", "Page-in latency", info.iCount, min, max, avg);
|
sl@0
|
230 |
}
|
sl@0
|
231 |
}
|
sl@0
|
232 |
}
|
sl@0
|
233 |
|
sl@0
|
234 |
if(aMediaStats==EMediaPagingStatsAll || aMediaStats==EMediaPagingStatsDataIn)
|
sl@0
|
235 |
{
|
sl@0
|
236 |
SPagingBenchmarkInfo info;
|
sl@0
|
237 |
r=UserSvr::HalFunction(EHalGroupMedia,EMediaHalGetDataInPagingBenchmark,(TAny*)aLocDrvNo,&info);
|
sl@0
|
238 |
if (r!=KErrNotSupported && r!=KErrNone)
|
sl@0
|
239 |
return r;
|
sl@0
|
240 |
if(r==KErrNone)
|
sl@0
|
241 |
{
|
sl@0
|
242 |
if (info.iCount != 0)
|
sl@0
|
243 |
{
|
sl@0
|
244 |
min = info.iMinTime * mult;
|
sl@0
|
245 |
max = info.iMaxTime * mult;
|
sl@0
|
246 |
avg = (info.iTotalTime * mult) / info.iCount;
|
sl@0
|
247 |
RDebug::Printf("Data page-in media benchmarks on drive %d:",aLocDrvNo);
|
sl@0
|
248 |
RDebug::Printf(" %-30s %6d %9.1f %9.1f %9.1f", "Page-in latency", info.iCount, min, max, avg);
|
sl@0
|
249 |
}
|
sl@0
|
250 |
}
|
sl@0
|
251 |
}
|
sl@0
|
252 |
|
sl@0
|
253 |
if(aMediaStats==EMediaPagingStatsAll || aMediaStats==EMediaPagingStatsDataOut)
|
sl@0
|
254 |
{
|
sl@0
|
255 |
SPagingBenchmarkInfo info;
|
sl@0
|
256 |
r=UserSvr::HalFunction(EHalGroupMedia,EMediaHalGetDataOutPagingBenchmark,(TAny*)aLocDrvNo,&info);
|
sl@0
|
257 |
if (r!=KErrNotSupported && r!=KErrNone)
|
sl@0
|
258 |
return r;
|
sl@0
|
259 |
if(r==KErrNone)
|
sl@0
|
260 |
{
|
sl@0
|
261 |
if (info.iCount != 0)
|
sl@0
|
262 |
{
|
sl@0
|
263 |
min = info.iMinTime * mult;
|
sl@0
|
264 |
max = info.iMaxTime * mult;
|
sl@0
|
265 |
avg = (info.iTotalTime * mult) / info.iCount;
|
sl@0
|
266 |
RDebug::Printf("Data page-out media benchmarks on drive %d:",aLocDrvNo);
|
sl@0
|
267 |
RDebug::Printf(" %-30s %6d %9.1f %9.1f %9.1f", "Page-in latency", info.iCount, min, max, avg);
|
sl@0
|
268 |
}
|
sl@0
|
269 |
}
|
sl@0
|
270 |
}
|
sl@0
|
271 |
|
sl@0
|
272 |
}
|
sl@0
|
273 |
|
sl@0
|
274 |
return KErrNone;
|
sl@0
|
275 |
}
|
sl@0
|
276 |
|
sl@0
|
277 |
|
sl@0
|
278 |
TInt PagingInfo::ResetAll(TInt aLocDrvNo, TMediaPagingStats aMediaStats)
|
sl@0
|
279 |
{
|
sl@0
|
280 |
TInt r = ResetEvents();
|
sl@0
|
281 |
if (r == KErrNone || r == KErrNotSupported)
|
sl@0
|
282 |
r = ResetConcurrency(aLocDrvNo,aMediaStats);
|
sl@0
|
283 |
if (r == KErrNone || r == KErrNotSupported)
|
sl@0
|
284 |
r = ResetBenchmarks(aLocDrvNo,aMediaStats);
|
sl@0
|
285 |
if (r == KErrNotSupported)
|
sl@0
|
286 |
r = KErrNone;
|
sl@0
|
287 |
return r;
|
sl@0
|
288 |
}
|
sl@0
|
289 |
|
sl@0
|
290 |
|
sl@0
|
291 |
TInt PagingInfo::PrintAll(TInt aLocDrvNo, TMediaPagingStats aMediaStats)
|
sl@0
|
292 |
{
|
sl@0
|
293 |
TInt r = PrintEvents();
|
sl@0
|
294 |
if (r == KErrNone || r == KErrNotSupported)
|
sl@0
|
295 |
r = PrintConcurrency(aLocDrvNo,aMediaStats);
|
sl@0
|
296 |
if (r == KErrNone || r == KErrNotSupported)
|
sl@0
|
297 |
r = PrintBenchmarks(aLocDrvNo,aMediaStats);
|
sl@0
|
298 |
if (r == KErrNotSupported)
|
sl@0
|
299 |
r = KErrNone;
|
sl@0
|
300 |
return r;
|
sl@0
|
301 |
}
|
sl@0
|
302 |
|
sl@0
|
303 |
|