|
1 /* |
|
2 * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef CSTRESSWORKER_H_ |
|
19 #define CSTRESSWORKER_H_ |
|
20 |
|
21 #include <e32base.h> |
|
22 |
|
23 class CWorker; |
|
24 class MLog; |
|
25 |
|
26 class CStressWorker : public CBase |
|
27 { |
|
28 public: |
|
29 |
|
30 CStressWorker( MLog& aLog, |
|
31 TInt aPreIndex, |
|
32 TInt aIndexAverageItems, |
|
33 TBool aIndexingEnabled, |
|
34 TBool aDeletesEnabled, |
|
35 TBool aSearchersEnabled, |
|
36 TBool aCancellingEnabled, |
|
37 TInt aIndexerSleep, |
|
38 TInt aSearcherSleep ); |
|
39 |
|
40 ~CStressWorker(); |
|
41 |
|
42 void ConstructL(); |
|
43 |
|
44 void StartWorkersL(); |
|
45 |
|
46 void PrepareIndexL(); |
|
47 |
|
48 void StartL(); |
|
49 |
|
50 void DoFinishL(); |
|
51 |
|
52 TBool ReportL(); |
|
53 |
|
54 void AppendStatsLabelsL( RPointerArray<HBufC8>& aStats ); |
|
55 |
|
56 void AppendStatsL( RPointerArray<HBufC8>& aStats ); |
|
57 |
|
58 TInt Finish(); |
|
59 |
|
60 TBool IsActive(); |
|
61 |
|
62 protected: |
|
63 |
|
64 void AppendOpStatsL( RPointerArray<HBufC8>& aStats, |
|
65 TInt aOperations, |
|
66 TInt64 aOperationsMicroSeconds ); |
|
67 |
|
68 |
|
69 void AppendOpStatsL( RPointerArray<HBufC8>& aStats, |
|
70 TInt aOperations, |
|
71 TInt64 aOperationsMicroSeconds, |
|
72 TInt64 aOperationsPeakMicroSeconds ); |
|
73 |
|
74 /** |
|
75 * This is called, after the workers have been locked. The information |
|
76 * about, which workers were successfully locked, is stored |
|
77 * in aLocked variable. |
|
78 */ |
|
79 void AppendStatsInsideLocksL( RPointerArray<HBufC8>& aStats, const RArray<TBool>& aLocked ); |
|
80 |
|
81 /** |
|
82 * Calculates the size of directory |
|
83 */ |
|
84 TInt DirectorySizeL( const TDesC& aDirectory ); |
|
85 |
|
86 /** |
|
87 * Calculates the size of index. |
|
88 */ |
|
89 TInt IndexSizeL( const TDesC& aDirectory ); |
|
90 |
|
91 private: // State |
|
92 |
|
93 MLog& iLog; |
|
94 |
|
95 RPointerArray<CWorker> iWorkers; |
|
96 |
|
97 TBool iIsActive; |
|
98 |
|
99 private: // Configuration |
|
100 |
|
101 TInt iPreIndex; |
|
102 |
|
103 TInt iIndexAverageItems; |
|
104 |
|
105 TBool iIndexingEnabled; |
|
106 |
|
107 TBool iDeletesEnabled; |
|
108 |
|
109 TBool iSearchersEnabled; |
|
110 |
|
111 TBool iCancellingEnabled; |
|
112 |
|
113 TInt iIndexerSleep; |
|
114 |
|
115 TInt iSearcherSleep; |
|
116 |
|
117 }; |
|
118 |
|
119 #endif /* CSTRESSWORKER_H_ */ |