/* Web Polygraph       http://www.web-polygraph.org/
 * (C) 2003-2006 The Measurement Factory
 * Licensed under the Apache License, Version 2.0 */

#ifndef POLYGRAPH__BASE_STATPHASEREC_H
#define POLYGRAPH__BASE_STATPHASEREC_H

#include "base/StatIntvlRec.h"
#include "base/GoalRec.h"
#include "base/ContTypeStat.h"
#include "base/ConnCloseStat.h"
#include "base/HRHistStat.h"
#include "base/ErrorStat.h"
#include "base/OidGenStat.h"
#include "base/histograms.h"

class StatPhaseMgr;

// accumulates all phase stats that are not handled by StatIntvlRec

class StatPhaseRec: public StatIntvlRec {
	public:
		StatPhaseRec();
	
		const String &name() const { return theName; }

		void repAll(TmSzHistStat &all) const;

		virtual OLog &store(OLog &log) const;
		virtual ILog &load(ILog &);

		void concat(const StatPhaseRec &p); // sequential phases
		void merge(const StatPhaseRec &p);  // concurrent phases

		ostream &print(ostream &os, const String &pfx) const;

	protected:
		void join(const StatPhaseRec &p);

	public: // read-only
		String theName;
		GoalRec theGoal;  // maintained for us

		ContTypeStat theContType;   // per-content-type stats
		ConnCloseStat theConnClose; // pre-conn-close-class stats

		SizeHist theSockRdSzH;   // socket reads
		SizeHist theSockWrSzH;   // socket writes

		/* HTTP */
		HRHistStat theBasicXacts;
		TmSzHistStat theRediredReqXacts;
		TmSzHistStat theRepToRedirXacts;
		HRHistStat theImsXacts;
		TmSzHistStat theReloadXacts;
		TmSzHistStat theHeadXacts;
		TmSzHistStat thePutXacts;
		TmSzHistStat thePostXacts;
		LineHist theConnPipelineDepths;
		TmSzHistStat thePageHist;

		/* ICP */
		HRHistStat theIcpXacts;

		OidGenStat theOidGen;
		ErrorStat theErrors;
};

#endif


syntax highlighted by Code2HTML, v. 0.9.1