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