|
1 /* |
|
2 * Copyright (c) 2009 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 |
|
19 #ifndef LOADGEN_MODEL_H |
|
20 #define LOADGEN_MODEL_H |
|
21 |
|
22 // INCLUDES |
|
23 #include <e32std.h> |
|
24 #include <e32base.h> |
|
25 #include <apgcli.h> |
|
26 |
|
27 #include "loadgen_loadattributes.h" |
|
28 |
|
29 // FORWARD DECLARATIONS |
|
30 class CLoadGenMainContainer; |
|
31 class CLoadGenGraphsContainer; |
|
32 class CEikonEnv; |
|
33 class CLoadBase; |
|
34 |
|
35 |
|
36 typedef CArrayFixSeg<CLoadBase*> CLoadItemList; |
|
37 |
|
38 const TUint KMaxCPUs = 4; |
|
39 const TUint KHalFunction_EKernelHalNumLogicalCpus = 16; //EKernelHalNumLogicalCpus |
|
40 const TUint KHalFunction_EKernelHalLockThreadToCpu = 19; //EKernelHalLockThreadToCpu |
|
41 |
|
42 // CLASS DECLARATIONS |
|
43 |
|
44 class TLoadGenSettings |
|
45 { |
|
46 public: |
|
47 }; |
|
48 |
|
49 class CLoadGenModel : public CActive |
|
50 { |
|
51 private: |
|
52 enum TContainerDrawState |
|
53 { |
|
54 EDrawStateInvalid = -1, |
|
55 EDrawStateMain |
|
56 }; |
|
57 |
|
58 public: |
|
59 static CLoadGenModel* NewL(); |
|
60 ~CLoadGenModel(); |
|
61 void ActivateModelL(); |
|
62 void DeActivateModelL(); |
|
63 |
|
64 private: |
|
65 void RunL(); |
|
66 void DoCancel(); |
|
67 |
|
68 private: |
|
69 CLoadGenModel(); |
|
70 void ConstructL(); |
|
71 void LoadSettingsL(); |
|
72 void EditLoadL(CLoadBase* aItem); |
|
73 void DoStartNewLoadL(TInt aCommand); |
|
74 void AppendToLoadItemListL(CLoadBase* aItem); |
|
75 void DeleteFromLoadItemListL(TInt aIndex); |
|
76 void SuspendOrResumeFromLoadItemListL(TInt aIndex); |
|
77 void DeleteAllLoadItems(); |
|
78 void RefreshViewL(TBool aClearSelection=ETrue); |
|
79 CDesCArray* ListOfAllAppsL(); |
|
80 |
|
81 public: |
|
82 void StopAllLoadItemsL(); |
|
83 void SuspendAllLoadItemsL(); |
|
84 void ResumeAllLoadItemsL(); |
|
85 |
|
86 TInt LoadItemCount() const; |
|
87 void ShowItemActionMenuL(); |
|
88 void StopSelectedOrHighlightedItemsL(); |
|
89 void SuspendOrResumeSelectedOrHighlightedItemsL(); |
|
90 |
|
91 CDesCArray* GenerateListBoxItemTextArrayL(); |
|
92 void StartNewLoadL(TInt aCommand); |
|
93 void SaveSettingsL(); |
|
94 void SetMainContainer(CLoadGenMainContainer* aContainer); |
|
95 TInt LaunchSettingsDialogL(); |
|
96 inline TLoadGenSettings& Settings() { return iSettings; } |
|
97 inline CEikonEnv* EikonEnv() { return iEnv; } |
|
98 inline RApaLsSession& LsSession() { return iLs; } |
|
99 inline CLoadGenMainContainer* MainContainer() { return iMainContainer; } |
|
100 inline TBool LoadItemsExists() { return iLoadItemList->Count() > 0; } |
|
101 |
|
102 |
|
103 public: |
|
104 static TThreadPriority SettingItemToThreadPriority(TInt aIndex); |
|
105 static void SettingItemToThreadDescription(TInt aIndex, TDes& aBuf); |
|
106 static void SettingItemToSourceDescription(TInt aIndex, TDes& aBuf); |
|
107 static TInt MilliSecondsToMicroSeconds(TInt aMilliSeconds, TInt aRandomVariance=0); |
|
108 static TInt RandomNumber(TInt aMin, TInt aMax); |
|
109 static TSize ScreenSize(); |
|
110 |
|
111 private: |
|
112 RTimer iTimer; |
|
113 CLoadGenMainContainer* iMainContainer; |
|
114 CEikonEnv* iEnv; |
|
115 TLoadGenSettings iSettings; |
|
116 RApaLsSession iLs; |
|
117 TInt iDrawState; |
|
118 CLoadItemList* iLoadItemList; |
|
119 TInt iReferenceNumber; |
|
120 TCPULoadAttributes iCpuLoadAttributes; |
|
121 TMemoryEatAttributes iMemoryEatAttributes; |
|
122 TPhoneCallAttributes iPhoneCallAttributes; |
|
123 TNetConnAttributes iNetConnAttributes; |
|
124 TKeyPressAttributes iKeyPressAttributes; |
|
125 TMessageAttributes iMessageAttributes; |
|
126 TApplicationsAttributes iApplicationsAttributes; |
|
127 TPhotoCaptureAttributes iPhotoCaptureAttributes; |
|
128 TBluetoothAttributes iBluetoothAttributes; |
|
129 TPointerEventAttributes iPointerEventAttributes; |
|
130 static TInt64 iRandomNumberSeed; |
|
131 }; |
|
132 |
|
133 |
|
134 #endif |