Skip to content
This repository
tree: a76b1c4915
Fetching contributors…

Cannot retrieve contributors at this time

file 33 lines (27 sloc) 0.827 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
#ifndef _XSCRIPT_INTERNAL_CACHE_USAGE_COUNTER_IMPL_H
#define _XSCRIPT_INTERNAL_CACHE_USAGE_COUNTER_IMPL_H

#include <string>
#include <map>
#include "xscript/cache_usage_counter.h"
#include "internal/counter_impl.h"

namespace xscript {

/**
* Counter for measure cache usage statistic.
*/
class CacheUsageCounterImpl : virtual public CacheUsageCounter, virtual private CounterImpl {
public:
    CacheUsageCounterImpl(const std::string& name);
    virtual XmlNodeHelper createReport() const;

    void fetched(const std::string& name);
    void stored(const std::string& name);
    void removed(const std::string& name);
    void reset();
    void max(boost::uint64_t val);

private:
    std::map<std::string, int> counter_;
    double average_usage_;
    unsigned long long elements_;
    boost::uint64_t max_;
};
}

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