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