0
|
1 |
// Copyright (c) 1995-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 the License "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 |
// e32test\bench\t_exec.cpp
|
|
15 |
//
|
|
16 |
//
|
|
17 |
|
|
18 |
#include <e32test.h>
|
|
19 |
|
|
20 |
const TInt KHeapSize=0x2000;
|
121
|
21 |
|
0
|
22 |
|
|
23 |
LOCAL_D RTest test(_L("T_EXEC"));
|
|
24 |
LOCAL_D RTest testSvr(_L("Server"));
|
|
25 |
LOCAL_D RSemaphore semmy;
|
|
26 |
LOCAL_D TInt speedCount;
|
|
27 |
|
|
28 |
LOCAL_C TInt speedyThreadEntryPoint(TAny*)
|
|
29 |
//
|
|
30 |
// The entry point for the speed test thread.
|
|
31 |
//
|
|
32 |
{
|
|
33 |
|
|
34 |
speedCount=0;
|
|
35 |
semmy.Signal();
|
|
36 |
TUint myChar='a';
|
|
37 |
for (TUint i=0;i<0xffffffff;i++)
|
|
38 |
{
|
121
|
39 |
User::UpperCase(myChar);
|
0
|
40 |
speedCount++;
|
|
41 |
}
|
|
42 |
return(KErrNone);
|
|
43 |
}
|
|
44 |
|
|
45 |
GLDEF_C TInt E32Main()
|
|
46 |
//
|
|
47 |
// Test timers.
|
|
48 |
//
|
|
49 |
{
|
|
50 |
|
|
51 |
test.Title();
|
|
52 |
test.Start(_L("Creating semaphore"));
|
|
53 |
TInt r=semmy.CreateLocal(0);
|
|
54 |
test(r==KErrNone);
|
|
55 |
//
|
|
56 |
test.Next(_L("Starting speedy thread"));
|
|
57 |
RThread speedy;
|
|
58 |
r=speedy.Create(_L("Speedy"),speedyThreadEntryPoint,KDefaultStackSize,KHeapSize,KHeapSize,NULL);
|
|
59 |
test(r==KErrNone);
|
|
60 |
speedy.Resume();
|
|
61 |
//
|
|
62 |
test.Next(_L("Wait for speedy to start"));
|
|
63 |
semmy.Wait();
|
|
64 |
//
|
|
65 |
test.Printf(_L("Starting exec speed test...\n"));
|
|
66 |
User::After(0);
|
|
67 |
TInt b=speedCount;
|
|
68 |
User::After(1000000);
|
|
69 |
TInt n=speedCount;
|
|
70 |
test.Printf(_L("Count = %d exec calls in 1 second\n"),n-b);
|
|
71 |
//
|
|
72 |
test.Next(_L("Kill speedy"));
|
|
73 |
speedy.Kill(0x666);
|
|
74 |
speedy.Close();
|
|
75 |
//
|
|
76 |
test.End();
|
|
77 |
return(0);
|
|
78 |
}
|
|
79 |
|