piprofiler/plugins/GeneralsPlugin/inc/IttEventHandler.h
changeset 22 a009639409f5
equal deleted inserted replaced
17:67c6ff54ec25 22:a009639409f5
       
     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:  Event based ITT sampler skeleton copypasted from MemoryEventHandler.h
       
    15 *
       
    16 */
       
    17 #include "IttSamplerImpl.h"
       
    18 
       
    19 #ifndef __PI_ITT_EVENT_HANDLER__
       
    20 #define __PI_ITT_EVENT_HANDLER__
       
    21 
       
    22 #include <piprofiler/ProfilerGenericClassesKrn.h>
       
    23 
       
    24 // CONSTANTS
       
    25 const TInt KITTBufferSize = 256;
       
    26 
       
    27 class DProfilerSampleBuffer;
       
    28 
       
    29 /*
       
    30  * ITT event handler for listaning kernel events 
       
    31  */
       
    32 class DIttEventHandler : public DKernelEventHandler
       
    33     {
       
    34 public:
       
    35     // constructor
       
    36     DIttEventHandler(DProfilerSampleBuffer*  aSampleBuffer, TProfilerGppSamplerData* aGppSamplerDataIn);
       
    37     TInt Create();
       
    38     ~DIttEventHandler();
       
    39     TInt Start();
       
    40     TInt Stop();
       
    41     TBool Tracking() {return iTracking;}
       
    42        
       
    43     TBool SampleNeeded();
       
    44     
       
    45 private:
       
    46     static TUint EventHandler(TKernelEvent aEvent, TAny* a1, TAny* a2, TAny* aThis);
       
    47     TUint HandleEvent(TKernelEvent aType, TAny* a1, TAny* a2);
       
    48     // handle code segments
       
    49     TBool HandleAddCodeSeg(DCodeSeg* aSeg);
       
    50     TBool HandleRemoveCodeSeg(DCodeSeg* aSeg);
       
    51 
       
    52 private:
       
    53     /** Lock serialising calls to event handler */
       
    54         DMutex*     iLock;
       
    55         TBool       iTracking;
       
    56         DProfilerSampleBuffer*  iSampleBuffer;
       
    57 
       
    58         TUint32     iCount;        
       
    59         
       
    60         TUint8      iSample[KITTBufferSize];
       
    61         TPtr8       iSampleDescriptor;
       
    62         TProfilerGppSamplerData*     gppSamplerData;
       
    63     };
       
    64 
       
    65 #endif  //__PI_ITT_EVENT_HANDLER__