commands/memsampler/memsamplerdd.h
changeset 0 7f656887cf89
equal deleted inserted replaced
-1:000000000000 0:7f656887cf89
       
     1 // memsamplerdd.h
       
     2 // 
       
     3 // Copyright (c) 2008 - 2010 Accenture. All rights reserved.
       
     4 // This component and the accompanying materials are made available
       
     5 // under the terms of the "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 // Accenture - Initial contribution
       
    11 //
       
    12 
       
    13 #ifndef __MEMSAMPLERDD_H__
       
    14 #define __MEMSAMPLERDD_H__
       
    15 
       
    16 #include <e32cmn.h>
       
    17 #ifndef __KERNEL_MODE__
       
    18 #include <e32std.h>
       
    19 #endif
       
    20 
       
    21 //Uncomment this line to generate debug logging of the profiler and sampler.
       
    22 #define DEBUG_MEMSAMPLER(f) f
       
    23 //#define DEBUG_MEMSAMPLER(f)
       
    24 
       
    25 
       
    26 /**
       
    27  * The user device driver class for controlling the memory usage sampler.
       
    28  */
       
    29 class RMemSampler : public RBusLogicalChannel
       
    30 	{
       
    31 public:
       
    32 	enum
       
    33 		{
       
    34 		EBtraceCategory = 253
       
    35 		};
       
    36 	enum
       
    37 		{
       
    38 		ENewChunk,
       
    39 		EChangedChunk,
       
    40 		EDeletedChunk,
       
    41 		ENewSample
       
    42 		};
       
    43 	friend class DMemSamplerChannel;
       
    44 private:
       
    45 	enum TControl
       
    46 		{
       
    47 		EControlStartProfile,
       
    48 		EControlStopProfile,
       
    49 		EControlResetProfile
       
    50 		};
       
    51 	enum TRequest
       
    52 		{
       
    53 		ERequestRead
       
    54 		};
       
    55 	static inline TInt CancelRequest(TRequest aRequest);
       
    56 public:
       
    57 #ifndef __KERNEL_MODE__
       
    58 	inline TInt Open();
       
    59 	inline void Start(TInt aRate);
       
    60 	inline void Stop();
       
    61 	inline void Reset();
       
    62 #endif
       
    63 	};
       
    64 
       
    65 _LIT(KMemSamplerName,"memsamplerdd");
       
    66 
       
    67 #ifndef __KERNEL_MODE__
       
    68 
       
    69 inline TInt RMemSampler::Open()
       
    70 	{return DoCreate(KMemSamplerName,TVersion(1,0,0),KNullUnit,NULL,NULL);}
       
    71 
       
    72 inline void RMemSampler::Start(TInt aRate)
       
    73 	{DoControl(EControlStartProfile, reinterpret_cast<TAny*>(aRate));}
       
    74 
       
    75 inline void RMemSampler::Stop()
       
    76 	{DoControl(EControlStopProfile);}
       
    77 
       
    78 inline void RMemSampler::Reset()
       
    79 	{DoControl(EControlResetProfile);}
       
    80 
       
    81 
       
    82 #endif
       
    83 
       
    84 #endif