Skip to content
This repository
tree: a76b1c4915
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 45 lines (33 sloc) 0.984 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
#ifndef _XSCRIPT_AVERAGE_COUNTER_H_
#define _XSCRIPT_AVERAGE_COUNTER_H_

#include <string>
#include <memory>
#include <boost/cstdint.hpp>

#include <xscript/component.h>
#include <xscript/counter_base.h>

namespace xscript {

/**
* Time statistic gatherer. min/max/avg time for something.
*/
class AverageCounter : public CounterBase {

public:
    /**
* Add single measure.
*/
    virtual void add(boost::uint64_t value) = 0;

    /**
* Remove single measure.
*/
    virtual void remove(boost::uint64_t value) = 0;
};

class AverageCounterFactory : public Component<AverageCounterFactory> {
public:

    friend class ComponentRegisterer<AverageCounterFactory>;

    /**
* By default factory produces DummyCounters. But if some block really need counter
* he can ask.
*/
    virtual std::auto_ptr<AverageCounter> createCounter(const std::string& name, bool want_real = false) = 0;
};

} // namespace xscript

#endif // _XSCRIPT_AVERAGE_COUNTER_H_
Something went wrong with that request. Please try again.