os/ossrv/lowlevellibsandfws/pluginfw/TestExecute/EComPerfTest/src/Te_EComPerfTestServer.cpp
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/ossrv/lowlevellibsandfws/pluginfw/TestExecute/EComPerfTest/src/Te_EComPerfTestServer.cpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,118 @@
1.4 +// Copyright (c) 2005-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 "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 +// Te_EComPerfLoggerServer.cpp
1.18 +// for (WINS && !EKA2) versions will be xxxServer.Dll and require a thread to be started
1.19 +// in the process of the client. The client initialises the server by calling the
1.20 +// one and only ordinal.
1.21 +//
1.22 +//
1.23 +
1.24 +/**
1.25 + @internalTechnology
1.26 +*/
1.27 +#include "Te_EComPerfTestServer.h"
1.28 +#include "Te_EComPerfLoggerStep.h"
1.29 +#include "Te_EComStartupStatePerfTestStep.h"
1.30 +#include "Te_EComClientRequestPerfTestStep.h"
1.31 +#include "Te_EComAccumulatedClientRequestPerfTestStep.h"
1.32 +#include "Te_EComPluginReDiscoverPerfTestStep.h"
1.33 +
1.34 +_LIT(KServerName, "Te_EComPerfTest");
1.35 +
1.36 +CEComPerfTestServer* CEComPerfTestServer::NewL()
1.37 +/**
1.38 + * @return - Instance of the test server
1.39 + * Called inside the MainL() function to create and start the
1.40 + * CTestServer derived server.
1.41 + */
1.42 + {
1.43 + CEComPerfTestServer * server = new (ELeave) CEComPerfTestServer();
1.44 + CleanupStack::PushL(server);
1.45 + // CServer base class call
1.46 + server->StartL(KServerName);
1.47 + CleanupStack::Pop(server);
1.48 + return server;
1.49 + }
1.50 +
1.51 +LOCAL_C void MainL()
1.52 + {
1.53 + // Leave the hooks in for platform security
1.54 +#if (defined __DATA_CAGING__)
1.55 + RProcess().DataCaging(RProcess::EDataCagingOn);
1.56 + RProcess().SecureApi(RProcess::ESecureApiOn);
1.57 +#endif
1.58 +
1.59 + CActiveScheduler* sched=NULL;
1.60 + sched=new(ELeave) CActiveScheduler;
1.61 + CActiveScheduler::Install(sched);
1.62 + CEComPerfTestServer* server = NULL;
1.63 + // Create the CTestServer derived server
1.64 + TRAPD(err,server = CEComPerfTestServer::NewL());
1.65 + if(!err)
1.66 + {
1.67 + // Sync with the client and enter the active scheduler
1.68 + RProcess::Rendezvous(KErrNone);
1.69 + sched->Start();
1.70 + }
1.71 + delete server;
1.72 + delete sched;
1.73 + }
1.74 +
1.75 +GLDEF_C TInt E32Main()
1.76 +/**
1.77 + * @return - Standard Epoc error code on exit
1.78 + */
1.79 + {
1.80 + CTrapCleanup* cleanup = CTrapCleanup::New();
1.81 + if(cleanup == NULL)
1.82 + {
1.83 + return KErrNoMemory;
1.84 + }
1.85 + TRAPD(err,MainL());
1.86 + err = err; // removes armv5 warning
1.87 + delete cleanup;
1.88 + return KErrNone;
1.89 + }
1.90 +
1.91 +CTestStep* CEComPerfTestServer::CreateTestStep(const TDesC& aStepName)
1.92 +/**
1.93 + * @return - A CTestStep derived instance
1.94 + * Implementation of CTestServer pure virtual
1.95 + */
1.96 + {
1.97 + CTestStep* testStep = NULL;
1.98 +
1.99 + if (aStepName == KEComStartupStatePerfTest)
1.100 + {
1.101 + testStep = new CEComStartupStatePerfTest();
1.102 + }
1.103 + else if (aStepName == KEComPerfLogger)
1.104 + {
1.105 + testStep = new CEComPerfLogger();
1.106 + }
1.107 + else if (aStepName == KEComAccumulatedClientRequestsPerfTest)
1.108 + {
1.109 + testStep = new CEComAccumulatedClientRequestsPerfTest();
1.110 + }
1.111 + else if (aStepName == KEComClientRequestsPerfTest)
1.112 + {
1.113 + testStep = new CEComClientRequestsPerfTest();
1.114 + }
1.115 + else if (aStepName == KEComPluginReDiscoverPerfTest)
1.116 + {
1.117 + testStep = new CEComPluginReDiscoverPerfTest();
1.118 + }
1.119 + return testStep;
1.120 + }
1.121 +