|
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_GENERALSECOM_SAMPLER_H |
|
20 #define PROFILER_GENERALSECOM_SAMPLER_H |
|
21 |
|
22 #include <w32std.h> |
|
23 #include <StringLoader.h> |
|
24 |
|
25 #include "GeneralsDriver.h" |
|
26 #include "GeneralsConfig.h" |
|
27 #include <piprofiler/SamplerPluginInterface.h> |
|
28 #include <piprofiler/ProfilerGenericClassesUsr.h> |
|
29 |
|
30 // constants |
|
31 const TUint KDefaultOutputCombination = 3; |
|
32 |
|
33 const TUint KSubSamplerCount = 5; |
|
34 |
|
35 // parent itself |
|
36 _LIT(KGENShortName, "gen"); |
|
37 _LIT(KGENMediumName, "Generic samplers plug-in"); |
|
38 _LIT(KGENLongName, "Generic samplers plug-in"); |
|
39 |
|
40 // gpp caption definitions |
|
41 _LIT8(KGPPShortName, "gpp"); |
|
42 #ifdef CARBIDE_NAMES |
|
43 _LIT8(KGPPLongName, "Address/Thread sampling"); |
|
44 #else |
|
45 _LIT8(KGPPLongName, "CPU load sampler"); |
|
46 #endif |
|
47 _LIT8(KGPPDescription, "CPU load sampler\nSampling thread and process load\nHW dep: N/A\nSW dep: S60 3.0\n"); |
|
48 |
|
49 // gfc caption definitions |
|
50 _LIT8(KGFCShortName, "gfc"); |
|
51 #ifdef CARBIDE_NAMES |
|
52 _LIT8(KGFCLongName, "Function call sampling"); |
|
53 #else |
|
54 _LIT8(KGFCLongName, "Function call sampler"); |
|
55 #endif |
|
56 _LIT8(KGFCDescription, "Function call sampler\nCapturing function call info\nHW dep: N/A\nSW dep: S60 3.0\n"); |
|
57 |
|
58 // itt caption definitions |
|
59 _LIT8(KITTShortName, "itt"); |
|
60 #ifdef CARBIDE_NAMES |
|
61 _LIT8(KITTLongName, "Dynamic binary support"); |
|
62 #else |
|
63 _LIT8(KITTLongName, "Instruction trace sampler"); |
|
64 #endif |
|
65 _LIT8(KITTDescription, "Instruction trace sampler\nTracing instructions executed on ROFS\nHW dep: N/A\nSW dep: S60 3.0\n"); |
|
66 |
|
67 // mem caption definitions |
|
68 _LIT8(KMEMShortName, "mem"); |
|
69 #ifdef CARBIDE_NAMES |
|
70 _LIT8(KMEMLongName, "Memory usage sampler"); |
|
71 #else |
|
72 _LIT8(KMEMLongName, "Memory trace sampler"); |
|
73 #endif |
|
74 _LIT8(KMEMDescription, "Memory trace sampler\nTracing memory, i.e. stack and chunk usage\nHW dep: N/A\nSW dep: S60 3.0\n"); |
|
75 |
|
76 // pri caption definitions |
|
77 _LIT8(KPRIShortName, "pri"); |
|
78 #ifdef CARBIDE_NAMES |
|
79 _LIT8(KPRILongName, "Thread priority sampling"); |
|
80 #else |
|
81 _LIT8(KPRILongName, "Priority trace sampler"); |
|
82 #endif |
|
83 _LIT8(KPRIDescription, "Priority trace sampler\nTracing thread priorities\nHW dep: N/A\nSW dep: S60 3.0\n"); |
|
84 |
|
85 |
|
86 // forward definitions |
|
87 class CConfigInfoArray; |
|
88 class CProfilerBufferHandler; |
|
89 class CProfilerSampleStream; |
|
90 class TSamplerAttributes; |
|
91 |
|
92 class CGeneralsPlugin : public CSamplerPluginInterface |
|
93 { |
|
94 public: |
|
95 static CGeneralsPlugin* NewL(const TUid aImplementationUid, TAny* /*aInitParams*/); |
|
96 ~CGeneralsPlugin(); |
|
97 |
|
98 TUint32 GetSampleTime(); |
|
99 |
|
100 /* |
|
101 * Sub sampler specific functions |
|
102 * |
|
103 */ |
|
104 TInt GetSamplerUidByName(TDesC8& name); |
|
105 |
|
106 // from CSamplerPluginInterface |
|
107 TInt ResetAndActivateL(CProfilerSampleStream& aStream); |
|
108 TInt StopSampling(); |
|
109 TBool Enabled() { return iEnabled; } |
|
110 |
|
111 TUid Id( TInt aSubId ) const; |
|
112 TInt SubId( TUid aSubId ) const; // internal |
|
113 |
|
114 void GetAttributesL(CArrayFixFlat<TSamplerAttributes>* aAttributes); |
|
115 TInt SetAttributesL(TSamplerAttributes aAttributes); |
|
116 void InitiateSamplerAttributesL(); |
|
117 |
|
118 TInt ConvertRawSettingsToAttributes(CDesC8ArrayFlat* aSingleSettingArray); |
|
119 TInt DoSetSamplerSettings(CDesC8ArrayFlat* aAllSettings, TDesC8& aSamplerName, TInt aIndex); |
|
120 void SaveSettingToAttributes(const TDesC8& aSetting, TInt aIndex); |
|
121 |
|
122 void GetCaption( TDes& aCaption, TInt aType, TInt aSubId ) const; |
|
123 |
|
124 TInt GetSamplerType(); |
|
125 |
|
126 void InstallStreamForActiveTraces(RGeneralsSampler& sampler, CProfilerSampleStream& aStream); |
|
127 |
|
128 private: |
|
129 CGeneralsPlugin(); |
|
130 void ConstructL(); |
|
131 |
|
132 TInt InitiateSamplerL(); |
|
133 TInt CleanSampler(); |
|
134 void SetSettingsToSamplers(); |
|
135 |
|
136 private: |
|
137 TUint8 iVersion[20]; |
|
138 TPtr8 iVersionDescriptor; |
|
139 |
|
140 RGeneralsSampler iGeneralsSampler; |
|
141 |
|
142 CProfilerBufferHandler* iBufferHandler; |
|
143 |
|
144 CArrayFixFlat<TSamplerAttributes>* iSamplerAttributes; |
|
145 |
|
146 TBuf8<9> iSearchTexts; |
|
147 public: |
|
148 TUint32* iSampleTime; |
|
149 }; |
|
150 |
|
151 #endif |