os/kernelhwsrv/kerneltest/e32test/bench/t_exec.cpp
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/kernelhwsrv/kerneltest/e32test/bench/t_exec.cpp	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,82 @@
     1.4 +// Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.5 +// All rights reserved.
     1.6 +// This component and the accompanying materials are made available
     1.7 +// under the terms of the License "Eclipse Public License v1.0"
     1.8 +// which accompanies this distribution, and is available
     1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.10 +//
    1.11 +// Initial Contributors:
    1.12 +// Nokia Corporation - initial contribution.
    1.13 +//
    1.14 +// Contributors:
    1.15 +//
    1.16 +// Description:
    1.17 +// e32test\bench\t_exec.cpp
    1.18 +// 
    1.19 +//
    1.20 +
    1.21 +#include <e32test.h>
    1.22 +
    1.23 +const TInt KHeapSize=0x2000;
    1.24 +const TInt KMajorVersionNumber=1;
    1.25 +const TInt KMinorVersionNumber=0;
    1.26 +const TInt KBuildVersionNumber=1;
    1.27 +
    1.28 +LOCAL_D RTest test(_L("T_EXEC"));
    1.29 +LOCAL_D RTest testSvr(_L("Server"));
    1.30 +LOCAL_D RSemaphore semmy;
    1.31 +LOCAL_D TInt speedCount;
    1.32 +
    1.33 +LOCAL_C TInt speedyThreadEntryPoint(TAny*)
    1.34 +//
    1.35 +// The entry point for the speed test thread.
    1.36 +//
    1.37 +	{
    1.38 +
    1.39 +	speedCount=0;
    1.40 +	semmy.Signal();
    1.41 +	TUint myChar='a';
    1.42 +	TUint r;
    1.43 +	for (TUint i=0;i<0xffffffff;i++)
    1.44 +		{
    1.45 +		r=User::UpperCase(myChar);
    1.46 +		speedCount++;
    1.47 +		}
    1.48 +	return(KErrNone);
    1.49 +	}
    1.50 +
    1.51 +GLDEF_C TInt E32Main()
    1.52 +//
    1.53 +// Test timers.
    1.54 +//
    1.55 +    {
    1.56 +
    1.57 +	test.Title();
    1.58 +	test.Start(_L("Creating semaphore"));
    1.59 +	TInt r=semmy.CreateLocal(0);
    1.60 +	test(r==KErrNone);
    1.61 +//
    1.62 +	test.Next(_L("Starting speedy thread"));
    1.63 +	RThread speedy;
    1.64 +	r=speedy.Create(_L("Speedy"),speedyThreadEntryPoint,KDefaultStackSize,KHeapSize,KHeapSize,NULL);
    1.65 +	test(r==KErrNone);
    1.66 +	speedy.Resume();
    1.67 +//
    1.68 +	test.Next(_L("Wait for speedy to start"));
    1.69 +	semmy.Wait();
    1.70 +//
    1.71 +	test.Printf(_L("Starting exec speed test...\n"));
    1.72 +	User::After(0);
    1.73 +	TInt b=speedCount;
    1.74 +	User::After(1000000);
    1.75 +	TInt n=speedCount;
    1.76 +	test.Printf(_L("Count = %d exec calls in 1 second\n"),n-b);
    1.77 +//
    1.78 +	test.Next(_L("Kill speedy"));
    1.79 +	speedy.Kill(0x666);
    1.80 +	speedy.Close();
    1.81 +//
    1.82 +	test.End();
    1.83 +	return(0);
    1.84 +    }
    1.85 +