0
|
1 |
// Copyright (c) 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/mmu/t_shbuf_perfserver.h
|
|
15 |
//
|
|
16 |
//
|
|
17 |
|
|
18 |
#ifndef _T_SHBUF_PERFSERVER_H_
|
|
19 |
#define _T_SHBUF_PERFSERVER_H_
|
|
20 |
|
|
21 |
/**
|
|
22 |
* @file
|
|
23 |
*
|
|
24 |
* Test server used for Performance Testing of shared buffers.
|
|
25 |
*/
|
|
26 |
|
|
27 |
#include <e32base.h>
|
|
28 |
#include <e32shbuf.h>
|
|
29 |
|
|
30 |
#include "d_shbuf.h"
|
|
31 |
|
|
32 |
class RShBuf;
|
|
33 |
|
|
34 |
/**
|
|
35 |
* Name of the server. The '!' means it is a protected server.
|
|
36 |
*/
|
|
37 |
_LIT(KRShBufTestServerName, "!RShBufServer");
|
|
38 |
|
|
39 |
|
|
40 |
/**
|
|
41 |
* Server IPC requests.
|
|
42 |
*/
|
|
43 |
enum TShBufServerRequest
|
|
44 |
{
|
|
45 |
EShBufServerSendBuffer,
|
|
46 |
EShBufServerReceiveBuffer,
|
|
47 |
EShBufServerSendAndReceiveBuffer,
|
|
48 |
EShBufServerSendSharedBuffer,
|
|
49 |
EShBufServerReceiveSharedBuffer,
|
|
50 |
EShBufServerSendAndReceiveSharedBuffer,
|
|
51 |
EShBufServerShutdownServer,
|
|
52 |
EShBufServerFromTPtr8ProcessAndReturn,
|
|
53 |
EShBufServerFromTPtr8ProcessAndRelease,
|
|
54 |
EShBufServerOpenRShBufPool,
|
|
55 |
EShBufServerCloseRShBufPool,
|
|
56 |
EShBufServerFromRShBufProcessAndReturn,
|
|
57 |
EShBufServerFromRShBufProcessAndRelease,
|
|
58 |
EShBufServerDbgMarkHeap,
|
|
59 |
EShBufServerDbgCheckHeap,
|
|
60 |
EShBufServerDbgMarkEnd,
|
|
61 |
EShBufServerDbgFailNext
|
|
62 |
};
|
|
63 |
|
|
64 |
|
|
65 |
class CShBufTestServerSession;
|
|
66 |
|
|
67 |
|
|
68 |
/**
|
|
69 |
* The RShBuf test server class.
|
|
70 |
*
|
|
71 |
* The class provides all the services required by class CShBufTestServerSession.
|
|
72 |
*/
|
|
73 |
class CShBufTestServer : public CServer2
|
|
74 |
{
|
|
75 |
public:
|
|
76 |
static CShBufTestServer* NewL();
|
|
77 |
|
|
78 |
void AddSessionL(CShBufTestServerSession* aSession);
|
|
79 |
void DropSession(CShBufTestServerSession* aSession);
|
|
80 |
|
|
81 |
TInt FromTPtr8ProcessAndReturn(TDes8& aBuf, TUint aBufSize);
|
|
82 |
TInt FromTPtr8ProcessAndRelease(TDes8& aBuf);
|
|
83 |
|
|
84 |
TInt OpenRShBufPool(TInt aHandle, const TShPoolInfo& aPoolInfo);
|
|
85 |
TInt CloseRShBufPool();
|
|
86 |
TInt FromRShBufProcessAndReturn(RShBuf& aShBuf, TUint aBufSize);
|
|
87 |
TInt FromRShBufProcessAndRelease(RShBuf& aShBuf);
|
|
88 |
|
|
89 |
TInt DbgMarkHeap() const;
|
|
90 |
TInt DbgCheckHeap(TInt aCount) const;
|
|
91 |
TInt DbgMarkEnd(TInt aCount) const;
|
|
92 |
TInt DbgFailNext(TInt aCount) const;
|
|
93 |
|
|
94 |
TInt ShutdownServer();
|
|
95 |
|
|
96 |
private:
|
|
97 |
CShBufTestServer();
|
|
98 |
~CShBufTestServer();
|
|
99 |
|
|
100 |
void ConstructL();
|
|
101 |
|
|
102 |
CSession2* NewSessionL(const TVersion& aVersion,const RMessage2&/*aMessage*/) const;
|
|
103 |
TInt RunError(TInt aError);
|
|
104 |
|
|
105 |
RPointerArray<CShBufTestServerSession> iSessionArray;
|
|
106 |
|
|
107 |
//
|
|
108 |
// Variables to control shutdown of the server...
|
|
109 |
//
|
|
110 |
TBool iShouldShutdownServer;
|
|
111 |
|
|
112 |
//
|
|
113 |
// Handle to the driver...
|
|
114 |
//
|
|
115 |
RShBufTestChannel iShBufLdd;
|
|
116 |
TUint8 iClearCache[32768];
|
|
117 |
};
|
|
118 |
|
|
119 |
|
|
120 |
/**
|
|
121 |
* This is the Phonebook Sync Server side session class and is responsible
|
|
122 |
* for handling the client (RPhoneBookSession) requests, encoding/decoding
|
|
123 |
* the parameters and Contacts Item phonebook data across the API.
|
|
124 |
* Once the parameters are decoded the request is sent to the server where
|
|
125 |
* it will either be handled directly or forwarded to the Background Sync
|
|
126 |
* Engine. Once the request is completed, any return parameters are written
|
|
127 |
* back to the client if neccessary.
|
|
128 |
*/
|
|
129 |
class CShBufTestServerSession : public CSession2
|
|
130 |
{
|
|
131 |
public:
|
|
132 |
void CreateL();
|
|
133 |
void CompleteRequest(const RMessage2& aMessage, TInt aResult) const;
|
|
134 |
|
|
135 |
inline CShBufTestServer& Server();
|
|
136 |
|
|
137 |
private:
|
|
138 |
~CShBufTestServerSession();
|
|
139 |
|
|
140 |
void ServiceL(const RMessage2& aMessage);
|
|
141 |
|
|
142 |
void ShutdownServerL(const RMessage2& aMessage);
|
|
143 |
|
|
144 |
void FromTPtr8ProcessAndReturnL(const RMessage2& aMessage);
|
|
145 |
void FromTPtr8ProcessAndReleaseL(const RMessage2& aMessage);
|
|
146 |
|
|
147 |
void OpenRShBufPoolL(const RMessage2& aMessage);
|
|
148 |
void CloseRShBufPoolL(const RMessage2& aMessage);
|
|
149 |
void FromRShBufProcessAndReturnL(const RMessage2& aMessage);
|
|
150 |
void FromRShBufProcessAndReleaseL(const RMessage2& aMessage);
|
|
151 |
|
|
152 |
void DbgMarkHeapL(const RMessage2& aMessage);
|
|
153 |
void DbgCheckHeapL(const RMessage2& aMessage);
|
|
154 |
void DbgMarkEndL(const RMessage2& aMessage);
|
|
155 |
void DbgFailNextL(const RMessage2& aMessage);
|
|
156 |
|
|
157 |
private:
|
|
158 |
TUint8 iSessionTempBuffer[8192];
|
|
159 |
};
|
|
160 |
|
|
161 |
|
|
162 |
/**
|
|
163 |
* Returns a reference to the CPhoneBookServer class.
|
|
164 |
*/
|
|
165 |
inline CShBufTestServer& CShBufTestServerSession::Server()
|
|
166 |
{
|
|
167 |
return *static_cast<CShBufTestServer*>(const_cast<CServer2*>(CSession2::Server()));
|
|
168 |
} // CShBufTestServerSession::Server
|
|
169 |
|
|
170 |
|
|
171 |
#ifndef CAN_TRANSFER_SHBUF_TO_ANOTHER_PROCESS
|
|
172 |
TInt RShBufTestServerThread(TAny* aPtr);
|
|
173 |
#endif
|
|
174 |
|
|
175 |
|
|
176 |
#endif // _T_SHBUF_PERFSERVER_H_
|
|
177 |
|