|
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". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 #ifndef SRVPERF_H |
|
17 #define SRVPERF_H |
|
18 |
|
19 #include <e32base.h> |
|
20 |
|
21 #ifdef __CENTREP_SERVER_PERFTEST__ |
|
22 #include "srvreqs.h" |
|
23 |
|
24 enum TPseudoRequest |
|
25 { |
|
26 ESessionClose = EGetSetParameters+1, |
|
27 EEvict = EGetSetParameters+2 |
|
28 }; |
|
29 |
|
30 const TInt KEventIdShiftBits = 24; |
|
31 const TUint32 KEventIdMask = 0xFF; |
|
32 const TUint32 KDataMask = 0x00FFFFFF; |
|
33 |
|
34 // Only record CPU used by CentRep server. |
|
35 const TUint32 KCentRepPerfTestArraySize = 3600; |
|
36 |
|
37 // class TCentRepPerfTest manages the performance data |
|
38 // collected by CentRep server. |
|
39 class TCentRepPerfTest |
|
40 { |
|
41 public: |
|
42 inline void SessionOpen() |
|
43 { iActiveSessionCount++; } |
|
44 inline TBool IsFinished() const // Special assumed end-of-boot condition |
|
45 { return (iCount >= KCentRepPerfTestArraySize)||(iEndOfBootCount==9); } |
|
46 inline TUint LastCompleteAccess() const |
|
47 { return iLastCompleteAccess; } |
|
48 inline const TUint32* Entries() const |
|
49 { return iEntries; } |
|
50 inline void IncEndOfBoot() |
|
51 { iEndOfBootCount++; } |
|
52 inline void Reset() |
|
53 { |
|
54 iActiveSessionCount = 0; |
|
55 iLastCompleteAccess = 0; |
|
56 iEndOfBootCount = 0; |
|
57 iCount = 0; |
|
58 } |
|
59 inline void Stop() |
|
60 { |
|
61 iCount = KCentRepPerfTestArraySize; |
|
62 } |
|
63 |
|
64 void SessionClose(); |
|
65 TInt Append(TUint32 aEntry); |
|
66 |
|
67 private: |
|
68 static TUint32 iEntries[KCentRepPerfTestArraySize]; |
|
69 static TUint iCount; |
|
70 static TUint iActiveSessionCount; |
|
71 static TUint iLastCompleteAccess; |
|
72 static TUint iEndOfBootCount; |
|
73 }; |
|
74 |
|
75 #endif //__CENTREP_SERVER_PERFTEST__ |
|
76 |
|
77 #ifdef __CENTREP_SERVER_MEMTEST__ |
|
78 enum TMemTestLocationIdentifier |
|
79 { |
|
80 EMemLcnRepositoryOpen //used to measure heap usage for a repository when |
|
81 //called from CServerRepository::OpenL |
|
82 }; |
|
83 const TInt32 KMemBufMaxEntry = 150; //make sure to allocate for 2 more than required. |
|
84 //The additional 2 are used to mark when server |
|
85 //tries to save more entries then max allowed |
|
86 const TUint32 KMagicMemTestOutOfBounds = 0xDEADBEEF; |
|
87 #define RECORD_HEAP_SIZE(aLocation, aIdentifier) TServerResources::RecordTimerResult(aLocation, aIdentifier) |
|
88 #else //__CENTREP_SERVER_MEMTEST__ |
|
89 #define RECORD_HEAP_SIZE(aLocation, aIdentifier) |
|
90 #endif //__CENTREP_SERVER_MEMTEST__ |
|
91 |
|
92 #endif //SRVPERF_H |