kerneltest/e32utils/analyse/activity.h
changeset 0 a41df078684a
equal deleted inserted replaced
-1:000000000000 0:a41df078684a
       
     1 // Copyright (c) 2000-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of the License "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 #ifndef __ACTIVITY__
       
    17 #define __ACTIVITY__
       
    18 
       
    19 #include "trace.h"
       
    20 #include <map>
       
    21 #include <vector>
       
    22 
       
    23 class Activity : public Sampler
       
    24 	{
       
    25 	struct Bucket
       
    26 		{
       
    27 		inline Bucket(unsigned aPeriod,int aThread);
       
    28 		bool operator<(const Bucket& aRhs) const;
       
    29 		//
       
    30 		unsigned iPeriod;
       
    31 		int iThread;
       
    32 		};
       
    33 	struct ThreadData
       
    34 		{
       
    35 		inline ThreadData(const Thread& aThread);
       
    36 		inline ThreadData(unsigned aCutoff);
       
    37 		inline bool operator<(const ThreadData& aRhs) const;
       
    38 		//
       
    39 		const Thread* iThread;
       
    40 		unsigned iTotal;
       
    41 		};
       
    42 	typedef std::map<Bucket,unsigned> Data;
       
    43 	typedef std::vector<ThreadData> Threads;
       
    44 public:
       
    45 	Activity(int aBucketSize, unsigned aBeginSample, double aCutOff);
       
    46 private:
       
    47 	void Sample(unsigned aNumber, const Thread& aThread, PC aPc);
       
    48 	void Complete(unsigned aTotal, unsigned aActive);
       
    49 private:
       
    50 	int iBucketSize;
       
    51 	unsigned iBeginSample;
       
    52 	double iCutOff;
       
    53 	Threads iThreads;
       
    54 	Data iData;
       
    55 	};
       
    56 
       
    57 #endif // __ACTIVITY__