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 PROFILER_ATTRIBUTES_H |
|
20 #define PROFILER_ATTRIBUTES_H |
|
21 |
|
22 // INCLUDES |
|
23 #include <e32std.h> |
|
24 #include <e32base.h> |
|
25 #include <s32mem.h> |
|
26 |
|
27 // LITERALS |
|
28 _LIT8(KDefaultTraceFilePrefix, "PIProfiler_#"); |
|
29 _LIT8(KDefaultTraceOutput, "file_system"); |
|
30 _LIT8(KDefaultTraceFileSaveDrive, "C:\\data\\"); |
|
31 |
|
32 _LIT8(KEnabled, "enabled"); |
|
33 _LIT8(KBracketOpen, "["); |
|
34 _LIT8(KBracketClose, "]"); |
|
35 _LIT8(KSettingItemSeparator, "="); |
|
36 |
|
37 // CONSTANTS |
|
38 const TUint KPrefixMaxLength = 64; |
|
39 const TUint KShortNameMaxLength = 3; |
|
40 const TUint KNameMaxLength = 63; |
|
41 const TUint KDescriptionMaxLength = 255; |
|
42 const TInt KDefaultTimedSamplingPeriod = 60; // Sampling time in seconds |
|
43 /* |
|
44 * |
|
45 * TGeneralAttributes class definition, internal settings format |
|
46 * |
|
47 */ |
|
48 class TGeneralAttributes |
|
49 { |
|
50 public: |
|
51 TBuf8<KPrefixMaxLength> iTraceOutput; |
|
52 TBuf8<KPrefixMaxLength> iTraceFilePrefix; |
|
53 TBuf8<KPrefixMaxLength> iSaveFileDrive; |
|
54 TInt iTimedSamplingPeriod; |
|
55 }; |
|
56 |
|
57 |
|
58 |
|
59 /* |
|
60 * |
|
61 * TSettingItem class definition, internal settings format |
|
62 * |
|
63 */ |
|
64 class TSettingItem |
|
65 { |
|
66 public: |
|
67 enum |
|
68 { |
|
69 ESettingItemTypeInt = 0, |
|
70 ESettingItemTypeBool, |
|
71 ESettingItemTypeHex, |
|
72 ESettingItemTypeText |
|
73 }; |
|
74 |
|
75 public: |
|
76 TBuf<64> iSettingText; |
|
77 TUint32 iType; |
|
78 TBuf<128> iValue; |
|
79 TBuf<256> iSettingDescription; |
|
80 TBuf<64> iUIText; |
|
81 }; |
|
82 /* |
|
83 * |
|
84 * TSamplerAttributes class definition, internal settings format |
|
85 * |
|
86 */ |
|
87 class TSamplerAttributes |
|
88 { |
|
89 public: |
|
90 // default constructor |
|
91 TSamplerAttributes(); |
|
92 // constructor |
|
93 TSamplerAttributes(TInt32 aUid, |
|
94 const TDesC8& aShortName, |
|
95 const TDesC8& aName, |
|
96 const TDesC8& aDescription, |
|
97 TInt aSampleRate, |
|
98 TBool aEnabled, |
|
99 TBool aHidden, |
|
100 TInt aItemCount); |
|
101 public: |
|
102 TInt32 iUid; |
|
103 TBuf8<8> iShortName; // name of the plugin, short name |
|
104 TBuf8<64> iName; // name of the plugin, long name |
|
105 TBuf8<256> iDescription; // sampler description, info about HW/SW dependencies etc. |
|
106 TInt iSampleRate; // sample rate of the plugin |
|
107 TBool iEnabled; // enabled for profiling |
|
108 TBool iIsHidden; // hidden, i.e. no start/stop controls |
|
109 TInt iItemCount; // plugin specific setting item count |
|
110 |
|
111 // plugin specific settings, plugin implementation dependent |
|
112 TSettingItem iSettingItem1; |
|
113 TSettingItem iSettingItem2; |
|
114 TSettingItem iSettingItem3; |
|
115 TSettingItem iSettingItem4; |
|
116 TSettingItem iSettingItem5; |
|
117 TSettingItem iSettingItem6; |
|
118 }; |
|
119 |
|
120 inline TSamplerAttributes::TSamplerAttributes() |
|
121 {} |
|
122 |
|
123 inline TSamplerAttributes::TSamplerAttributes(TInt32 aUid, |
|
124 const TDesC8& aShortName, |
|
125 const TDesC8& aName, |
|
126 const TDesC8& aDescription, |
|
127 TInt aSampleRate, |
|
128 TBool aEnabled, |
|
129 TBool aHidden, |
|
130 TInt aItemCount) |
|
131 { |
|
132 iUid = aUid; |
|
133 // check if given short name too long |
|
134 aShortName.Length() > KShortNameMaxLength ? |
|
135 iShortName.Copy(aShortName.Left(KShortNameMaxLength)) : |
|
136 iShortName.Copy(aShortName); |
|
137 // check if given name too long |
|
138 aName.Length() > KNameMaxLength ? |
|
139 iName.Copy(aName.Left(KNameMaxLength)) : |
|
140 iName.Copy(aName); |
|
141 // check if description too long |
|
142 aDescription.Length() > KDescriptionMaxLength ? |
|
143 iDescription.Copy(aDescription.Left(KDescriptionMaxLength)) : |
|
144 iDescription.Copy(aDescription); |
|
145 iSampleRate = aSampleRate; |
|
146 iEnabled = aEnabled; |
|
147 iIsHidden = aHidden; |
|
148 iItemCount = aItemCount; |
|
149 } |
|
150 |
|
151 #endif |
|