windowing/windowserver/test/t_integ/src/t_simloadapp3.cpp
changeset 36 01a6848ebfd7
parent 0 5d03bc08d59c
child 43 7579f232bae7
child 45 36b2e23a8629
equal deleted inserted replaced
0:5d03bc08d59c 36:01a6848ebfd7
     1 // Copyright (c) 2007-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 "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 //
       
    15 
       
    16 /**
       
    17  @file
       
    18  @test
       
    19  @internalComponent - Internal Symbian test code
       
    20 */
       
    21 
       
    22 #include <e32base.h>
       
    23 #include <e32debug.h>
       
    24 #include "t_simloadapp.h"
       
    25 #include "t_simloadutils.h"
       
    26 #include "t_wservconsts.h"
       
    27 
       
    28 GLDEF_C TInt E32Main()
       
    29 	{
       
    30 	RDebug::Print(_L("T_SimLoadApp3::E32Main - entry"));
       
    31 
       
    32 	CTrapCleanup* TheTrapCleanup = CTrapCleanup::New();
       
    33 
       
    34 	TRAPD(err, StartTestL());
       
    35 	if (err)
       
    36 		{
       
    37 		User::Panic(KTSimLoadAppPanic,err);
       
    38 		}
       
    39 
       
    40     delete TheTrapCleanup;
       
    41 
       
    42 	RDebug::Print(_L("T_SimLoadApp3::E32Main - exit"));
       
    43 	return KErrNone;
       
    44 	}
       
    45 
       
    46 LOCAL_C void StartTestL(void)
       
    47 	{
       
    48 	TInt mySimLoad = CTSimLoadAppUtils::SimLoadL();
       
    49 	
       
    50 	// static simulated load
       
    51 	if (CTSimLoadAppUtils::StaticLoadL())
       
    52 		{
       
    53 		// when simulating the static load there are 3 simload
       
    54 		// apps executing at the same time. To harmonise the 
       
    55 		// load a different number (seed value) is passed
       
    56 		// to the engine, hence 200000 in this case
       
    57 		CTSimLoadAppUtils::SimulateStaticLoadL(mySimLoad, 200000);
       
    58 		}
       
    59 	else 
       
    60 		{
       
    61 		// spiked simulated load
       
    62 		if (CTSimLoadAppUtils::SpikedLoadL())
       
    63 			{
       
    64 			// in a spiked load situation only simload1
       
    65 			// executes a spiked load pattern, whilst simload2
       
    66 			// and simload3 run in the background
       
    67 			CTSimLoadAppUtils::SimulateStaticLoadL(0, 200000);
       
    68 			}
       
    69 		else
       
    70 			{
       
    71 			User::Leave(KErrAbort);
       
    72 			}
       
    73 		}
       
    74 	}
       
    75