00001 /* ratio.h 00002 */ 00003 #ifndef _RATIO_H 00004 #define _RATIO_H 00005 00006 #include "osl/stat/average.h" 00007 00008 namespace osl 00009 { 00010 namespace stat 00011 { 00012 class Ratio 00013 { 00014 Average ave; 00015 const char *name; 00016 public: 00017 Ratio(const char *n=0) : name(n) 00018 { 00019 } 00020 ~Ratio(); 00021 void add(bool success) { ave.add(success ? 1.0 : 0.0); } 00022 double ratio() const { return ave.getAverage(); } 00023 }; 00024 } // namespace stat 00025 } // namespace osl 00026 00027 00028 #endif /* _RATIO_H */ 00029 // ;;; Local Variables: 00030 // ;;; mode:c++ 00031 // ;;; c-basic-offset:2 00032 // ;;; End: