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