00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef _LOOKUP_STATS_H
00023 #define _LOOKUP_STATS_H
00024
00025 #include <Basics.H>
00026 #include <SRPC.H>
00027 #include "Timer.H"
00028
00029 class LookupStats {
00030 public:
00031
00032 class Datum {
00033 public:
00034
00035 Basics::uint64 num;
00036 Timer::MicroSecs totalTime;
00037 Timer::MicroSecs minTime, maxTime;
00038
00039
00040 Datum() throw ()
00041 : num(0), totalTime(0UL), minTime(0UL), maxTime(0UL)
00042 { }
00043
00044
00045 void Update(Timer::MicroSecs tm) throw ();
00046
00047
00048
00049 void Update(const Datum &d) throw ();
00050
00051
00052
00053 void Send(SRPC &srpc) const throw (SRPC::failure);
00054 void Recv(SRPC &srpc) throw (SRPC::failure);
00055
00056
00057 void Print(std::ostream &os, const char *label, int labelWidth,
00058 Timer::MicroSecs total, int indent = 2) const throw ();
00059 };
00060
00061
00062 enum Kind {NewHits, WarmHits, DiskHits, AllMisses, NumKinds, NoOutcome};
00063
00064
00065 class Rec {
00066 public:
00067
00068 Datum datum[NumKinds];
00069
00070
00071 void Send(SRPC &srpc) const throw (SRPC::failure);
00072 void Recv(SRPC &srpc) throw (SRPC::failure);
00073
00074
00075 friend std::ostream& operator << (std::ostream &os, const LookupStats::Rec &r)
00076 throw () { r.Print(os); return os; }
00077 void Print(std::ostream &os, int indent = 2) const throw ();
00078 };
00079 };
00080
00081 #endif
00082