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

#ifndef POLYGRAPH__BASE_PROGRESS_H
#define POLYGRAPH__BASE_PROGRESS_H

#include "xstd/Time.h"

class OLog;
class ILog;

// global progress record, updated by stat cycles
class Progress {
	public:
		Progress();

		int xacts() const { return theXactCnt; }
		int sslXacts() const { return theSslXactCnt; }
		int errs() const { return theErrCnt; }
		Time time() const;

		void success() { theXactCnt++; }
		void sslSuccess() { theSslXactCnt++; }
		void failure() { theErrCnt++; }

		void store(OLog &ol) const;
		void load(ILog &il);
		ostream &print(ostream &os) const;

	protected:
		Time theTimestamp; // place to keep Clock after load()
		int theXactCnt;    // all successful completions
		int theSslXactCnt; // ssl successful completions
		int theErrCnt;     // all failed transactions
};

extern Progress TheProgress;

#endif


syntax highlighted by Code2HTML, v. 0.9.1