1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/kernelhwsrv/kerneltest/e32test/mmu/t_shbuf_perfserver.h Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,177 @@
1.4 +// Copyright (c) 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/mmu/t_shbuf_perfserver.h
1.18 +//
1.19 +//
1.20 +
1.21 +#ifndef _T_SHBUF_PERFSERVER_H_
1.22 +#define _T_SHBUF_PERFSERVER_H_
1.23 +
1.24 +/**
1.25 + * @file
1.26 + *
1.27 + * Test server used for Performance Testing of shared buffers.
1.28 + */
1.29 +
1.30 +#include <e32base.h>
1.31 +#include <e32shbuf.h>
1.32 +
1.33 +#include "d_shbuf.h"
1.34 +
1.35 +class RShBuf;
1.36 +
1.37 +/**
1.38 + * Name of the server. The '!' means it is a protected server.
1.39 + */
1.40 +_LIT(KRShBufTestServerName, "!RShBufServer");
1.41 +
1.42 +
1.43 +/**
1.44 + * Server IPC requests.
1.45 + */
1.46 +enum TShBufServerRequest
1.47 + {
1.48 + EShBufServerSendBuffer,
1.49 + EShBufServerReceiveBuffer,
1.50 + EShBufServerSendAndReceiveBuffer,
1.51 + EShBufServerSendSharedBuffer,
1.52 + EShBufServerReceiveSharedBuffer,
1.53 + EShBufServerSendAndReceiveSharedBuffer,
1.54 + EShBufServerShutdownServer,
1.55 + EShBufServerFromTPtr8ProcessAndReturn,
1.56 + EShBufServerFromTPtr8ProcessAndRelease,
1.57 + EShBufServerOpenRShBufPool,
1.58 + EShBufServerCloseRShBufPool,
1.59 + EShBufServerFromRShBufProcessAndReturn,
1.60 + EShBufServerFromRShBufProcessAndRelease,
1.61 + EShBufServerDbgMarkHeap,
1.62 + EShBufServerDbgCheckHeap,
1.63 + EShBufServerDbgMarkEnd,
1.64 + EShBufServerDbgFailNext
1.65 + };
1.66 +
1.67 +
1.68 +class CShBufTestServerSession;
1.69 +
1.70 +
1.71 +/**
1.72 + * The RShBuf test server class.
1.73 + *
1.74 + * The class provides all the services required by class CShBufTestServerSession.
1.75 + */
1.76 +class CShBufTestServer : public CServer2
1.77 + {
1.78 +public:
1.79 + static CShBufTestServer* NewL();
1.80 +
1.81 + void AddSessionL(CShBufTestServerSession* aSession);
1.82 + void DropSession(CShBufTestServerSession* aSession);
1.83 +
1.84 + TInt FromTPtr8ProcessAndReturn(TDes8& aBuf, TUint aBufSize);
1.85 + TInt FromTPtr8ProcessAndRelease(TDes8& aBuf);
1.86 +
1.87 + TInt OpenRShBufPool(TInt aHandle, const TShPoolInfo& aPoolInfo);
1.88 + TInt CloseRShBufPool();
1.89 + TInt FromRShBufProcessAndReturn(RShBuf& aShBuf, TUint aBufSize);
1.90 + TInt FromRShBufProcessAndRelease(RShBuf& aShBuf);
1.91 +
1.92 + TInt DbgMarkHeap() const;
1.93 + TInt DbgCheckHeap(TInt aCount) const;
1.94 + TInt DbgMarkEnd(TInt aCount) const;
1.95 + TInt DbgFailNext(TInt aCount) const;
1.96 +
1.97 + TInt ShutdownServer();
1.98 +
1.99 +private:
1.100 + CShBufTestServer();
1.101 + ~CShBufTestServer();
1.102 +
1.103 + void ConstructL();
1.104 +
1.105 + CSession2* NewSessionL(const TVersion& aVersion,const RMessage2&/*aMessage*/) const;
1.106 + TInt RunError(TInt aError);
1.107 +
1.108 + RPointerArray<CShBufTestServerSession> iSessionArray;
1.109 +
1.110 + //
1.111 + // Variables to control shutdown of the server...
1.112 + //
1.113 + TBool iShouldShutdownServer;
1.114 +
1.115 + //
1.116 + // Handle to the driver...
1.117 + //
1.118 + RShBufTestChannel iShBufLdd;
1.119 + TUint8 iClearCache[32768];
1.120 + };
1.121 +
1.122 +
1.123 +/**
1.124 + * This is the Phonebook Sync Server side session class and is responsible
1.125 + * for handling the client (RPhoneBookSession) requests, encoding/decoding
1.126 + * the parameters and Contacts Item phonebook data across the API.
1.127 + * Once the parameters are decoded the request is sent to the server where
1.128 + * it will either be handled directly or forwarded to the Background Sync
1.129 + * Engine. Once the request is completed, any return parameters are written
1.130 + * back to the client if neccessary.
1.131 + */
1.132 +class CShBufTestServerSession : public CSession2
1.133 + {
1.134 +public:
1.135 + void CreateL();
1.136 + void CompleteRequest(const RMessage2& aMessage, TInt aResult) const;
1.137 +
1.138 + inline CShBufTestServer& Server();
1.139 +
1.140 +private:
1.141 + ~CShBufTestServerSession();
1.142 +
1.143 + void ServiceL(const RMessage2& aMessage);
1.144 +
1.145 + void ShutdownServerL(const RMessage2& aMessage);
1.146 +
1.147 + void FromTPtr8ProcessAndReturnL(const RMessage2& aMessage);
1.148 + void FromTPtr8ProcessAndReleaseL(const RMessage2& aMessage);
1.149 +
1.150 + void OpenRShBufPoolL(const RMessage2& aMessage);
1.151 + void CloseRShBufPoolL(const RMessage2& aMessage);
1.152 + void FromRShBufProcessAndReturnL(const RMessage2& aMessage);
1.153 + void FromRShBufProcessAndReleaseL(const RMessage2& aMessage);
1.154 +
1.155 + void DbgMarkHeapL(const RMessage2& aMessage);
1.156 + void DbgCheckHeapL(const RMessage2& aMessage);
1.157 + void DbgMarkEndL(const RMessage2& aMessage);
1.158 + void DbgFailNextL(const RMessage2& aMessage);
1.159 +
1.160 +private:
1.161 + TUint8 iSessionTempBuffer[8192];
1.162 + };
1.163 +
1.164 +
1.165 +/**
1.166 + * Returns a reference to the CPhoneBookServer class.
1.167 + */
1.168 +inline CShBufTestServer& CShBufTestServerSession::Server()
1.169 + {
1.170 + return *static_cast<CShBufTestServer*>(const_cast<CServer2*>(CSession2::Server()));
1.171 + } // CShBufTestServerSession::Server
1.172 +
1.173 +
1.174 +#ifndef CAN_TRANSFER_SHBUF_TO_ANOTHER_PROCESS
1.175 +TInt RShBufTestServerThread(TAny* aPtr);
1.176 +#endif
1.177 +
1.178 +
1.179 +#endif // _T_SHBUF_PERFSERVER_H_
1.180 +