libraries/extrabtrace/src/sampler.h
changeset 0 7f656887cf89
equal deleted inserted replaced
-1:000000000000 0:7f656887cf89
       
     1 // sampler.h
       
     2 // 
       
     3 // Copyright (c) 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 #ifndef EXTRABTRACE_SAMPLER_H
       
    13 #define EXTRABTRACE_SAMPLER_H
       
    14 
       
    15 #include <fshell/extrabtracek.h>
       
    16 #include <kernel.h>
       
    17 
       
    18 NONSHARABLE_CLASS(DCpuSampler) : public DBase
       
    19 	{
       
    20 public:
       
    21 	DCpuSampler();
       
    22 	~DCpuSampler();
       
    23 
       
    24 	void SetCpuUsageSampling(MExtraBtrace::TCpuUsageCallback aCallbackFn);
       
    25 	void SetProfilingSampling(TBool aEnabled);
       
    26 
       
    27 private:
       
    28 	static void Sample(TAny* aPtr);
       
    29 	void DoSample();
       
    30 	void Usample(NThread* aThread);
       
    31 	void SettingsChanged();
       
    32 	TBool ShouldRun() const;
       
    33 
       
    34 private:
       
    35 	NThread* iContext;
       
    36 	NTimer iTimer;
       
    37 	TInt iTimerHeartbeat;
       
    38 	TUint* iIntStackTop; // I don't understand this, but whover wrote it originally hopefully did!
       
    39 	TBool iProfiling;
       
    40 	MExtraBtrace::TCpuUsageCallback iCpuUsageCallbackFn;
       
    41 	};
       
    42 
       
    43 #endif