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\debug\t_cache.cpp
|
sl@0
|
15 |
// Overview:
|
sl@0
|
16 |
// Performs cache checking in order to ensure it is running correctly.
|
sl@0
|
17 |
// Runs automatically or as manual test. (Type "t_cache help" for details.)
|
sl@0
|
18 |
// API Information:
|
sl@0
|
19 |
// class Cache
|
sl@0
|
20 |
// class L2Cache
|
sl@0
|
21 |
// Details:
|
sl@0
|
22 |
// -Test1 - Displays cache properties.
|
sl@0
|
23 |
// -Test2 - Gets thresholds.
|
sl@0
|
24 |
// -Test3 - Sets thresholds.
|
sl@0
|
25 |
// -Test4 - Compares different memory mappings of data.
|
sl@0
|
26 |
// -Test5 - Compares different memory mappings of code.
|
sl@0
|
27 |
// -Test6 - Tests Write Back mode.
|
sl@0
|
28 |
// -Test7 - Tests cache maintenance functions
|
sl@0
|
29 |
// It can also perform more specified tests if run manually:
|
sl@0
|
30 |
// - t_cache info Test1 only
|
sl@0
|
31 |
// - t_cache data <size_hex> Runs data chunk test (Test 4) with specified chunk size. For example,
|
sl@0
|
32 |
// "t_cache data 10000" will run data chunk test against 64KB chunk.
|
sl@0
|
33 |
// - t_cache code <size_hex> Runs code chunk test (Test 5) for specified chink size. For example,
|
sl@0
|
34 |
// "t_cache code 10000" will run code chunk test against 64KB chunk.
|
sl@0
|
35 |
// - t_cache data+<size_hex> Runs data chunk test for specified set of chunk sizes. For example,
|
sl@0
|
36 |
// "t_cache data+1000" will perform data chunk test for sizes 4K, 8K,... up to 512K.
|
sl@0
|
37 |
// - t_cache code+<size_hex> Runs code chunk test for specified set of sizes. For example,
|
sl@0
|
38 |
// "t_cache code+1000" will perform code chunk test for sizes 4K, 8K,... up to 512K.
|
sl@0
|
39 |
// - t_cache threshold Diplays thresholds for all caches on the platform.
|
sl@0
|
40 |
// - t_cache threshold T P C H Sets new values for cache thresholds:
|
sl@0
|
41 |
// - "T" specifies the type of cache to whose threshould are to be chenged:
|
sl@0
|
42 |
// 1 for Instruction (or Unified) Cache.
|
sl@0
|
43 |
// 2 for Data Cache (for ARMv7 and later, this is Point-of-Coherency threshold.
|
sl@0
|
44 |
// 4 for XScale AltData Cache.
|
sl@0
|
45 |
// 8 for Point-of-Unification Data Cache Threshold for ARMv7 and later platforms.
|
sl@0
|
46 |
// 10 for L2 (L210 or XScale L2 cache)
|
sl@0
|
47 |
// - "P" "C" & "H" are hex values for purge, clean & flush thresholds.
|
sl@0
|
48 |
// For example: "t_cache 1 10000 10000 10000" sets 64KB for all thresholds in Instruction Cache.
|
sl@0
|
49 |
// - t_cache usecase Runs particular use case tests.
|
sl@0
|
50 |
// - t_cache help Displays the list of manual commands.
|
sl@0
|
51 |
// Platforms/Drives/Compatibility:
|
sl@0
|
52 |
// Hardware - ARM only (Manual). Not supported on emulator.
|
sl@0
|
53 |
// Assumptions/Requirement/Pre-requisites:
|
sl@0
|
54 |
// Failures and causes:
|
sl@0
|
55 |
// Base Port information:
|
sl@0
|
56 |
// d_cache.mmp to be built from the baseport.
|
sl@0
|
57 |
//
|
sl@0
|
58 |
//
|
sl@0
|
59 |
|
sl@0
|
60 |
#include <e32test.h>
|
sl@0
|
61 |
#include "d_cache.h"
|
sl@0
|
62 |
|
sl@0
|
63 |
//------------globals---------------------
|
sl@0
|
64 |
LOCAL_D RTest test(_L("T_CACHE"));
|
sl@0
|
65 |
_LIT(KPrintCacheInfos,"info");
|
sl@0
|
66 |
_LIT(KTestData,"data");
|
sl@0
|
67 |
_LIT(KTestCode,"code");
|
sl@0
|
68 |
_LIT(KHelp,"help");
|
sl@0
|
69 |
_LIT(KThreshold,"threshold");
|
sl@0
|
70 |
_LIT(KIncremental,"+");
|
sl@0
|
71 |
_LIT(KUseCase,"usecase");
|
sl@0
|
72 |
|
sl@0
|
73 |
RCacheTestDevice Device;
|
sl@0
|
74 |
RCacheTestDevice::TCacheInfo CacheInfo;
|
sl@0
|
75 |
TBuf<KCacheDescSize> TempBuff;
|
sl@0
|
76 |
|
sl@0
|
77 |
const TInt KDefaultDataSize = 0x20000;
|
sl@0
|
78 |
const TInt KDefaultCodeSize = 0x804; //2K+4. Should be <= TestCodeFuncSize(). Otherwise, code test won't run against rom image.
|
sl@0
|
79 |
const TInt KMaxChunkSize = 0x80000; //512KB Incremental tests limit
|
sl@0
|
80 |
const TInt KWriteBackTestSizeSize = 0x4000; // Shouldn't go over cache thresholds (where purge becomes flush).
|
sl@0
|
81 |
|
sl@0
|
82 |
extern void DataSegmetTestFunct(void* aBase, TInt aSize);
|
sl@0
|
83 |
|
sl@0
|
84 |
/** Loads & opens LDD.*/
|
sl@0
|
85 |
void StartDriver()
|
sl@0
|
86 |
{
|
sl@0
|
87 |
TInt r = User::LoadLogicalDevice(KCacheTestDriverName);
|
sl@0
|
88 |
test( r==KErrNone || r==KErrAlreadyExists);
|
sl@0
|
89 |
if((r = Device.Open())!=KErrNone)
|
sl@0
|
90 |
{
|
sl@0
|
91 |
User::FreeLogicalDevice(KCacheTestDriverName);
|
sl@0
|
92 |
test.Printf(_L("Could not open LDD"));
|
sl@0
|
93 |
test(0);
|
sl@0
|
94 |
}
|
sl@0
|
95 |
}
|
sl@0
|
96 |
|
sl@0
|
97 |
/** Closes and unloads LDD.*/
|
sl@0
|
98 |
void StopDriver()
|
sl@0
|
99 |
{
|
sl@0
|
100 |
Device.Close();
|
sl@0
|
101 |
User::FreeLogicalDevice(KCacheTestDriverName);
|
sl@0
|
102 |
}
|
sl@0
|
103 |
|
sl@0
|
104 |
/** Get cache info from device driver. This will update CacheInfo global variable.*/
|
sl@0
|
105 |
void GetCacheInfo()
|
sl@0
|
106 |
{
|
sl@0
|
107 |
TInt r = Device.GetCacheInfo(CacheInfo);
|
sl@0
|
108 |
test(r==KErrNone);
|
sl@0
|
109 |
}
|
sl@0
|
110 |
|
sl@0
|
111 |
//---------------------------------------------
|
sl@0
|
112 |
//! @SYMTestCaseID MMU-T_CACHE-01
|
sl@0
|
113 |
//! @SYMTestType ST
|
sl@0
|
114 |
//! @SYMPREQ PREQ305
|
sl@0
|
115 |
//! @SYMREQ REQ5795
|
sl@0
|
116 |
//! @SYMTestCaseDesc Displays cache properties.
|
sl@0
|
117 |
//! @SYMTestExpectedResults KErrNone
|
sl@0
|
118 |
//! @SYMTestPriority Low
|
sl@0
|
119 |
//! @SYMTestStatus Implemented
|
sl@0
|
120 |
//---------------------------------------------
|
sl@0
|
121 |
void Test1()
|
sl@0
|
122 |
{
|
sl@0
|
123 |
TInt i;
|
sl@0
|
124 |
|
sl@0
|
125 |
test.Printf(_L("General Info:\n"));
|
sl@0
|
126 |
TPtr ptr = CacheInfo.iDesc.Expand();
|
sl@0
|
127 |
test.Printf(ptr);
|
sl@0
|
128 |
test.Printf(_L("CacheCount:%d, MaxCacheSize:%xH, MemoryRemapping:%d, OuterCache:%d\n"),CacheInfo.iCacheCount, CacheInfo.iMaxCacheSize, CacheInfo.iMemoryRemapping, CacheInfo.iOuterCache);
|
sl@0
|
129 |
test.Printf(_L("DMAMemoryAlignement:%d\n"),CacheInfo.iDmaBufferAlignment);
|
sl@0
|
130 |
|
sl@0
|
131 |
|
sl@0
|
132 |
test.Printf(_L("Per Level Info:\n"));
|
sl@0
|
133 |
test.Printf(_L("Level\tData\tInstr\tSize(b)\tLine(b)\tWays\tSets\tDescription\n"));
|
sl@0
|
134 |
|
sl@0
|
135 |
for (i = 0; i<CacheInfo.iCacheCount; i++)
|
sl@0
|
136 |
{
|
sl@0
|
137 |
TempBuff.SetLength(0);
|
sl@0
|
138 |
RCacheTestDevice::TCacheSingle& cs = CacheInfo.iCache[i];
|
sl@0
|
139 |
TempBuff.Format(_L("%d\t%d\t%d\t%xH\t%xH\t%xH\t%xH\t"), cs.iLevel, cs.iData, cs.iCode, cs.iSize, cs.iLineSize, cs.iWays, cs.iSets);
|
sl@0
|
140 |
ptr = cs.iDesc.Expand();
|
sl@0
|
141 |
TempBuff.Append(ptr);
|
sl@0
|
142 |
TempBuff.Append(_L("\n"));
|
sl@0
|
143 |
test.Printf(TempBuff);
|
sl@0
|
144 |
}
|
sl@0
|
145 |
}
|
sl@0
|
146 |
|
sl@0
|
147 |
//---------------------------------------------
|
sl@0
|
148 |
//! @SYMTestCaseID MMU-T_CACHE-02
|
sl@0
|
149 |
//! @SYMTestType ST
|
sl@0
|
150 |
//! @SYMPREQ PREQ1068
|
sl@0
|
151 |
//! @SYMREQ REQ5909
|
sl@0
|
152 |
//! @SYMTestCaseDesc Gets thresholds.
|
sl@0
|
153 |
//! @SYMTestActions Fetches Cache Thresholds from the driver.
|
sl@0
|
154 |
//! @SYMTestExpectedResults KErrNone
|
sl@0
|
155 |
//! @SYMTestPriority High
|
sl@0
|
156 |
//! @SYMTestStatus Implemented
|
sl@0
|
157 |
//---------------------------------------------
|
sl@0
|
158 |
void Test2()
|
sl@0
|
159 |
{
|
sl@0
|
160 |
RCacheTestDevice::TThresholdInfo info;
|
sl@0
|
161 |
|
sl@0
|
162 |
test.Printf(_L("Cache: Purge Clear Flush\n"));
|
sl@0
|
163 |
|
sl@0
|
164 |
info.iCacheType=1;
|
sl@0
|
165 |
if (KErrNone == Device.GetThreshold(info))
|
sl@0
|
166 |
test.Printf(_L("Instr:%6x %6x %6x\n"),info.iPurge,info.iClean,info.iFlush);
|
sl@0
|
167 |
|
sl@0
|
168 |
info.iCacheType=2;
|
sl@0
|
169 |
if (KErrNone == Device.GetThreshold(info))
|
sl@0
|
170 |
test.Printf(_L("Data: %6x %6x %6x\n"),info.iPurge,info.iClean,info.iFlush);
|
sl@0
|
171 |
|
sl@0
|
172 |
info.iCacheType=4;
|
sl@0
|
173 |
if (KErrNone == Device.GetThreshold(info))
|
sl@0
|
174 |
test.Printf(_L("AltD: %6x %6x %6x\n"),info.iPurge,info.iClean,info.iFlush);
|
sl@0
|
175 |
|
sl@0
|
176 |
info.iCacheType=8;
|
sl@0
|
177 |
if (KErrNone == Device.GetThreshold(info))
|
sl@0
|
178 |
test.Printf(_L("D_IMB:%6x %6x %6x\n"),info.iPurge,info.iClean,info.iFlush);
|
sl@0
|
179 |
|
sl@0
|
180 |
info.iCacheType=16;
|
sl@0
|
181 |
if (KErrNone == Device.GetThreshold(info))
|
sl@0
|
182 |
test.Printf(_L("L2: %6x %6x %6x\n"),info.iPurge,info.iClean,info.iFlush);
|
sl@0
|
183 |
}
|
sl@0
|
184 |
|
sl@0
|
185 |
//---------------------------------------------
|
sl@0
|
186 |
//! @SYMTestCaseID MMU-T_CACHE-03
|
sl@0
|
187 |
//! @SYMTestType ST
|
sl@0
|
188 |
//! @SYMPREQ PREQ1068
|
sl@0
|
189 |
//! @SYMREQ REQ5909
|
sl@0
|
190 |
//! @SYMTestCaseDesc Sets thresholds.
|
sl@0
|
191 |
//! @SYMTestActions Sets new values forr Cache Thresholds. Then, sets back the old values.
|
sl@0
|
192 |
//! @SYMTestExpectedResults KErrNone
|
sl@0
|
193 |
//! @SYMTestPriority High
|
sl@0
|
194 |
//! @SYMTestStatus Implemented
|
sl@0
|
195 |
//---------------------------------------------
|
sl@0
|
196 |
void Test3()
|
sl@0
|
197 |
{
|
sl@0
|
198 |
TInt i, tested=0;
|
sl@0
|
199 |
RCacheTestDevice::TThresholdInfo info[5]; //for 5 types og cache
|
sl@0
|
200 |
TInt returned[5];
|
sl@0
|
201 |
|
sl@0
|
202 |
|
sl@0
|
203 |
//Get the old values
|
sl@0
|
204 |
for (i=0;i<5;i++)
|
sl@0
|
205 |
{
|
sl@0
|
206 |
info[i].iCacheType= 1<<i;
|
sl@0
|
207 |
returned[i] = Device.GetThreshold(info[i]);
|
sl@0
|
208 |
}
|
sl@0
|
209 |
|
sl@0
|
210 |
//Double them all
|
sl@0
|
211 |
for (i=0;i<5;i++)
|
sl@0
|
212 |
{
|
sl@0
|
213 |
if (returned[i] != KErrNone) continue; //not a valid cache type for running platform
|
sl@0
|
214 |
tested++;
|
sl@0
|
215 |
info[i].iPurge <<=1;
|
sl@0
|
216 |
info[i].iClean <<=1;
|
sl@0
|
217 |
info[i].iFlush <<=1;
|
sl@0
|
218 |
test(KErrNone==Device.SetThreshold(info[i]));
|
sl@0
|
219 |
}
|
sl@0
|
220 |
|
sl@0
|
221 |
//Put back the old values
|
sl@0
|
222 |
for (i=0;i<5;i++)
|
sl@0
|
223 |
{
|
sl@0
|
224 |
if (returned[i] != KErrNone) continue; //not a valid cache type for running platform
|
sl@0
|
225 |
info[i].iPurge >>=1;
|
sl@0
|
226 |
info[i].iClean >>=1;
|
sl@0
|
227 |
info[i].iFlush >>=1;
|
sl@0
|
228 |
test(KErrNone==Device.SetThreshold(info[i]));
|
sl@0
|
229 |
}
|
sl@0
|
230 |
test.Printf(_L(" ... %d caches present & tested\n"), tested);
|
sl@0
|
231 |
}
|
sl@0
|
232 |
|
sl@0
|
233 |
|
sl@0
|
234 |
|
sl@0
|
235 |
void DoTest4(RCacheTestDevice::TCacheAttr aCacheAttr, RCacheTestDevice::TChunkTest& aDC, TInt& aTime1, TInt& aTime2)
|
sl@0
|
236 |
{
|
sl@0
|
237 |
aDC.iCacheAttr = aCacheAttr;
|
sl@0
|
238 |
|
sl@0
|
239 |
aDC.iShared = EFalse;
|
sl@0
|
240 |
test(KErrNone==Device.TestDataChunk(aDC));
|
sl@0
|
241 |
aTime1 = aDC.iTime;
|
sl@0
|
242 |
|
sl@0
|
243 |
aDC.iShared = ETrue;
|
sl@0
|
244 |
test(KErrNone==Device.TestDataChunk(aDC));
|
sl@0
|
245 |
aTime2 = aDC.iTime;
|
sl@0
|
246 |
}
|
sl@0
|
247 |
//---------------------------------------------
|
sl@0
|
248 |
//! @SYMTestCaseID MMU-T_CACHE-04
|
sl@0
|
249 |
//! @SYMTestType ST
|
sl@0
|
250 |
//! @SYMPREQ PREQ305
|
sl@0
|
251 |
//! @SYMREQ REQ5795
|
sl@0
|
252 |
//! @SYMTestCaseDesc Compares different memory mappings of data.
|
sl@0
|
253 |
//! @SYMTestActions Runs the same performance test against data in the chunks with different cache attributes.
|
sl@0
|
254 |
//! Also, runs the same test against data from user & kernel heaps.
|
sl@0
|
255 |
//! @SYMTestExpectedResults KErrNone
|
sl@0
|
256 |
//! @SYMTestPriority Low
|
sl@0
|
257 |
//! @SYMTestStatus Implemented
|
sl@0
|
258 |
//---------------------------------------------
|
sl@0
|
259 |
void Test4(TInt aSize)
|
sl@0
|
260 |
{
|
sl@0
|
261 |
RCacheTestDevice::TChunkTest dC;
|
sl@0
|
262 |
dC.iSize = aSize;
|
sl@0
|
263 |
dC.iUseCase = 0; //not used
|
sl@0
|
264 |
dC.iLoops = 0; //not used
|
sl@0
|
265 |
TInt timeNS=0, timeS=0;
|
sl@0
|
266 |
|
sl@0
|
267 |
test.Printf(_L(" Time\n"));
|
sl@0
|
268 |
test.Printf(_L("Mem_Type ActualMapAttr NotShared Shared\n"));
|
sl@0
|
269 |
test.Printf(_L("----------------------------------------------\n"));
|
sl@0
|
270 |
|
sl@0
|
271 |
DoTest4(RCacheTestDevice::E_FullyBlocking, dC, timeNS, timeS);
|
sl@0
|
272 |
test.Printf(_L("FullyBlocking %08xH\t%7d\t%7d\n"),dC.iActualMapAttr, timeNS, timeS);
|
sl@0
|
273 |
DoTest4(RCacheTestDevice::E_Buffered_NC, dC, timeNS, timeS);
|
sl@0
|
274 |
test.Printf(_L("Buffered_NC %08xH\t%7d\t%7d\n"),dC.iActualMapAttr, timeNS, timeS);
|
sl@0
|
275 |
DoTest4(RCacheTestDevice::E_Buffered_C, dC, timeNS, timeS);
|
sl@0
|
276 |
test.Printf(_L("Buffered_C %08xH\t%7d\t%7d\n"),dC.iActualMapAttr, timeNS, timeS);
|
sl@0
|
277 |
|
sl@0
|
278 |
|
sl@0
|
279 |
DoTest4(RCacheTestDevice::E_InnerWT, dC, timeNS, timeS);
|
sl@0
|
280 |
test.Printf(_L("InnerWT %08xH\t%7d\t%7d\n"),dC.iActualMapAttr, timeNS, timeS);
|
sl@0
|
281 |
DoTest4(RCacheTestDevice::E_InnerWBRA, dC, timeNS, timeS);
|
sl@0
|
282 |
test.Printf(_L("InnerWBRA %08xH\t%7d\t%7d\n"),dC.iActualMapAttr, timeNS, timeS);
|
sl@0
|
283 |
DoTest4(RCacheTestDevice::E_InnerWB, dC, timeNS, timeS);
|
sl@0
|
284 |
test.Printf(_L("InnerWB %08xH\t%7d\t%7d\n"),dC.iActualMapAttr, timeNS, timeS);
|
sl@0
|
285 |
|
sl@0
|
286 |
if(CacheInfo.iOuterCache)
|
sl@0
|
287 |
{
|
sl@0
|
288 |
DoTest4(RCacheTestDevice::E_OuterWT, dC, timeNS, timeS);
|
sl@0
|
289 |
test.Printf(_L("OuterWT %08xH\t%7d\t%7d\n"),dC.iActualMapAttr, timeNS, timeS);
|
sl@0
|
290 |
DoTest4(RCacheTestDevice::E_OuterWBRA, dC, timeNS, timeS);
|
sl@0
|
291 |
test.Printf(_L("OuterWBRA %08xH\t%7d\t%7d\n"),dC.iActualMapAttr, timeNS, timeS);
|
sl@0
|
292 |
DoTest4(RCacheTestDevice::E_OuterWB, dC, timeNS, timeS);
|
sl@0
|
293 |
test.Printf(_L("OuterWB %08xH\t%7d\t%7d\n"),dC.iActualMapAttr, timeNS, timeS);
|
sl@0
|
294 |
|
sl@0
|
295 |
DoTest4(RCacheTestDevice::E_InOutWT, dC, timeNS, timeS);
|
sl@0
|
296 |
test.Printf(_L("InOutWT %08xH\t%7d\t%7d\n"),dC.iActualMapAttr, timeNS, timeS);
|
sl@0
|
297 |
DoTest4(RCacheTestDevice::E_InOutWBRA, dC, timeNS, timeS);
|
sl@0
|
298 |
test.Printf(_L("InOutWBRA %08xH\t%7d\t%7d\n"),dC.iActualMapAttr, timeNS, timeS);
|
sl@0
|
299 |
DoTest4(RCacheTestDevice::E_InOutWB, dC, timeNS, timeS);
|
sl@0
|
300 |
test.Printf(_L("InOutWB %08xH\t%7d\t%7d\n"),dC.iActualMapAttr, timeNS, timeS);
|
sl@0
|
301 |
}
|
sl@0
|
302 |
|
sl@0
|
303 |
|
sl@0
|
304 |
DoTest4(RCacheTestDevice::E_StronglyOrder, dC, timeNS, timeS);
|
sl@0
|
305 |
test.Printf(_L("StronglyOrder %08xH\t%7d\t%7d\n"),dC.iActualMapAttr, timeNS, timeS);
|
sl@0
|
306 |
DoTest4(RCacheTestDevice::E_Device, dC, timeNS, timeS);
|
sl@0
|
307 |
test.Printf(_L("Device %08xH\t%7d\t%7d\n"),dC.iActualMapAttr, timeNS, timeS);
|
sl@0
|
308 |
DoTest4(RCacheTestDevice::E_Normal_Uncached, dC, timeNS, timeS);
|
sl@0
|
309 |
test.Printf(_L("Normal_Uncached %08xH\t%7d\t%7d\n"),dC.iActualMapAttr, timeNS, timeS);
|
sl@0
|
310 |
DoTest4(RCacheTestDevice::E_Normal_Cached, dC, timeNS, timeS);
|
sl@0
|
311 |
test.Printf(_L("Normal_Cached %08xH\t%7d\t%7d\n"),dC.iActualMapAttr, timeNS, timeS);
|
sl@0
|
312 |
|
sl@0
|
313 |
if(CacheInfo.iMemoryRemapping)
|
sl@0
|
314 |
{
|
sl@0
|
315 |
DoTest4(RCacheTestDevice::E_KernelInternal4, dC, timeNS, timeS);
|
sl@0
|
316 |
test.Printf(_L("KernelInternal4 %08xH\t%7d\t%7d\n"),dC.iActualMapAttr, timeNS, timeS);
|
sl@0
|
317 |
DoTest4(RCacheTestDevice::E_PlatformSpecific5, dC, timeNS, timeS);
|
sl@0
|
318 |
test.Printf(_L("PlatSpecific5 %08xH\t%7d\t%7d\n"),dC.iActualMapAttr, timeNS, timeS);
|
sl@0
|
319 |
DoTest4(RCacheTestDevice::E_PlatformSpecific6, dC, timeNS, timeS);
|
sl@0
|
320 |
test.Printf(_L("PlatSpecific6 %08xH\t%7d\t%7d\n"),dC.iActualMapAttr, timeNS, timeS);
|
sl@0
|
321 |
DoTest4(RCacheTestDevice::E_PlatformSpecific7, dC, timeNS, timeS);
|
sl@0
|
322 |
test.Printf(_L("PlatSpecific7 %08xH\t%7d\t%7d\n"),dC.iActualMapAttr, timeNS, timeS);
|
sl@0
|
323 |
|
sl@0
|
324 |
|
sl@0
|
325 |
DoTest4(RCacheTestDevice::E_InnerWT_Remapped, dC, timeNS, timeS);
|
sl@0
|
326 |
test.Printf(_L("InnerWT_Remap %08xH\t%7d\t%7d\n"),dC.iActualMapAttr, timeNS, timeS);
|
sl@0
|
327 |
DoTest4(RCacheTestDevice::E_InnerWBRA_Remapped, dC, timeNS, timeS);
|
sl@0
|
328 |
test.Printf(_L("InnerWBRA_Remap %08xH\t%7d\t%7d\n"),dC.iActualMapAttr, timeNS, timeS);
|
sl@0
|
329 |
DoTest4(RCacheTestDevice::E_InnerWB_Remapped, dC, timeNS, timeS);
|
sl@0
|
330 |
test.Printf(_L("InnerWB_Remap %08xH\t%7d\t%7d\n"),dC.iActualMapAttr, timeNS, timeS);
|
sl@0
|
331 |
|
sl@0
|
332 |
if(CacheInfo.iOuterCache)
|
sl@0
|
333 |
{
|
sl@0
|
334 |
DoTest4(RCacheTestDevice::E_OuterWT_Remapped, dC, timeNS, timeS);
|
sl@0
|
335 |
test.Printf(_L("OuterWT_Remap %08xH\t%7d\t%7d\n"),dC.iActualMapAttr, timeNS, timeS);
|
sl@0
|
336 |
DoTest4(RCacheTestDevice::E_OuterWBRA_Remapped, dC, timeNS, timeS);
|
sl@0
|
337 |
test.Printf(_L("OuterWBRA_Remap %08xH\t%7d\t%7d\n"),dC.iActualMapAttr, timeNS, timeS);
|
sl@0
|
338 |
DoTest4(RCacheTestDevice::E_OuterWB_Remapped, dC, timeNS, timeS);
|
sl@0
|
339 |
test.Printf(_L("OuterWB_Remap %08xH\t%7d\t%7d\n"),dC.iActualMapAttr, timeNS, timeS);
|
sl@0
|
340 |
|
sl@0
|
341 |
DoTest4(RCacheTestDevice::E_InOutWT_Remapped, dC, timeNS, timeS);
|
sl@0
|
342 |
test.Printf(_L("InOutWT_Remap %08xH\t%7d\t%7d\n"),dC.iActualMapAttr, timeNS, timeS);
|
sl@0
|
343 |
DoTest4(RCacheTestDevice::E_InOutWBRA_Remapped, dC, timeNS, timeS);
|
sl@0
|
344 |
test.Printf(_L("InOutWBRA_Remap %08xH\t%7d\t%7d\n"),dC.iActualMapAttr, timeNS, timeS);
|
sl@0
|
345 |
DoTest4(RCacheTestDevice::E_InOutWB_Remapped, dC, timeNS, timeS);
|
sl@0
|
346 |
test.Printf(_L("InOutWB_Remap %08xH\t%7d\t%7d\n"),dC.iActualMapAttr, timeNS, timeS);
|
sl@0
|
347 |
}
|
sl@0
|
348 |
}
|
sl@0
|
349 |
|
sl@0
|
350 |
//Run against kernel heap - allow the test to fail due to OOM
|
sl@0
|
351 |
dC.iCacheAttr = RCacheTestDevice::E_Default;
|
sl@0
|
352 |
TInt r = Device.TestDataChunk(dC);
|
sl@0
|
353 |
if (r==KErrNone) test.Printf(_L("Kernel Heap ---------\t%7d\t-------\n"), dC.iTime);
|
sl@0
|
354 |
else if (r==KErrNoMemory) test.Printf(_L("Kernel Heap Cannot allocate memory\n"));
|
sl@0
|
355 |
else test(0);//fail
|
sl@0
|
356 |
|
sl@0
|
357 |
//Run against user heap - allow the test to fail due to OOM
|
sl@0
|
358 |
void* buffer = User::Alloc(dC.iSize);
|
sl@0
|
359 |
if (buffer == NULL)
|
sl@0
|
360 |
{
|
sl@0
|
361 |
test.Printf(_L("User Heap Cannot allocate memory\n"));
|
sl@0
|
362 |
return;
|
sl@0
|
363 |
}
|
sl@0
|
364 |
TInt time = User::NTickCount();
|
sl@0
|
365 |
DataSegmetTestFunct(buffer , dC.iSize);
|
sl@0
|
366 |
time = User::NTickCount() - time;
|
sl@0
|
367 |
User::Free(buffer);
|
sl@0
|
368 |
test.Printf(_L("User Heap ---------\t%7d\t-------\n"), time);
|
sl@0
|
369 |
|
sl@0
|
370 |
}
|
sl@0
|
371 |
|
sl@0
|
372 |
|
sl@0
|
373 |
void DoTest5(RCacheTestDevice::TCacheAttr aCacheAttr, RCacheTestDevice::TChunkTest& aDC, TInt& aTime1, TInt& aTime2)
|
sl@0
|
374 |
{
|
sl@0
|
375 |
aDC.iCacheAttr = aCacheAttr;
|
sl@0
|
376 |
|
sl@0
|
377 |
aDC.iShared = EFalse;
|
sl@0
|
378 |
test(KErrNone==Device.TestCodeChunk(aDC));
|
sl@0
|
379 |
aTime1 = aDC.iTime;
|
sl@0
|
380 |
|
sl@0
|
381 |
aDC.iShared = ETrue;
|
sl@0
|
382 |
test(KErrNone==Device.TestCodeChunk(aDC));
|
sl@0
|
383 |
aTime2 = aDC.iTime;
|
sl@0
|
384 |
}
|
sl@0
|
385 |
//---------------------------------------------
|
sl@0
|
386 |
//! @SYMTestCaseID MMU-T_CACHE-05
|
sl@0
|
387 |
//! @SYMTestType ST
|
sl@0
|
388 |
//! @SYMPREQ PREQ305
|
sl@0
|
389 |
//! @SYMREQ REQ5795
|
sl@0
|
390 |
//! @SYMTestCaseDesc Compares different memory mappings of code.
|
sl@0
|
391 |
//! @SYMTestActions Runs the same performance test against code in chunks with different cache attributes.
|
sl@0
|
392 |
//! Also, runs the same test against code from rom..
|
sl@0
|
393 |
//! @SYMTestExpectedResults KErrNone
|
sl@0
|
394 |
//! @SYMTestPriority Low
|
sl@0
|
395 |
//! @SYMTestStatus Implemented
|
sl@0
|
396 |
//---------------------------------------------
|
sl@0
|
397 |
void Test5(TInt aSize)
|
sl@0
|
398 |
{
|
sl@0
|
399 |
RCacheTestDevice::TChunkTest dC;
|
sl@0
|
400 |
dC.iSize = aSize;
|
sl@0
|
401 |
dC.iUseCase = 0; //not used
|
sl@0
|
402 |
dC.iLoops = 0; //not used
|
sl@0
|
403 |
TInt timeNS=0, timeS=0;
|
sl@0
|
404 |
|
sl@0
|
405 |
test.Printf(_L(" Time\n"));
|
sl@0
|
406 |
test.Printf(_L("Mem_Type AttemptedMapAttr NotShared Shared\n"));
|
sl@0
|
407 |
test.Printf(_L("----------------------------------------------\n"));
|
sl@0
|
408 |
|
sl@0
|
409 |
DoTest5(RCacheTestDevice::E_FullyBlocking, dC, timeNS, timeS);
|
sl@0
|
410 |
test.Printf(_L("FullyBlocking %08xH\t%7d\t%7d\n"),dC.iActualMapAttr, timeNS, timeS);
|
sl@0
|
411 |
DoTest5(RCacheTestDevice::E_Buffered_NC, dC, timeNS, timeS);
|
sl@0
|
412 |
test.Printf(_L("Buffered_NC %08xH\t%7d\t%7d\n"),dC.iActualMapAttr, timeNS, timeS);
|
sl@0
|
413 |
DoTest5(RCacheTestDevice::E_Buffered_C, dC, timeNS, timeS);
|
sl@0
|
414 |
test.Printf(_L("Buffered_C %08xH\t%7d\t%7d\n"),dC.iActualMapAttr, timeNS, timeS);
|
sl@0
|
415 |
|
sl@0
|
416 |
|
sl@0
|
417 |
DoTest5(RCacheTestDevice::E_InnerWT, dC, timeNS, timeS);
|
sl@0
|
418 |
test.Printf(_L("InnerWT %08xH\t%7d\t%7d\n"),dC.iActualMapAttr, timeNS, timeS);
|
sl@0
|
419 |
DoTest5(RCacheTestDevice::E_InnerWBRA, dC, timeNS, timeS);
|
sl@0
|
420 |
test.Printf(_L("InnerWBRA %08xH\t%7d\t%7d\n"),dC.iActualMapAttr, timeNS, timeS);
|
sl@0
|
421 |
DoTest5(RCacheTestDevice::E_InnerWB, dC, timeNS, timeS);
|
sl@0
|
422 |
test.Printf(_L("InnerWB %08xH\t%7d\t%7d\n"),dC.iActualMapAttr, timeNS, timeS);
|
sl@0
|
423 |
|
sl@0
|
424 |
if(CacheInfo.iOuterCache)
|
sl@0
|
425 |
{
|
sl@0
|
426 |
DoTest5(RCacheTestDevice::E_OuterWT, dC, timeNS, timeS);
|
sl@0
|
427 |
test.Printf(_L("OuterWT %08xH\t%7d\t%7d\n"),dC.iActualMapAttr, timeNS, timeS);
|
sl@0
|
428 |
DoTest5(RCacheTestDevice::E_OuterWBRA, dC, timeNS, timeS);
|
sl@0
|
429 |
test.Printf(_L("OuterWBRA %08xH\t%7d\t%7d\n"),dC.iActualMapAttr, timeNS, timeS);
|
sl@0
|
430 |
DoTest5(RCacheTestDevice::E_OuterWB, dC, timeNS, timeS);
|
sl@0
|
431 |
test.Printf(_L("OuterWB %08xH\t%7d\t%7d\n"),dC.iActualMapAttr, timeNS, timeS);
|
sl@0
|
432 |
|
sl@0
|
433 |
DoTest5(RCacheTestDevice::E_InOutWT, dC, timeNS, timeS);
|
sl@0
|
434 |
test.Printf(_L("InOutWT %08xH\t%7d\t%7d\n"),dC.iActualMapAttr, timeNS, timeS);
|
sl@0
|
435 |
DoTest5(RCacheTestDevice::E_InOutWBRA, dC, timeNS, timeS);
|
sl@0
|
436 |
test.Printf(_L("InOutWBRA %08xH\t%7d\t%7d\n"),dC.iActualMapAttr, timeNS, timeS);
|
sl@0
|
437 |
DoTest5(RCacheTestDevice::E_InOutWB, dC, timeNS, timeS);
|
sl@0
|
438 |
test.Printf(_L("InOutWB %08xH\t%7d\t%7d\n"),dC.iActualMapAttr, timeNS, timeS);
|
sl@0
|
439 |
}
|
sl@0
|
440 |
|
sl@0
|
441 |
|
sl@0
|
442 |
DoTest5(RCacheTestDevice::E_StronglyOrder, dC, timeNS, timeS);
|
sl@0
|
443 |
test.Printf(_L("StronglyOrder %08xH\t%7d\t%7d\n"),dC.iActualMapAttr, timeNS, timeS);
|
sl@0
|
444 |
DoTest5(RCacheTestDevice::E_Device, dC, timeNS, timeS);
|
sl@0
|
445 |
test.Printf(_L("Device %08xH\t%7d\t%7d\n"),dC.iActualMapAttr, timeNS, timeS);
|
sl@0
|
446 |
DoTest5(RCacheTestDevice::E_Normal_Uncached, dC, timeNS, timeS);
|
sl@0
|
447 |
test.Printf(_L("Normal_Uncached %08xH\t%7d\t%7d\n"),dC.iActualMapAttr, timeNS, timeS);
|
sl@0
|
448 |
DoTest5(RCacheTestDevice::E_Normal_Cached, dC, timeNS, timeS);
|
sl@0
|
449 |
test.Printf(_L("Normal_Cached %08xH\t%7d\t%7d\n"),dC.iActualMapAttr, timeNS, timeS);
|
sl@0
|
450 |
|
sl@0
|
451 |
if(CacheInfo.iMemoryRemapping)
|
sl@0
|
452 |
{
|
sl@0
|
453 |
DoTest5(RCacheTestDevice::E_InnerWT_Remapped, dC, timeNS, timeS);
|
sl@0
|
454 |
test.Printf(_L("InnerWT_Remap %08xH\t%7d\t%7d\n"),dC.iActualMapAttr, timeNS, timeS);
|
sl@0
|
455 |
DoTest5(RCacheTestDevice::E_InnerWBRA_Remapped, dC, timeNS, timeS);
|
sl@0
|
456 |
test.Printf(_L("InnerWBRA_Remap %08xH\t%7d\t%7d\n"),dC.iActualMapAttr, timeNS, timeS);
|
sl@0
|
457 |
DoTest5(RCacheTestDevice::E_InnerWB_Remapped, dC, timeNS, timeS);
|
sl@0
|
458 |
test.Printf(_L("InnerWB_Remap %08xH\t%7d\t%7d\n"),dC.iActualMapAttr, timeNS, timeS);
|
sl@0
|
459 |
|
sl@0
|
460 |
if(CacheInfo.iOuterCache)
|
sl@0
|
461 |
{
|
sl@0
|
462 |
DoTest5(RCacheTestDevice::E_OuterWT_Remapped, dC, timeNS, timeS);
|
sl@0
|
463 |
test.Printf(_L("OuterWT_Remap %08xH\t%7d\t%7d\n"),dC.iActualMapAttr, timeNS, timeS);
|
sl@0
|
464 |
DoTest5(RCacheTestDevice::E_OuterWBRA_Remapped, dC, timeNS, timeS);
|
sl@0
|
465 |
test.Printf(_L("OuterWBRA_Remap %08xH\t%7d\t%7d\n"),dC.iActualMapAttr, timeNS, timeS);
|
sl@0
|
466 |
DoTest5(RCacheTestDevice::E_OuterWB_Remapped, dC, timeNS, timeS);
|
sl@0
|
467 |
test.Printf(_L("OuterWB_Remap %08xH\t%7d\t%7d\n"),dC.iActualMapAttr, timeNS, timeS);
|
sl@0
|
468 |
|
sl@0
|
469 |
DoTest5(RCacheTestDevice::E_InOutWT_Remapped, dC, timeNS, timeS);
|
sl@0
|
470 |
test.Printf(_L("InOutWT_Remap %08xH\t%7d\t%7d\n"),dC.iActualMapAttr, timeNS, timeS);
|
sl@0
|
471 |
DoTest5(RCacheTestDevice::E_InOutWBRA_Remapped, dC, timeNS, timeS);
|
sl@0
|
472 |
test.Printf(_L("InOutWBRA_Remap %08xH\t%7d\t%7d\n"),dC.iActualMapAttr, timeNS, timeS);
|
sl@0
|
473 |
DoTest5(RCacheTestDevice::E_InOutWB_Remapped, dC, timeNS, timeS);
|
sl@0
|
474 |
test.Printf(_L("InOutWB_Remap %08xH\t%7d\t%7d\n"),dC.iActualMapAttr, timeNS, timeS);
|
sl@0
|
475 |
}
|
sl@0
|
476 |
}
|
sl@0
|
477 |
|
sl@0
|
478 |
//Run against kernel heap - allow the test to fail due to OOM
|
sl@0
|
479 |
dC.iCacheAttr = RCacheTestDevice::E_Default;
|
sl@0
|
480 |
TInt r = Device.TestCodeChunk(dC);
|
sl@0
|
481 |
if (r==KErrNone) test.Printf(_L("Run from rom ---------\t%7d\t-------\n"), dC.iTime);
|
sl@0
|
482 |
else if (r==KErrNoMemory) test.Printf(_L("Run from rom Cannot allocate memory\n"));
|
sl@0
|
483 |
else test(0);//fail
|
sl@0
|
484 |
|
sl@0
|
485 |
}
|
sl@0
|
486 |
|
sl@0
|
487 |
|
sl@0
|
488 |
|
sl@0
|
489 |
//---------------------------------------------
|
sl@0
|
490 |
//! @SYMTestCaseID MMU-T_CACHE-06
|
sl@0
|
491 |
//! @SYMTestType ST
|
sl@0
|
492 |
//! @SYMPREQ PREQ305
|
sl@0
|
493 |
//! @SYMREQ REQ5795
|
sl@0
|
494 |
//! @SYMTestCaseDesc Tests Write Back mode.
|
sl@0
|
495 |
//! @SYMTestActions The driver allocates write back chunk, write data into it and invalidate (aka purge)
|
sl@0
|
496 |
// the chunk from the cache. Then, it counts the number of bytes of the chunk that
|
sl@0
|
497 |
// reached the physical memory.
|
sl@0
|
498 |
//! @SYMTestExpectedResults KErrNone
|
sl@0
|
499 |
//! @SYMTestPriority Low
|
sl@0
|
500 |
//! @SYMTestStatus Implemented
|
sl@0
|
501 |
//---------------------------------------------
|
sl@0
|
502 |
|
sl@0
|
503 |
void Test6()
|
sl@0
|
504 |
{
|
sl@0
|
505 |
test.Printf(_L("Test4: Testing WriteBack cache mode...\n"));
|
sl@0
|
506 |
RCacheTestDevice::TChunkTest dC;
|
sl@0
|
507 |
|
sl@0
|
508 |
|
sl@0
|
509 |
test.Printf(_L("Cache\tMemType\tChecking\tSize\tBytesInRAM\tVerdict\n"));
|
sl@0
|
510 |
test.Printf(_L("-----\t-------\t--------\t----\t----------\t-------\n"));
|
sl@0
|
511 |
//
|
sl@0
|
512 |
dC.iSize = KWriteBackTestSizeSize;
|
sl@0
|
513 |
if(CacheInfo.iMemoryRemapping) dC.iCacheAttr = RCacheTestDevice::E_InnerWBRA_Remapped;
|
sl@0
|
514 |
else dC.iCacheAttr = RCacheTestDevice::E_InnerWBRA;
|
sl@0
|
515 |
test(Device.TestWriteBackReadAllocate(dC)==KErrNone);
|
sl@0
|
516 |
if (dC.iSize<KWriteBackTestSizeSize)test.Printf(_L("Inner\tWBRA\tReadAlloc\t%xH\t%xH\tOK\n"), KWriteBackTestSizeSize, dC.iSize);
|
sl@0
|
517 |
else test.Printf(_L("Inner\tWBRA\tReadAlloc\t%xH\t%xH\tWarning: Didn't pass\n"), KWriteBackTestSizeSize, dC.iSize);
|
sl@0
|
518 |
//
|
sl@0
|
519 |
dC.iSize = KWriteBackTestSizeSize;
|
sl@0
|
520 |
if(CacheInfo.iMemoryRemapping) dC.iCacheAttr = RCacheTestDevice::E_InnerWB_Remapped;
|
sl@0
|
521 |
else dC.iCacheAttr = RCacheTestDevice::E_InnerWB;
|
sl@0
|
522 |
test(Device.TestWriteBackReadAllocate(dC)==KErrNone);
|
sl@0
|
523 |
if (dC.iSize<KWriteBackTestSizeSize)test.Printf(_L("Inner\tWBWA\tReadAlloc\t%xH\t%xH\tOK\n"), KWriteBackTestSizeSize, dC.iSize);
|
sl@0
|
524 |
else test.Printf(_L("Inner\tWBWA\tReadAlloc\t%xH\t%xH\tWarning: Didn't pass\n"), KWriteBackTestSizeSize, dC.iSize);
|
sl@0
|
525 |
//
|
sl@0
|
526 |
dC.iSize = KWriteBackTestSizeSize;
|
sl@0
|
527 |
if(CacheInfo.iMemoryRemapping) dC.iCacheAttr = RCacheTestDevice::E_InnerWB_Remapped;
|
sl@0
|
528 |
else dC.iCacheAttr = RCacheTestDevice::E_InnerWB;
|
sl@0
|
529 |
test(Device.TestWriteBackWriteAllocate(dC)==KErrNone);
|
sl@0
|
530 |
if (dC.iSize<KWriteBackTestSizeSize)test.Printf(_L("Inner\tWBWA\tWriteAlloc\t%xH\t%xH\tOK\n"), KWriteBackTestSizeSize, dC.iSize);
|
sl@0
|
531 |
else test.Printf(_L("Inner\tWBWA\tWriteAlloc\t%xH\t%xH\tWarning: Didn't pass\n"), KWriteBackTestSizeSize, dC.iSize);
|
sl@0
|
532 |
|
sl@0
|
533 |
if(!CacheInfo.iOuterCache) return;
|
sl@0
|
534 |
|
sl@0
|
535 |
dC.iSize = KWriteBackTestSizeSize;
|
sl@0
|
536 |
if(CacheInfo.iMemoryRemapping) dC.iCacheAttr = RCacheTestDevice::E_OuterWBRA_Remapped;
|
sl@0
|
537 |
else dC.iCacheAttr = RCacheTestDevice::E_OuterWBRA;
|
sl@0
|
538 |
test(Device.TestWriteBackReadAllocate(dC)==KErrNone);
|
sl@0
|
539 |
if (dC.iSize<KWriteBackTestSizeSize)test.Printf(_L("Outer\tWBRA\tReadAlloc\t%xH\t%xH\tOK\n"), KWriteBackTestSizeSize, dC.iSize);
|
sl@0
|
540 |
else test.Printf(_L("Outer\tWBRA\tReadAlloc\t%xH\t%xH\tWarning: Didn't pass\n"), KWriteBackTestSizeSize, dC.iSize);
|
sl@0
|
541 |
//
|
sl@0
|
542 |
dC.iSize = KWriteBackTestSizeSize;
|
sl@0
|
543 |
if(CacheInfo.iMemoryRemapping) dC.iCacheAttr = RCacheTestDevice::E_OuterWB_Remapped;
|
sl@0
|
544 |
else dC.iCacheAttr = RCacheTestDevice::E_OuterWB;
|
sl@0
|
545 |
test(Device.TestWriteBackReadAllocate(dC)==KErrNone);
|
sl@0
|
546 |
if (dC.iSize<KWriteBackTestSizeSize)test.Printf(_L("Outer\tWBWA\tReadAlloc\t%xH\t%xH\tOK\n"), KWriteBackTestSizeSize, dC.iSize);
|
sl@0
|
547 |
else test.Printf(_L("Outer\tWBWA\tReadAlloc\t%xH\t%xH\tWarning: Didn't pass\n"), KWriteBackTestSizeSize, dC.iSize);
|
sl@0
|
548 |
//
|
sl@0
|
549 |
dC.iSize = KWriteBackTestSizeSize;
|
sl@0
|
550 |
if(CacheInfo.iMemoryRemapping) dC.iCacheAttr = RCacheTestDevice::E_OuterWB_Remapped;
|
sl@0
|
551 |
else dC.iCacheAttr = RCacheTestDevice::E_OuterWB;
|
sl@0
|
552 |
test(Device.TestWriteBackWriteAllocate(dC)==KErrNone);
|
sl@0
|
553 |
if (dC.iSize<KWriteBackTestSizeSize)test.Printf(_L("Outer\tWBWA\tWriteAlloc\t%xH\t%xH\tOK\n"), KWriteBackTestSizeSize, dC.iSize);
|
sl@0
|
554 |
else test.Printf(_L("Outer\tWBWA\tWriteAlloc\t%xH\t%xH\tWarning: Didn't pass\n"), KWriteBackTestSizeSize, dC.iSize);
|
sl@0
|
555 |
}
|
sl@0
|
556 |
|
sl@0
|
557 |
|
sl@0
|
558 |
|
sl@0
|
559 |
//---------------------------------------------
|
sl@0
|
560 |
//! @SYMTestCaseID MMU-T_CACHE-07
|
sl@0
|
561 |
//! @SYMTestType UT
|
sl@0
|
562 |
//! @SYMPREQ PREQ305
|
sl@0
|
563 |
//! @SYMREQ REQ5795
|
sl@0
|
564 |
//! @SYMTestCaseDesc Tests Cache Maintanence Functions.
|
sl@0
|
565 |
//! @SYMTestActions Does not do any sort of functional test. Just makes sure nothing panics.
|
sl@0
|
566 |
//! @SYMTestExpectedResults KErrNone
|
sl@0
|
567 |
//! @SYMTestPriority High
|
sl@0
|
568 |
//! @SYMTestStatus Implemented
|
sl@0
|
569 |
//---------------------------------------------
|
sl@0
|
570 |
void Test7()
|
sl@0
|
571 |
{
|
sl@0
|
572 |
test(KErrNone== Device.TestL2Maintenance());
|
sl@0
|
573 |
}
|
sl@0
|
574 |
|
sl@0
|
575 |
// The main function of automatic test.
|
sl@0
|
576 |
void AutoTestL()
|
sl@0
|
577 |
{
|
sl@0
|
578 |
test.Start(_L("Test1: Display cache attributes:"));
|
sl@0
|
579 |
test.Printf(_L("Starting Driver...\n"));
|
sl@0
|
580 |
StartDriver();
|
sl@0
|
581 |
test.Printf(_L("Getting CacheInfo...\n"));
|
sl@0
|
582 |
GetCacheInfo();
|
sl@0
|
583 |
Test1();
|
sl@0
|
584 |
|
sl@0
|
585 |
test.Next(_L("Test2:Thresholds (hex)..."));
|
sl@0
|
586 |
Test2();
|
sl@0
|
587 |
|
sl@0
|
588 |
test.Next(_L("Test3:Setting Cache Thresholds..."));
|
sl@0
|
589 |
Test3();
|
sl@0
|
590 |
|
sl@0
|
591 |
test.Next(_L("Test4: Data chunk test..."));
|
sl@0
|
592 |
test.Printf(_L("chunk size=%xH \n"),KDefaultDataSize);
|
sl@0
|
593 |
Test4(KDefaultDataSize);
|
sl@0
|
594 |
|
sl@0
|
595 |
test.Next(_L("Test5: Code chunk test..."));
|
sl@0
|
596 |
test.Printf(_L("chunk size=%xH \n"),KDefaultCodeSize);
|
sl@0
|
597 |
Test5(KDefaultCodeSize);
|
sl@0
|
598 |
|
sl@0
|
599 |
test.Next(_L("Test6: Testing WriteBack cache mode..."));
|
sl@0
|
600 |
Test6();
|
sl@0
|
601 |
|
sl@0
|
602 |
test.Next(_L("Test7: Testing L2 cache maintenance..."));
|
sl@0
|
603 |
Test7();
|
sl@0
|
604 |
|
sl@0
|
605 |
StopDriver();
|
sl@0
|
606 |
test.End();
|
sl@0
|
607 |
}
|
sl@0
|
608 |
|
sl@0
|
609 |
//////////////////////Manual tests start here///////////////////////////////
|
sl@0
|
610 |
|
sl@0
|
611 |
// Gets the size of the chunk from the command line
|
sl@0
|
612 |
TInt GetSizeFromCommandLine(TBuf<64>& command)
|
sl@0
|
613 |
{
|
sl@0
|
614 |
TUint arg;
|
sl@0
|
615 |
TInt length = command.Length()-5;
|
sl@0
|
616 |
if (length <=0)
|
sl@0
|
617 |
return KErrArgument;
|
sl@0
|
618 |
TPtrC ptr = command.Mid(5,length);
|
sl@0
|
619 |
TLex lex(ptr);
|
sl@0
|
620 |
lex.Val(arg, EHex);
|
sl@0
|
621 |
return arg;
|
sl@0
|
622 |
}
|
sl@0
|
623 |
|
sl@0
|
624 |
/** Invoked by "t_cache info"*/
|
sl@0
|
625 |
void ManualCacheInfo()
|
sl@0
|
626 |
{
|
sl@0
|
627 |
|
sl@0
|
628 |
test.Start(_L("Cache Info:"));
|
sl@0
|
629 |
StartDriver();
|
sl@0
|
630 |
GetCacheInfo();
|
sl@0
|
631 |
Test1();
|
sl@0
|
632 |
test.Printf(_L("Press any key...\n"));
|
sl@0
|
633 |
test.Getch();
|
sl@0
|
634 |
StopDriver();
|
sl@0
|
635 |
test.End();
|
sl@0
|
636 |
return;
|
sl@0
|
637 |
}
|
sl@0
|
638 |
|
sl@0
|
639 |
/** Invoked by "t_cache code threshold [<C> <P> <C> <F>]"*/
|
sl@0
|
640 |
TInt ManualThresholds(TBuf<64>& command)
|
sl@0
|
641 |
{
|
sl@0
|
642 |
TUint arg[4];
|
sl@0
|
643 |
TInt argCurrent=0;
|
sl@0
|
644 |
TInt argStart = 9; //jump over "threshold"
|
sl@0
|
645 |
TInt argEnd;
|
sl@0
|
646 |
TChar c;
|
sl@0
|
647 |
|
sl@0
|
648 |
test.Start(_L("Thresholds:"));
|
sl@0
|
649 |
StartDriver();
|
sl@0
|
650 |
GetCacheInfo();
|
sl@0
|
651 |
|
sl@0
|
652 |
|
sl@0
|
653 |
// Decode input arguments from the command line
|
sl@0
|
654 |
while (argCurrent<4)
|
sl@0
|
655 |
{
|
sl@0
|
656 |
find_arg_start:
|
sl@0
|
657 |
if (argStart >= command.Length()) break;
|
sl@0
|
658 |
c = command[argStart];
|
sl@0
|
659 |
if (c.IsSpace())
|
sl@0
|
660 |
{
|
sl@0
|
661 |
argStart++;
|
sl@0
|
662 |
goto find_arg_start;
|
sl@0
|
663 |
}
|
sl@0
|
664 |
|
sl@0
|
665 |
argEnd = argStart+1;
|
sl@0
|
666 |
find_arg_end:
|
sl@0
|
667 |
if (argEnd >= command.Length()) goto get_arg;
|
sl@0
|
668 |
c = command[argEnd];
|
sl@0
|
669 |
if (c.IsSpace()) goto get_arg;
|
sl@0
|
670 |
argEnd++;
|
sl@0
|
671 |
goto find_arg_end;
|
sl@0
|
672 |
|
sl@0
|
673 |
get_arg:
|
sl@0
|
674 |
TPtrC ptr = command.Mid(argStart,argEnd-argStart);
|
sl@0
|
675 |
TLex lex(ptr);
|
sl@0
|
676 |
lex.Val(arg[argCurrent++], EHex);
|
sl@0
|
677 |
argStart=argEnd;
|
sl@0
|
678 |
}
|
sl@0
|
679 |
|
sl@0
|
680 |
test.Printf(_L("%d argument(s) decoded\n"),argCurrent);
|
sl@0
|
681 |
|
sl@0
|
682 |
RCacheTestDevice::TThresholdInfo info;
|
sl@0
|
683 |
|
sl@0
|
684 |
//If te values are provided in the command line, set thresholds with the given paramaters.
|
sl@0
|
685 |
if (argCurrent == 4)
|
sl@0
|
686 |
{
|
sl@0
|
687 |
test.Printf(_L("Setting thresholds: ...\n"));
|
sl@0
|
688 |
test.Printf(_L("Cache Type:%xh P:%xh C:%xh F:%xh\n"),arg[0], arg[1], arg[2], arg[3]);
|
sl@0
|
689 |
info.iCacheType=arg[0];
|
sl@0
|
690 |
info.iPurge = arg[1];
|
sl@0
|
691 |
info.iClean = arg[2];
|
sl@0
|
692 |
info.iFlush = arg[3];
|
sl@0
|
693 |
TInt r = Device.SetThreshold(info);
|
sl@0
|
694 |
test.Printf(_L("... returned %d\n"),r);
|
sl@0
|
695 |
}
|
sl@0
|
696 |
|
sl@0
|
697 |
//Read thresholds from Kernel.
|
sl@0
|
698 |
test.Printf(_L("Reading thresholds(hex)...\n"));
|
sl@0
|
699 |
Test2();
|
sl@0
|
700 |
|
sl@0
|
701 |
test.Printf(_L("Press any key...\n"));
|
sl@0
|
702 |
test.Getch();
|
sl@0
|
703 |
StopDriver();
|
sl@0
|
704 |
test.End();
|
sl@0
|
705 |
return 0;
|
sl@0
|
706 |
}
|
sl@0
|
707 |
|
sl@0
|
708 |
|
sl@0
|
709 |
/** Invoked by "t_cache data <size>"*/
|
sl@0
|
710 |
void ManualDataTest(TInt aSize)
|
sl@0
|
711 |
{
|
sl@0
|
712 |
StartDriver();
|
sl@0
|
713 |
GetCacheInfo();
|
sl@0
|
714 |
|
sl@0
|
715 |
Test4(aSize);
|
sl@0
|
716 |
|
sl@0
|
717 |
test.Printf(_L("Press any key...\n"));
|
sl@0
|
718 |
test.Getch();
|
sl@0
|
719 |
StopDriver();
|
sl@0
|
720 |
test.End();
|
sl@0
|
721 |
}
|
sl@0
|
722 |
|
sl@0
|
723 |
/** Invoked by "t_cache code <size>"*/
|
sl@0
|
724 |
void ManualCodeTest(TInt aSize)
|
sl@0
|
725 |
{
|
sl@0
|
726 |
StartDriver();
|
sl@0
|
727 |
GetCacheInfo();
|
sl@0
|
728 |
|
sl@0
|
729 |
Test5(aSize);
|
sl@0
|
730 |
|
sl@0
|
731 |
test.Printf(_L("Press any key...\n"));
|
sl@0
|
732 |
test.Getch();
|
sl@0
|
733 |
StopDriver();
|
sl@0
|
734 |
test.End();
|
sl@0
|
735 |
}
|
sl@0
|
736 |
|
sl@0
|
737 |
void DoUseCase(TInt aUseCase, TInt aMaxSize, TInt aLoops )
|
sl@0
|
738 |
{
|
sl@0
|
739 |
RCacheTestDevice::TChunkTest dC(aUseCase, 0x1000, aLoops);
|
sl@0
|
740 |
|
sl@0
|
741 |
TInt time[5];
|
sl@0
|
742 |
|
sl@0
|
743 |
test.Printf(_L("size(H)\tloops\tNormal/NC\tNormal/WT\tFullyCached\n"));
|
sl@0
|
744 |
test.Printf(_L("-------\t-----\t---------\t---------\t-----------\n"));
|
sl@0
|
745 |
|
sl@0
|
746 |
while (dC.iSize<=aMaxSize)
|
sl@0
|
747 |
{
|
sl@0
|
748 |
dC.iCacheAttr = RCacheTestDevice::E_Normal_Cached;
|
sl@0
|
749 |
test(Device.TestUseCase(dC)==KErrNone);
|
sl@0
|
750 |
time[2]=dC.iTime;
|
sl@0
|
751 |
|
sl@0
|
752 |
if(time[2] < 20)
|
sl@0
|
753 |
{dC.iLoops *=2; continue;} //Time too short. Double the loops and try the same chunk size.
|
sl@0
|
754 |
|
sl@0
|
755 |
dC.iCacheAttr = RCacheTestDevice::E_Normal_Uncached;
|
sl@0
|
756 |
test(Device.TestUseCase(dC)==KErrNone);
|
sl@0
|
757 |
time[0]=dC.iTime;
|
sl@0
|
758 |
|
sl@0
|
759 |
if(CacheInfo.iMemoryRemapping) dC.iCacheAttr = RCacheTestDevice::E_InOutWT_Remapped;
|
sl@0
|
760 |
else dC.iCacheAttr = RCacheTestDevice::E_InOutWT;
|
sl@0
|
761 |
test(Device.TestUseCase(dC)==KErrNone);
|
sl@0
|
762 |
time[1]=dC.iTime;
|
sl@0
|
763 |
|
sl@0
|
764 |
|
sl@0
|
765 |
test.Printf(_L("%6xH\t%5d\t%9d\t%9d\t%11d\n"),dC.iSize,dC.iLoops,time[0],time[1],time[2]);
|
sl@0
|
766 |
|
sl@0
|
767 |
if ((time[2] > 100) && (dC.iLoops >= 8))
|
sl@0
|
768 |
dC.iLoops /=2; //Time too long. Half the loops.
|
sl@0
|
769 |
|
sl@0
|
770 |
dC.iSize+=0x1000; // Next chunk size.
|
sl@0
|
771 |
}
|
sl@0
|
772 |
}
|
sl@0
|
773 |
|
sl@0
|
774 |
/** Invoked by "t_cache usecase"*/
|
sl@0
|
775 |
void ManualUseCase()
|
sl@0
|
776 |
{
|
sl@0
|
777 |
test.Start(_L("Use Case manual tests"));
|
sl@0
|
778 |
StartDriver();
|
sl@0
|
779 |
GetCacheInfo();
|
sl@0
|
780 |
|
sl@0
|
781 |
test.Printf(_L("\nUseCase: Read From Chunk\n"));
|
sl@0
|
782 |
DoUseCase(0,Min(CacheInfo.iMaxCacheSize*4, 0x40000),32);
|
sl@0
|
783 |
|
sl@0
|
784 |
test.Printf(_L("\nUseCase: Read From Chunk & Read From Heap\n"));
|
sl@0
|
785 |
DoUseCase(1,Min(CacheInfo.iMaxCacheSize*4, 0x40000),32);
|
sl@0
|
786 |
|
sl@0
|
787 |
test.Printf(_L("\nUseCase: Write To Chunk\n"));
|
sl@0
|
788 |
DoUseCase(2,Min(CacheInfo.iMaxCacheSize*4, 0x40000),32);
|
sl@0
|
789 |
|
sl@0
|
790 |
test.Printf(_L("\nUseCase: Write To Chunk & Read From Heap\n"));
|
sl@0
|
791 |
DoUseCase(3,Min(CacheInfo.iMaxCacheSize*4, 0x40000),32);
|
sl@0
|
792 |
|
sl@0
|
793 |
|
sl@0
|
794 |
test.Printf(_L("Press any key...\n"));
|
sl@0
|
795 |
test.Getch();
|
sl@0
|
796 |
StopDriver();
|
sl@0
|
797 |
test.End();
|
sl@0
|
798 |
}
|
sl@0
|
799 |
|
sl@0
|
800 |
|
sl@0
|
801 |
// Invoked by "t_cache data+<size_hex>"
|
sl@0
|
802 |
void ManualDataTestIncremental(TInt aIncrement)
|
sl@0
|
803 |
{
|
sl@0
|
804 |
TInt time[4];
|
sl@0
|
805 |
TInt r = KErrNone;
|
sl@0
|
806 |
TInt size = aIncrement;
|
sl@0
|
807 |
RCacheTestDevice::TChunkTest dC;
|
sl@0
|
808 |
|
sl@0
|
809 |
StartDriver();
|
sl@0
|
810 |
GetCacheInfo();
|
sl@0
|
811 |
|
sl@0
|
812 |
test.Printf(_L("Chunk\t\tTime(KernelTicks):\n"));
|
sl@0
|
813 |
test.Printf(_L("Size(KB)\tUnCached\tInner\tOuter\tIn&Out\n"));
|
sl@0
|
814 |
|
sl@0
|
815 |
while(size < KMaxChunkSize)
|
sl@0
|
816 |
{
|
sl@0
|
817 |
dC.iSize = size;
|
sl@0
|
818 |
|
sl@0
|
819 |
dC.iCacheAttr = RCacheTestDevice::E_Buffered_C;
|
sl@0
|
820 |
r = Device.TestDataChunk(dC);
|
sl@0
|
821 |
if (r!=KErrNone) break;
|
sl@0
|
822 |
time[0] = dC.iTime;
|
sl@0
|
823 |
|
sl@0
|
824 |
if(CacheInfo.iMemoryRemapping) dC.iCacheAttr = RCacheTestDevice::E_InnerWB_Remapped;
|
sl@0
|
825 |
else dC.iCacheAttr = RCacheTestDevice::E_InnerWB;
|
sl@0
|
826 |
r = Device.TestDataChunk(dC);
|
sl@0
|
827 |
if (r!=KErrNone) break;
|
sl@0
|
828 |
time[1] = dC.iTime;
|
sl@0
|
829 |
|
sl@0
|
830 |
if(CacheInfo.iOuterCache)
|
sl@0
|
831 |
{
|
sl@0
|
832 |
if(CacheInfo.iMemoryRemapping) dC.iCacheAttr = RCacheTestDevice::E_OuterWB_Remapped;
|
sl@0
|
833 |
else dC.iCacheAttr = RCacheTestDevice::E_OuterWB;
|
sl@0
|
834 |
r = Device.TestDataChunk(dC);
|
sl@0
|
835 |
if (r!=KErrNone) break;
|
sl@0
|
836 |
time[2] = dC.iTime;
|
sl@0
|
837 |
|
sl@0
|
838 |
dC.iCacheAttr = RCacheTestDevice::E_InOutWB;
|
sl@0
|
839 |
r = Device.TestDataChunk(dC);
|
sl@0
|
840 |
if (r!=KErrNone) break;
|
sl@0
|
841 |
time[3] = dC.iTime;
|
sl@0
|
842 |
}
|
sl@0
|
843 |
else
|
sl@0
|
844 |
{
|
sl@0
|
845 |
time[2]= time[3]=0;
|
sl@0
|
846 |
}
|
sl@0
|
847 |
test.Printf(_L("%d\t%d\t%d\t%d\t%d\n"),size/0x400, time[0],time[1],time[2],time[3]);
|
sl@0
|
848 |
size += aIncrement;
|
sl@0
|
849 |
}
|
sl@0
|
850 |
|
sl@0
|
851 |
test.Printf(_L("The test exited with %d\n"), r);
|
sl@0
|
852 |
test.Printf(_L("Press any key...\n"));
|
sl@0
|
853 |
test.Getch();
|
sl@0
|
854 |
StopDriver();
|
sl@0
|
855 |
test.End();
|
sl@0
|
856 |
}
|
sl@0
|
857 |
|
sl@0
|
858 |
// Invoked by "t_cache code+<size_hex>"
|
sl@0
|
859 |
void ManualCodeTestIncremental(TInt aIncrement)
|
sl@0
|
860 |
{
|
sl@0
|
861 |
TInt time[4];
|
sl@0
|
862 |
TInt r = KErrNone;
|
sl@0
|
863 |
TInt size = aIncrement;
|
sl@0
|
864 |
RCacheTestDevice::TChunkTest dC;
|
sl@0
|
865 |
|
sl@0
|
866 |
StartDriver();
|
sl@0
|
867 |
GetCacheInfo();
|
sl@0
|
868 |
|
sl@0
|
869 |
test.Printf(_L("Chunk\t\tTime(KernelTicks):\n"));
|
sl@0
|
870 |
test.Printf(_L("Size(KB)\tUnCached\tInner\tOuter\tIn&Out\n"));
|
sl@0
|
871 |
|
sl@0
|
872 |
while(size < KMaxChunkSize)
|
sl@0
|
873 |
{
|
sl@0
|
874 |
TempBuff.SetLength(0);
|
sl@0
|
875 |
|
sl@0
|
876 |
dC.iSize = size;
|
sl@0
|
877 |
|
sl@0
|
878 |
dC.iCacheAttr = RCacheTestDevice::E_Buffered_C;
|
sl@0
|
879 |
r = Device.TestCodeChunk(dC);
|
sl@0
|
880 |
if (r!=KErrNone) break;
|
sl@0
|
881 |
time[0] = dC.iTime;
|
sl@0
|
882 |
|
sl@0
|
883 |
if(CacheInfo.iMemoryRemapping) dC.iCacheAttr = RCacheTestDevice::E_InnerWB_Remapped;
|
sl@0
|
884 |
else dC.iCacheAttr = RCacheTestDevice::E_InnerWB;
|
sl@0
|
885 |
r = Device.TestCodeChunk(dC);
|
sl@0
|
886 |
if (r!=KErrNone) break;
|
sl@0
|
887 |
time[1] = dC.iTime;
|
sl@0
|
888 |
|
sl@0
|
889 |
if(CacheInfo.iOuterCache)
|
sl@0
|
890 |
{
|
sl@0
|
891 |
if(CacheInfo.iMemoryRemapping) dC.iCacheAttr = RCacheTestDevice::E_OuterWB_Remapped;
|
sl@0
|
892 |
else dC.iCacheAttr = RCacheTestDevice::E_OuterWB;
|
sl@0
|
893 |
r = Device.TestCodeChunk(dC);
|
sl@0
|
894 |
if (r!=KErrNone) break;
|
sl@0
|
895 |
time[2] = dC.iTime;
|
sl@0
|
896 |
//
|
sl@0
|
897 |
dC.iCacheAttr = RCacheTestDevice::E_InOutWB;
|
sl@0
|
898 |
r = Device.TestCodeChunk(dC);
|
sl@0
|
899 |
if (r!=KErrNone) break;
|
sl@0
|
900 |
time[3] = dC.iTime;
|
sl@0
|
901 |
}
|
sl@0
|
902 |
else
|
sl@0
|
903 |
{
|
sl@0
|
904 |
time[2]=time[3] = 0;
|
sl@0
|
905 |
}
|
sl@0
|
906 |
|
sl@0
|
907 |
test.Printf(_L("%d\t%d\t%d\t%d\t%d\n"),size/0x400, time[0],time[1],time[2],time[3]);
|
sl@0
|
908 |
size += aIncrement;
|
sl@0
|
909 |
}
|
sl@0
|
910 |
|
sl@0
|
911 |
test.Printf(_L("The test exited with %d\n"), r);
|
sl@0
|
912 |
test.Printf(_L("Press any key...\n"));
|
sl@0
|
913 |
test.Getch();
|
sl@0
|
914 |
StopDriver();
|
sl@0
|
915 |
test.End();
|
sl@0
|
916 |
}
|
sl@0
|
917 |
|
sl@0
|
918 |
TInt E32Main()
|
sl@0
|
919 |
{
|
sl@0
|
920 |
|
sl@0
|
921 |
TBuf<64> c;
|
sl@0
|
922 |
TInt size;
|
sl@0
|
923 |
User::CommandLine(c);
|
sl@0
|
924 |
if (c.FindF(KPrintCacheInfos) >= 0) {ManualCacheInfo(); return 0;}
|
sl@0
|
925 |
if (c.FindF(KUseCase) >= 0) {ManualUseCase(); return 0;}
|
sl@0
|
926 |
if (c.FindF(KThreshold) >= 0) {ManualThresholds(c); return 0;}
|
sl@0
|
927 |
|
sl@0
|
928 |
if (c.FindF(KTestData) >= 0)
|
sl@0
|
929 |
{
|
sl@0
|
930 |
test.Start(_L("Data Chunk"));
|
sl@0
|
931 |
size = GetSizeFromCommandLine(c);
|
sl@0
|
932 |
// Always round up the size to 1K boundary (because of DataSegmetTestFunct)
|
sl@0
|
933 |
size +=0x3ff; size &=~0x3ff;
|
sl@0
|
934 |
|
sl@0
|
935 |
if (c.FindF(KIncremental) >= 0)
|
sl@0
|
936 |
{
|
sl@0
|
937 |
// Invoked by "t_cache data+<size>"
|
sl@0
|
938 |
test.Printf(_L(" size + %xH\n"),size);
|
sl@0
|
939 |
if (size<=0)
|
sl@0
|
940 |
return KErrArgument;
|
sl@0
|
941 |
ManualDataTestIncremental(size);
|
sl@0
|
942 |
}
|
sl@0
|
943 |
else
|
sl@0
|
944 |
{
|
sl@0
|
945 |
// Invoked by "t_cache data <size>"
|
sl@0
|
946 |
test.Printf(_L("chunk size %xH\n"),size);
|
sl@0
|
947 |
if (size<=0)
|
sl@0
|
948 |
return KErrArgument;
|
sl@0
|
949 |
ManualDataTest(size);
|
sl@0
|
950 |
}
|
sl@0
|
951 |
return 0;
|
sl@0
|
952 |
}
|
sl@0
|
953 |
|
sl@0
|
954 |
if (c.FindF(KTestCode) >= 0)
|
sl@0
|
955 |
{
|
sl@0
|
956 |
test.Start(_L("Code Chunk"));
|
sl@0
|
957 |
size = GetSizeFromCommandLine(c);
|
sl@0
|
958 |
// Always round up the size to 1K boundary
|
sl@0
|
959 |
size +=0x3ff; size &=~0x3ff;
|
sl@0
|
960 |
if (c.FindF(KIncremental) >= 0)
|
sl@0
|
961 |
{
|
sl@0
|
962 |
// Invoked by "t_cache code+<size>"
|
sl@0
|
963 |
test.Printf(_L(" size + %xH\n"),size);
|
sl@0
|
964 |
if (size<=0)
|
sl@0
|
965 |
return KErrArgument;
|
sl@0
|
966 |
ManualCodeTestIncremental(size);
|
sl@0
|
967 |
}
|
sl@0
|
968 |
else
|
sl@0
|
969 |
{
|
sl@0
|
970 |
// Invoked by "t_cache code <size>"
|
sl@0
|
971 |
test.Printf(_L("chunk size %xH\n"),size);
|
sl@0
|
972 |
if (size<=0)
|
sl@0
|
973 |
return KErrArgument;
|
sl@0
|
974 |
ManualCodeTest(size);
|
sl@0
|
975 |
}
|
sl@0
|
976 |
return 0;
|
sl@0
|
977 |
}
|
sl@0
|
978 |
|
sl@0
|
979 |
if (c.FindF(KHelp) >= 0)
|
sl@0
|
980 |
{
|
sl@0
|
981 |
// Invoked by "t_cache help"
|
sl@0
|
982 |
test.Start(_L("t_cache usage:\n"));
|
sl@0
|
983 |
test.Printf(_L("t_cache info\n"));
|
sl@0
|
984 |
test.Printf(_L("t_cache data <size_hex>\n"));
|
sl@0
|
985 |
test.Printf(_L("t_cache code <size_hex>\n"));
|
sl@0
|
986 |
test.Printf(_L("t_cache data+<size_hex>\n"));
|
sl@0
|
987 |
test.Printf(_L("t_cache code+<size_hex>\n"));
|
sl@0
|
988 |
test.Printf(_L("t_cache usecase\n\n"));
|
sl@0
|
989 |
test.Printf(_L("t_cache threshold [<cache> <purge> <clean> <flush>]\n\n"));
|
sl@0
|
990 |
test.Printf(_L("... where <cache>= 1,2,4,8 or 10\n\n"));
|
sl@0
|
991 |
test.Printf(_L("Press any key...\n"));
|
sl@0
|
992 |
test.Getch();
|
sl@0
|
993 |
test.End();
|
sl@0
|
994 |
return 0;
|
sl@0
|
995 |
}
|
sl@0
|
996 |
|
sl@0
|
997 |
|
sl@0
|
998 |
// auto test starts here
|
sl@0
|
999 |
CTrapCleanup* trap = CTrapCleanup::New();
|
sl@0
|
1000 |
if (!trap)
|
sl@0
|
1001 |
return KErrNoMemory;
|
sl@0
|
1002 |
test.Title();
|
sl@0
|
1003 |
__UHEAP_MARK;
|
sl@0
|
1004 |
TRAPD(r,AutoTestL());
|
sl@0
|
1005 |
__UHEAP_MARKEND;
|
sl@0
|
1006 |
delete trap;
|
sl@0
|
1007 |
return r;
|
sl@0
|
1008 |
}
|