00001
00002
00003 #ifndef _STAT_ACTIVITYCOUNT_H
00004 #define _STAT_ACTIVITYCOUNT_H
00005
00006 #include <boost/scoped_array.hpp>
00007 #include <cassert>
00008
00009 namespace osl
00010 {
00011 namespace stat
00012 {
00013 class ActivityCount
00014 {
00015 protected:
00016 boost::scoped_array<int> counts;
00017 const unsigned int length;
00018 public:
00019 explicit ActivityCount(unsigned int length);
00020 ~ActivityCount();
00021
00022 void clear();
00023 void add(unsigned int index, unsigned int count=1)
00024 {
00025 assert(index < length);
00026 counts[index] += count;
00027 }
00028 void show(const char *filename) const;
00032 void setBinary(int threshold);
00033 void loadBinary(const char *filename, int threshold);
00034 bool isActive(unsigned int index) const
00035 {
00036 assert(index < length);
00037 return counts[index];
00038 }
00039 };
00040 }
00041 }
00042
00043
00044 #endif
00045
00046
00047
00048