56
|
1 |
// Copyright (c) 2010 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 |
// Tests performance of run mode debug device component
|
|
15 |
//
|
|
16 |
|
|
17 |
#include <e32base.h>
|
|
18 |
#include <e32property.h>
|
|
19 |
#include <e32test.h>
|
|
20 |
#include <e32def.h>
|
|
21 |
#include <e32const.h>
|
|
22 |
#include <hal.h>
|
|
23 |
|
|
24 |
#include "t_rmdebug_performance_test.h"
|
|
25 |
#include "t_debug_logging.h"
|
|
26 |
#include "t_rmdebug_app.h"
|
|
27 |
|
|
28 |
const TVersion securityServerVersion(0,1,1);
|
|
29 |
|
|
30 |
_LIT(KTestName, "T_RMDEBUG_PERFORMANCE_TEST");
|
|
31 |
|
|
32 |
LOCAL_D RTest test(KTestName);
|
|
33 |
|
|
34 |
using namespace Debug;
|
|
35 |
|
|
36 |
CRunModeAgent* CRunModeAgent::NewL()
|
|
37 |
{
|
|
38 |
LOG_ENTRY();
|
|
39 |
CRunModeAgent* self = new(ELeave) CRunModeAgent();
|
|
40 |
self->ConstructL();
|
|
41 |
LOG_EXIT();
|
|
42 |
return self;
|
|
43 |
}
|
|
44 |
|
|
45 |
void CRunModeAgent::ConstructL()
|
|
46 |
{
|
|
47 |
// ConstructL list does not match destruction list as R-Class member variables are implicitly open.
|
|
48 |
// DebugDriver().Connect() is conditionally set depending on the test case hence not part of this function.
|
|
49 |
LOG_ENTRY();
|
|
50 |
User::LeaveIfError(iIntegerProperty.Attach(RProcess().SecureId(), EPropertyTimeOfCrash, EOwnerThread));
|
|
51 |
LOG_EXIT();
|
|
52 |
}
|
|
53 |
|
|
54 |
CRunModeAgent::~CRunModeAgent()
|
|
55 |
{
|
|
56 |
LOG_ENTRY();
|
|
57 |
DebugDriver().Close();
|
|
58 |
iTimeDifs.Close();
|
|
59 |
iIntegerProperty.Close();
|
|
60 |
RProperty::Delete(EPropertyTimeOfCrash);
|
|
61 |
LOG_EXIT();
|
|
62 |
}
|
|
63 |
|
|
64 |
|
|
65 |
void CRunModeAgent::ClientAppL()
|
|
66 |
{
|
|
67 |
LOG_ENTRY();
|
|
68 |
|
|
69 |
if ( ParseCommandLine() == EDisplayHelp )
|
|
70 |
{
|
|
71 |
DisplayUsage();
|
|
72 |
}
|
|
73 |
else
|
|
74 |
{
|
|
75 |
static _LIT_SECURITY_POLICY_PASS(KAllowAllPolicy);
|
|
76 |
RProperty::Define(RProcess().SecureId(), EPropertyTimeOfCrash, RProperty::EInt, KAllowAllPolicy, KAllowAllPolicy);
|
|
77 |
StartTest();
|
|
78 |
}
|
|
79 |
|
|
80 |
LOG_EXIT();
|
|
81 |
}
|
|
82 |
|
|
83 |
TInt CRunModeAgent::GetTimeInMs()
|
|
84 |
{
|
|
85 |
return User::NTickCount() * iTickPeriodMs;
|
|
86 |
}
|
|
87 |
|
|
88 |
void CRunModeAgent::GetStartTime()
|
|
89 |
{
|
|
90 |
LOG_ENTRY();
|
|
91 |
|
|
92 |
test ( KErrNone == iIntegerProperty.Get(iParams.iCountStart) );
|
|
93 |
LOG_MSG2("iParams.iCountStart %d", iParams.iCountStart);
|
|
94 |
|
|
95 |
LOG_EXIT();
|
|
96 |
}
|
|
97 |
|
|
98 |
void CRunModeAgent::GetNanoTickPeriod()
|
|
99 |
{
|
|
100 |
LOG_ENTRY();
|
|
101 |
|
|
102 |
TInt period = 0;
|
|
103 |
User::LeaveIfError(HAL::Get(HALData::ENanoTickPeriod, period));
|
|
104 |
iTickPeriodMs = period / 1000;
|
|
105 |
LOG_MSG("iTickPeriodMs = %d\n", iTickPeriodMs);
|
|
106 |
|
|
107 |
LOG_EXIT();
|
|
108 |
}
|
|
109 |
|
|
110 |
void CRunModeAgent::StartTest()
|
|
111 |
{
|
|
112 |
LOG_ENTRY();
|
|
113 |
|
|
114 |
GetNanoTickPeriod();
|
|
115 |
|
|
116 |
if (iParams.iTestType == PerformanceTestParams::EBenchMarkTest)
|
|
117 |
{
|
|
118 |
RunBenchMarkTest();
|
|
119 |
}
|
|
120 |
else
|
|
121 |
{
|
|
122 |
TestDriverPerformance();
|
|
123 |
}
|
|
124 |
|
|
125 |
CalculatePerformance();
|
|
126 |
|
|
127 |
LOG_EXIT();
|
|
128 |
}
|
|
129 |
|
|
130 |
// This function allows us to provide a benchmark when comparing the performance with the
|
|
131 |
// old and new APIs using the TestDriverPerformance function below. The two possible
|
|
132 |
// configurations are as follows:
|
|
133 |
// 1. Run t_rmdebug_app with a prefetch abort configuration and measure the time from the
|
|
134 |
// point of crash to the logon request completion.
|
|
135 |
// 2. Load the debug-system and then run the above configuration.
|
|
136 |
void CRunModeAgent::RunBenchMarkTest()
|
|
137 |
{
|
|
138 |
LOG_ENTRY();
|
|
139 |
|
|
140 |
test.Start(_L("RunBenchMarkTest"));
|
|
141 |
|
|
142 |
RProcess process;
|
|
143 |
TRequestStatus status;
|
|
144 |
|
|
145 |
if (iParams.iDriver)
|
|
146 |
{
|
|
147 |
RDebug::Printf("RunBenchMarkTest() - DebugDriver().Connect()");
|
|
148 |
test(KErrNone == DebugDriver().Connect(securityServerVersion));
|
|
149 |
}
|
|
150 |
|
|
151 |
LOG_MSG("iParams.iNumOfTestRuns = %d", iParams.iNumOfTestRuns);
|
|
152 |
|
|
153 |
for ( TUint i = 0; i < iParams.iNumOfTestRuns; i++ )
|
|
154 |
{
|
|
155 |
// Start test application
|
|
156 |
test( KErrNone == LaunchProcessL(process, KRMDebugTestApplication(), KTargetOptions()) );
|
|
157 |
|
|
158 |
process.Logon(status);
|
|
159 |
User::WaitForRequest(status);
|
|
160 |
|
|
161 |
// Stop timer on logon request completion
|
|
162 |
iParams.iCountEnd = GetTimeInMs();
|
|
163 |
LOG_MSG("iParams.iCountEnd = %d", iParams.iCountEnd);
|
|
164 |
|
|
165 |
LOG_MSG( "status.Int() = %d " , status.Int() );
|
|
166 |
|
|
167 |
// prefetch abort should raise a KERN-EXEC 3
|
|
168 |
test(3 == status.Int());
|
|
169 |
|
|
170 |
process.Close();
|
|
171 |
GetStartTime();
|
|
172 |
|
|
173 |
// NTickCount shouldn't overflow, so no reason why this assertion should fail
|
|
174 |
test(iParams.iCountEnd > iParams.iCountStart);
|
|
175 |
iTimeDifs.Append( iParams.iCountEnd - iParams.iCountStart );
|
|
176 |
}
|
|
177 |
|
|
178 |
LOG_EXIT();
|
|
179 |
}
|
|
180 |
|
|
181 |
// This function can be used to compare the performance with the old (e.g. attachExe) and new
|
|
182 |
// (e.g. attachAll) APIs depending depending on the parameters passed in when running this test.
|
|
183 |
void CRunModeAgent::TestDriverPerformance()
|
|
184 |
{
|
|
185 |
LOG_ENTRY();
|
|
186 |
test.Start(_L("TestDriverPerformance"));
|
|
187 |
|
|
188 |
RProcess process;
|
|
189 |
|
|
190 |
test(KErrNone == DebugDriver().Connect(securityServerVersion));
|
|
191 |
|
|
192 |
LOG_MSG("iParams.iNumOfTestRuns = %d", iParams.iNumOfTestRuns);
|
|
193 |
for ( TUint i = 0; i < iParams.iNumOfTestRuns; i++ )
|
|
194 |
{
|
|
195 |
ilaunchCompleted = EFalse;
|
|
196 |
|
|
197 |
Attach();
|
|
198 |
SetEventAction();
|
|
199 |
test(KErrNone == LaunchProcessL(process, KRMDebugTestApplication(), KTargetOptions));
|
|
200 |
|
|
201 |
LOG_MSG("CRunModeAgent::TestDriverPerformance - process.Logon");
|
|
202 |
|
|
203 |
while ( !ilaunchCompleted )
|
|
204 |
{
|
|
205 |
LOG_MSG("CRunModeAgent::TestDriverPerformance - DebugDriver().GetEvent");
|
|
206 |
|
|
207 |
GetEvent();
|
|
208 |
|
|
209 |
LOG_MSG("CRunModeAgent::TestDriverPerformance - User::WaitForRequest");
|
|
210 |
|
|
211 |
User::WaitForRequest(iStatus);
|
|
212 |
LOG_MSG( "iStatus.Int() = %d " , iStatus.Int() );
|
|
213 |
|
|
214 |
LOG_MSG("CRunModeAgent::TestDriverPerformance - HandleEvent");
|
|
215 |
HandleEvent(iSEventInfo.iEventInfo);
|
|
216 |
}
|
|
217 |
|
|
218 |
process.Logon(iStatus);
|
|
219 |
LOG_MSG("CRunModeAgent::TestDriverPerformance - process.Logon, User::WaitForRequest");
|
|
220 |
User::WaitForRequest(iStatus);
|
|
221 |
LOG_MSG( "iStatus.Int() = %d " , iStatus.Int() );
|
|
222 |
|
|
223 |
// Stop timer on logon request completion as in benchmark performance test
|
|
224 |
iParams.iCountEnd = GetTimeInMs();
|
|
225 |
|
|
226 |
// prefetch abort should raise a KERN-EXEC 3
|
|
227 |
test(3 == iStatus.Int());
|
|
228 |
|
|
229 |
Detach();
|
|
230 |
process.Close();
|
|
231 |
GetStartTime();
|
|
232 |
|
|
233 |
// NTickCount shouldn't overflow, so no reason why this assertion should fail
|
|
234 |
test(iParams.iCountEnd > iParams.iCountStart);
|
|
235 |
iTimeDifs.Append( iParams.iCountEnd - iParams.iCountStart );
|
|
236 |
}
|
|
237 |
|
|
238 |
LOG_EXIT();
|
|
239 |
}
|
|
240 |
|
|
241 |
void CRunModeAgent::CalculatePerformance()
|
|
242 |
{
|
|
243 |
LOG_ENTRY();
|
|
244 |
|
|
245 |
TUint median;
|
|
246 |
TUint arrayCount = iTimeDifs.Count();
|
|
247 |
|
|
248 |
for (TInt i = 0; i < arrayCount; i++)
|
|
249 |
{
|
|
250 |
RDebug::Printf("iTimeDifs[%d] = %d ",i,iTimeDifs[i]);
|
|
251 |
}
|
|
252 |
|
|
253 |
// Sort in ascending order
|
|
254 |
iTimeDifs.Sort();
|
|
255 |
|
|
256 |
//If the number of elements is odd, the middle element in the sorted array is the median.
|
|
257 |
//If the number of elements is even, the median is the average of the two midmost elements.
|
|
258 |
if ( arrayCount%2 != 0 )
|
|
259 |
{
|
|
260 |
median = iTimeDifs[arrayCount/2];
|
|
261 |
}
|
|
262 |
else
|
|
263 |
{
|
|
264 |
median = (iTimeDifs[arrayCount/2] + iTimeDifs[arrayCount/2 -1])/2;
|
|
265 |
}
|
|
266 |
|
|
267 |
RDebug::Printf("Median time %d ms", median );
|
|
268 |
|
|
269 |
LOG_EXIT();
|
|
270 |
}
|
|
271 |
|
|
272 |
/**
|
|
273 |
Launch a process
|
|
274 |
@param aExeName the executable used to create the process
|
|
275 |
@param aCommandLine the commandline parameters passed to the new process file name of the executable used to create the process
|
|
276 |
@return KErrNone on success, or one of the other system wide error codes
|
|
277 |
*/
|
|
278 |
TInt CRunModeAgent::LaunchProcessL( RProcess& aProcess, const TDesC& aExeName, const TDesC& aCommandLine )
|
|
279 |
{
|
|
280 |
LOG_ENTRY();
|
|
281 |
|
|
282 |
RBuf launcherOptions;
|
|
283 |
launcherOptions.CleanupClosePushL();
|
|
284 |
const TInt additionalWords = 1;
|
|
285 |
launcherOptions.CreateL( aCommandLine.Length() + additionalWords );
|
|
286 |
launcherOptions.Format( aCommandLine, iParams.iTestTargetPriority);
|
|
287 |
|
|
288 |
LOG_DES(_L("launcherOptions %S"), &launcherOptions);
|
|
289 |
|
|
290 |
TInt err = aProcess.Create( aExeName, launcherOptions );
|
|
291 |
CleanupStack::PopAndDestroy();
|
|
292 |
|
|
293 |
// check that there was no error raised
|
|
294 |
if (err != KErrNone)
|
|
295 |
return err;
|
|
296 |
|
|
297 |
// rendezvous with process
|
|
298 |
TRequestStatus status = KRequestPending;
|
|
299 |
aProcess.Rendezvous(status);
|
|
300 |
|
|
301 |
// start the test target
|
|
302 |
aProcess.Resume();
|
|
303 |
User::WaitForRequest(status);
|
|
304 |
|
|
305 |
if(KErrNone != status.Int())
|
|
306 |
{
|
|
307 |
aProcess.Kill(KErrNone);
|
|
308 |
}
|
|
309 |
LOG_EXIT();
|
|
310 |
return status.Int();
|
|
311 |
|
|
312 |
}
|
|
313 |
|
|
314 |
void CRunModeAgent::SetEventAction()
|
|
315 |
{
|
|
316 |
LOG_ENTRY();
|
|
317 |
|
|
318 |
if (iParams.iTestType == PerformanceTestParams::EAttachExe)
|
|
319 |
{
|
|
320 |
test(KErrNone == DebugDriver().SetEventAction( KRMDebugTestApplication(), EEventsKillThread, EActionContinue));
|
|
321 |
|
|
322 |
if ( iParams.iEvents )
|
|
323 |
{
|
|
324 |
test(KErrNone == DebugDriver().SetEventAction( KRMDebugTestApplication(), EEventsAddLibrary, EActionContinue));
|
|
325 |
test(KErrNone == DebugDriver().SetEventAction( KRMDebugTestApplication(), EEventsUserTrace, EActionContinue));
|
|
326 |
test(KErrNone == DebugDriver().SetEventAction( KRMDebugTestApplication(), EEventsStartThread, EActionContinue));
|
|
327 |
test(KErrNone == DebugDriver().SetEventAction( KRMDebugTestApplication(), EEventsAddProcess, EActionContinue));
|
|
328 |
test(KErrNone == DebugDriver().SetEventAction( KRMDebugTestApplication(), EEventsRemoveProcess, EActionContinue));
|
|
329 |
}
|
|
330 |
}
|
|
331 |
else
|
|
332 |
{
|
|
333 |
test(KErrNone == DebugDriver().SetEventAction( EEventsKillThread, EActionContinue));
|
|
334 |
|
|
335 |
if ( iParams.iEvents )
|
|
336 |
{
|
|
337 |
test(KErrNone == DebugDriver().SetEventAction( EEventsAddLibrary, EActionContinue));
|
|
338 |
test(KErrNone == DebugDriver().SetEventAction( EEventsUserTrace, EActionContinue));
|
|
339 |
test(KErrNone == DebugDriver().SetEventAction( EEventsStartThread, EActionContinue));
|
|
340 |
test(KErrNone == DebugDriver().SetEventAction( EEventsAddProcess, EActionContinue));
|
|
341 |
test(KErrNone == DebugDriver().SetEventAction( EEventsRemoveProcess, EActionContinue));
|
|
342 |
}
|
|
343 |
}
|
|
344 |
|
|
345 |
LOG_EXIT();
|
|
346 |
}
|
|
347 |
|
|
348 |
void CRunModeAgent::Attach()
|
|
349 |
{
|
|
350 |
LOG_ENTRY();
|
|
351 |
|
|
352 |
if( iParams.iTestType == PerformanceTestParams::EAttachExe )
|
|
353 |
{
|
|
354 |
// Attach to process non-passively
|
|
355 |
test(KErrNone == DebugDriver().AttachExecutable( KRMDebugTestApplication(), EFalse));
|
|
356 |
LOG_MSG("DebugDriver().AttachExecutable");
|
|
357 |
}
|
|
358 |
else
|
|
359 |
{
|
|
360 |
// Attach to all the processes on the system
|
|
361 |
test(KErrNone == DebugDriver().AttachAll());
|
|
362 |
LOG_MSG("DebugDriver().AttachAll()");
|
|
363 |
}
|
|
364 |
|
|
365 |
LOG_EXIT();
|
|
366 |
}
|
|
367 |
|
|
368 |
void CRunModeAgent::GetEvent()
|
|
369 |
{
|
|
370 |
LOG_ENTRY();
|
|
371 |
|
|
372 |
if( iParams.iTestType == PerformanceTestParams::EAttachExe )
|
|
373 |
{
|
|
374 |
DebugDriver().GetEvent( KRMDebugTestApplication(), iStatus, iSEventInfo.iEventInfoBuf );
|
|
375 |
}
|
|
376 |
else
|
|
377 |
{
|
|
378 |
DebugDriver().GetEvent( iStatus, iSEventInfo.iEventInfoBuf );
|
|
379 |
}
|
|
380 |
|
|
381 |
LOG_EXIT();
|
|
382 |
}
|
|
383 |
|
|
384 |
void CRunModeAgent::Detach()
|
|
385 |
{
|
|
386 |
LOG_ENTRY();
|
|
387 |
|
|
388 |
if( iParams.iTestType == PerformanceTestParams::EAttachExe )
|
|
389 |
{
|
|
390 |
test (KErrNone == DebugDriver().DetachExecutable(KRMDebugTestApplication()));
|
|
391 |
}
|
|
392 |
else
|
|
393 |
{
|
|
394 |
test(KErrNone == DebugDriver().DetachAll());
|
|
395 |
}
|
|
396 |
|
|
397 |
LOG_EXIT();
|
|
398 |
}
|
|
399 |
|
|
400 |
void CRunModeAgent::HandleEvent(TEventInfo& aEventInfo)
|
|
401 |
{
|
|
402 |
LOG_ENTRY();
|
|
403 |
|
|
404 |
switch ( aEventInfo.iEventType )
|
|
405 |
{
|
|
406 |
case EEventsAddProcess:
|
|
407 |
{
|
|
408 |
LOG_MSG(">>> EEventsAddProcess");
|
|
409 |
break;
|
|
410 |
}
|
|
411 |
|
|
412 |
case EEventsStartThread:
|
|
413 |
{
|
|
414 |
LOG_MSG(">>> EEventsStartThread");
|
|
415 |
break;
|
|
416 |
}
|
|
417 |
|
|
418 |
case EEventsUserTrace:
|
|
419 |
{
|
|
420 |
LOG_MSG(">>> EEventsUserTrace");
|
|
421 |
break;
|
|
422 |
}
|
|
423 |
|
|
424 |
case EEventsRemoveProcess:
|
|
425 |
{
|
|
426 |
LOG_MSG(">>> EEventsRemoveProcess");
|
|
427 |
break;
|
|
428 |
}
|
|
429 |
|
|
430 |
case EEventsKillThread:
|
|
431 |
{
|
|
432 |
LOG_MSG(">>> EEventsKillThread");
|
|
433 |
ilaunchCompleted = ETrue;
|
|
434 |
break;
|
|
435 |
}
|
|
436 |
|
|
437 |
default:
|
|
438 |
{
|
|
439 |
LOG_MSG( ">>> Unknown event ");
|
|
440 |
break;
|
|
441 |
}
|
|
442 |
}
|
|
443 |
|
|
444 |
LOG_EXIT();
|
|
445 |
}
|
|
446 |
|
|
447 |
void CRunModeAgent::SetDefaultParamValues()
|
|
448 |
{
|
|
449 |
LOG_ENTRY();
|
|
450 |
|
|
451 |
iParams.iNumOfTestRuns = KNumOfTestRuns;
|
|
452 |
iParams.iTestType = PerformanceTestParams::EBenchMarkTest;
|
|
453 |
iParams.iTestTargetPriority = 0;
|
|
454 |
iParams.iEvents = 0;
|
|
455 |
iParams.iDriver = 0;
|
|
456 |
|
|
457 |
LOG_EXIT();
|
|
458 |
}
|
|
459 |
|
|
460 |
TInt CRunModeAgent::ParseCommandLine()
|
|
461 |
{
|
|
462 |
LOG_ENTRY();
|
|
463 |
|
|
464 |
TBool ifDisplayHelp = EDontDisplayHelp;
|
|
465 |
SetDefaultParamValues();
|
|
466 |
|
|
467 |
TInt argc = User::CommandLineLength();
|
|
468 |
LOG_MSG( "Launcher Process() argc=%d", argc );
|
|
469 |
|
|
470 |
if( argc )
|
|
471 |
{
|
|
472 |
HBufC* commandLine = NULL;
|
|
473 |
commandLine = HBufC::NewLC(argc);
|
|
474 |
TPtr commandLineBuffer = commandLine->Des();
|
|
475 |
User::CommandLine(commandLineBuffer);
|
|
476 |
|
|
477 |
LOG_DES(_L("CommandLine = %S"), &commandLineBuffer);
|
|
478 |
|
|
479 |
// create a lexer and read through the command line
|
|
480 |
TLex lex(*commandLine);
|
|
481 |
while (!lex.Eos())
|
|
482 |
{
|
|
483 |
// only look for options with first character '-', other switches are for the targets
|
|
484 |
if (lex.Get() == '-')
|
|
485 |
{
|
|
486 |
TChar arg = lex.Get();
|
|
487 |
switch (arg)
|
|
488 |
{
|
|
489 |
case 'n':
|
|
490 |
lex.Val( iParams.iNumOfTestRuns );
|
|
491 |
LOG_MSG("Number of test runs %d", iParams.iNumOfTestRuns);
|
|
492 |
break;
|
|
493 |
case 't':
|
|
494 |
lex.Val( iParams.iTestType );
|
|
495 |
LOG_MSG("parsed testType as %d", iParams.iTestType );
|
|
496 |
break;
|
|
497 |
case 'p':
|
|
498 |
lex.Val( iParams.iTestTargetPriority );
|
|
499 |
LOG_MSG("parsed test target priority as %d", iParams.iTestTargetPriority );
|
|
500 |
break;
|
|
501 |
case 'e':
|
|
502 |
lex.Val( iParams.iEvents );
|
|
503 |
LOG_MSG("parsed events as %d", iParams.iEvents );
|
|
504 |
break;
|
|
505 |
case 'd':
|
|
506 |
lex.Val( iParams.iDriver );
|
|
507 |
LOG_MSG("parsed iDriver as %d", iParams.iDriver );
|
|
508 |
break;
|
|
509 |
case 'h':
|
|
510 |
LOG_MSG( "Display help" );
|
|
511 |
ifDisplayHelp = EDisplayHelp;
|
|
512 |
default:
|
|
513 |
LOG_MSG( "Default usage" );
|
|
514 |
break;
|
|
515 |
}
|
|
516 |
}
|
|
517 |
}
|
|
518 |
CleanupStack::PopAndDestroy(commandLine);
|
|
519 |
}
|
|
520 |
|
|
521 |
LOG_EXIT();
|
|
522 |
return ifDisplayHelp;
|
|
523 |
}
|
|
524 |
|
|
525 |
void CRunModeAgent::DisplayUsage()
|
|
526 |
{
|
|
527 |
LOG_ENTRY();
|
|
528 |
test.Printf(_L("\nUsage: t_rmdebug_performance_test [options] \nOptions:\n"));
|
|
529 |
|
|
530 |
test.Printf(_L("\t-t \t\ttest type\n"));
|
|
531 |
test.Printf(_L("\t\t\t 0 - AttachAll\n"));
|
|
532 |
test.Printf(_L("\t\t\t 1 - AttachExe\n"));
|
|
533 |
test.Printf(_L("\t\t\t 2 - None\n"));
|
|
534 |
|
|
535 |
test.Printf(_L("\t-n \t\tnumber of iterations\n"));
|
|
536 |
test.Printf(_L("\t-e \t\ttest with events\n"));
|
|
537 |
test.Printf(_L("\t\t\t 0 - No\n"));
|
|
538 |
test.Printf(_L("\t\t\t 1 - Yes\n"));
|
|
539 |
test.Printf(_L("\t-p \t\tpriority of test target thread\n"));
|
|
540 |
|
|
541 |
test.Printf(_L("\t\t\t %d - EPriorityAbsoluteVeryLow \n"), EPriorityAbsoluteVeryLow);
|
|
542 |
test.Printf(_L("\t\t\t %d - EPriorityAbsoluteLowNormal \n"), EPriorityAbsoluteLowNormal);
|
|
543 |
test.Printf(_L("\t\t\t %d - EPriorityAbsoluteLow \n"), EPriorityAbsoluteLow);
|
|
544 |
test.Printf(_L("\t\t\t %d - EPriorityAbsoluteBackgroundNormal \n"), EPriorityAbsoluteBackgroundNormal);
|
|
545 |
test.Printf(_L("\t\t\t %d - EPriorityAbsoluteBackground \n"), EPriorityAbsoluteBackground);
|
|
546 |
test.Printf(_L("\t\t\t %d - EPriorityAbsoluteForegroundNormal \n"), EPriorityAbsoluteForegroundNormal);
|
|
547 |
test.Printf(_L("\t\t\t %d - EPriorityAbsoluteForeground \n"), EPriorityAbsoluteForeground);
|
|
548 |
test.Printf(_L("\t\t\t %d - EPriorityAbsoluteHighNormal \n"), EPriorityAbsoluteHighNormal);
|
|
549 |
test.Printf(_L("\t\t\t %d - EPriorityAbsoluteHigh \n"), EPriorityAbsoluteHigh);
|
|
550 |
test.Printf(_L("\t\t\t %d - EPriorityAbsoluteRealTime1 \n"), EPriorityAbsoluteRealTime1);
|
|
551 |
test.Printf(_L("\t\t\t %d - EPriorityAbsoluteRealTime2 \n"), EPriorityAbsoluteRealTime2);
|
|
552 |
test.Printf(_L("\t\t\t %d - EPriorityAbsoluteRealTime3 \n"), EPriorityAbsoluteRealTime3);
|
|
553 |
test.Printf(_L("\t\t\t %d - EPriorityAbsoluteRealTime4 \n"), EPriorityAbsoluteRealTime4);
|
|
554 |
test.Printf(_L("\t\t\t %d - EPriorityAbsoluteRealTime5 \n"), EPriorityAbsoluteRealTime5);
|
|
555 |
test.Printf(_L("\t\t\t %d - EPriorityAbsoluteRealTime6 \n"), EPriorityAbsoluteRealTime6);
|
|
556 |
test.Printf(_L("\t\t\t %d - EPriorityAbsoluteRealTime7 \n"), EPriorityAbsoluteRealTime7);
|
|
557 |
test.Printf(_L("\t\t\t %d - EPriorityAbsoluteRealTime8 \n"), EPriorityAbsoluteRealTime8);
|
|
558 |
|
|
559 |
test.Printf(_L("\t-d \t\tload driver\n"));
|
|
560 |
test.Printf(_L("\t\t\t 0 - No\n"));
|
|
561 |
test.Printf(_L("\t\t\t 1 - Yes\n"));
|
|
562 |
|
|
563 |
test.Printf(_L("\t-h \t\tdisplay usage information\n\n"));
|
|
564 |
|
|
565 |
test.Printf(_L("Press any key...\n"));
|
|
566 |
test.Getch();
|
|
567 |
|
|
568 |
LOG_EXIT();
|
|
569 |
}
|
|
570 |
|
|
571 |
GLDEF_C TInt E32Main()
|
|
572 |
{
|
|
573 |
__UHEAP_MARK;
|
|
574 |
|
|
575 |
TInt ret = KErrNone;
|
|
576 |
CTrapCleanup* trap = CTrapCleanup::New();
|
|
577 |
|
|
578 |
if (!trap)
|
|
579 |
return KErrNoMemory;
|
|
580 |
|
|
581 |
test.Start(KTestName);
|
|
582 |
|
|
583 |
CRunModeAgent *runModeAgent = CRunModeAgent::NewL();
|
|
584 |
|
|
585 |
if (runModeAgent != NULL)
|
|
586 |
{
|
|
587 |
TRAP(ret,runModeAgent->ClientAppL());
|
|
588 |
LOG_MSG( "ClientAppL() returned %d", ret );
|
|
589 |
delete runModeAgent;
|
|
590 |
}
|
|
591 |
|
|
592 |
test.End();
|
|
593 |
test.Close();
|
|
594 |
|
|
595 |
delete trap;
|
|
596 |
__UHEAP_MARKEND;
|
|
597 |
return ret;
|
|
598 |
}
|
|
599 |
|