Update contrib.
     1 // Copyright (c) 2005-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".
 
     8 // Initial Contributors:
 
     9 // Nokia Corporation - initial contribution.
 
    21 #ifdef __CENTREP_SERVER_PERFTEST__
 
    23 #include "clientrequest.h"
 
    27 	EEvict = EGetSetParameters+1
 
    30 const TInt KEventIdShiftBits = 24;
 
    31 const TUint32 KEventIdMask = 0xFF;
 
    32 const TUint32 KDataMask = 0x00FFFFFF;
 
    34 // Only record CPU used by CentRep server.
 
    35 const TUint32 KCentRepPerfTestArraySize = 3600;
 
    37 class CServerSubSession;
 
    39 // class TCentRepPerfTest manages the performance data
 
    40 // collected by CentRep server.
 
    41 class TCentRepPerfTest
 
    44 	inline void SessionOpen()
 
    45 		{ iActiveSessionCount++; }
 
    46 	inline TBool IsFinished() const // Special assumed end-of-boot condition 
 
    47 		{ return (iCount >= KCentRepPerfTestArraySize)||(iEndOfBootCount==9); }
 
    48 	inline TUint LastCompleteAccess() const
 
    49 		{ return iLastCompleteAccess; }
 
    50 	inline const TUint32* Entries() const
 
    52 	inline void IncEndOfBoot()
 
    53 		{ iEndOfBootCount++; }
 
    56 		iActiveSessionCount = 0;
 
    57 		iLastCompleteAccess = 0;
 
    63 		iCount = KCentRepPerfTestArraySize;
 
    65 	inline void SetCurrentRepositoryUid(TUint32 aCurrentRepositoryUid)
 
    66 		{ iCurrentRepositoryUid = aCurrentRepositoryUid; }
 
    67 	inline TUint32 CurrentRepositoryUid()
 
    68 		{ return iCurrentRepositoryUid; }
 
    71 	TInt Append(TUint32 aEntry);
 
    73 	//called at the beginning of a server event being executed
 
    74 	void DoEventStart(CServerSubSession* aSubSession, const TClientRequest& aMessage);
 
    76 	//called at the end of a server event being executed
 
    77 	void DoEventEnd(CServerSubSession* aSubSession, const TClientRequest& aMessage);
 
    79 	//called at the beginning of a server Initialisation
 
    82 	//called at the end of a server initialisation
 
    86 	TUint32 iEntries[KCentRepPerfTestArraySize];
 
    88 	TUint   iActiveSessionCount;
 
    89 	TUint   iLastCompleteAccess;
 
    90 	TUint   iEndOfBootCount;
 
    91 	TUint32 iCurrentRepositoryUid;	
 
    95 	#define PERF_TEST_EVENT_START(aSubSession, aMessage) TServerResources::iPerfTestMgr.DoEventStart(aSubSession, aMessage)
 
    96 	#define PERF_TEST_EVENT_END(aSubSession, aMessage) TServerResources::iPerfTestMgr.DoEventEnd(aSubSession, aMessage)
 
    97 	#define PERF_TEST_SERVER_START() TServerResources::iPerfTestMgr.DoServerStart()
 
    98 	#define PERF_TEST_SERVER_END() TServerResources::iPerfTestMgr.DoServerEnd()
 
   101 	#define PERF_TEST_EVENT_START(aSubSession, aMessage)
 
   102 	#define PERF_TEST_EVENT_END(aSubSession, aMessage)
 
   103 	#define PERF_TEST_SERVER_START()
 
   104 	#define PERF_TEST_SERVER_END()
 
   106 #endif //__CENTREP_SERVER_PERFTEST__
 
   108 #ifdef __CENTREP_SERVER_MEMTEST__
 
   109 	enum TMemTestLocationIdentifier
 
   111 		EMemLcnRepositoryOpen, //used to measure heap usage for a repository when
 
   112 							   //called from CServerRepository::OpenL
 
   113 		EMemLcnOnDemand       //used to measure heap usage of Centrep server at any 
 
   114 							  //time on demand. called from CServerSession::GetSetParameters
 
   116 	const TInt32 KMemBufMaxEntry = 150; //make sure to allocate for 2 more than required.
 
   117 									    //The additional 2 are used to mark when server
 
   118 									    //tries to save more entries then max allowed
 
   119 	const TUint32 KMagicMemTestOutOfBounds = 0xDEADBEEF;
 
   120 	#define RECORD_HEAP_SIZE(aLocation, aIdentifier) TServerResources::RecordTimerResult(aLocation, aIdentifier)
 
   121 #else //__CENTREP_SERVER_MEMTEST__
 
   122 	#define RECORD_HEAP_SIZE(aLocation, aIdentifier)
 
   123 #endif //__CENTREP_SERVER_MEMTEST__