kerneltest/e32test/misc/t_busy.cpp
changeset 0 a41df078684a
equal deleted inserted replaced
-1:000000000000 0:a41df078684a
       
     1 // Copyright (c) 1997-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\misc\t_busy.cpp
       
    15 // 
       
    16 //
       
    17 
       
    18 #include <e32test.h>
       
    19 
       
    20 LOCAL_D RTest test(_L("BUSY"));
       
    21 
       
    22 LOCAL_D TInt Counter=0;
       
    23 
       
    24 GLDEF_C TInt E32Main()
       
    25 	{
       
    26 	test.Title();
       
    27 	RThread().SetPriority(EPriorityAbsoluteHigh);
       
    28 	CConsoleBase* console=test.Console();
       
    29 	TRequestStatus ks;
       
    30 	console->Read(ks);
       
    31 	TInt period=1000;
       
    32 	test.Printf(_L("\nPeriod %dus"),period);
       
    33 	FOREVER
       
    34 		{
       
    35 		User::AfterHighRes(period);
       
    36 		Counter+=period;
       
    37 		if (Counter>=1000000)
       
    38 			{
       
    39 			Counter-=1000000;
       
    40 			test.Printf(_L("."));
       
    41 			}
       
    42 		if (ks!=KRequestPending)
       
    43 			{
       
    44 			TInt k=(TInt)console->KeyCode();
       
    45 			if (k==EKeyEscape)
       
    46 				break;
       
    47 			if (k>='0' && k<='9')
       
    48 				{
       
    49 				TInt n=k-'0';
       
    50 				if (n==0)
       
    51 					n=10;
       
    52 				period=n*1000;
       
    53 				test.Printf(_L("\nPeriod %dus"),period);
       
    54 				}
       
    55 			console->Read(ks);
       
    56 			}
       
    57 		}
       
    58 
       
    59 	return 0;
       
    60 	}