Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members

LookupStats.H

Go to the documentation of this file.
00001 // Copyright (C) 2001, Compaq Computer Corporation
00002 // 
00003 // This file is part of Vesta.
00004 // 
00005 // Vesta is free software; you can redistribute it and/or
00006 // modify it under the terms of the GNU Lesser General Public
00007 // License as published by the Free Software Foundation; either
00008 // version 2.1 of the License, or (at your option) any later version.
00009 // 
00010 // Vesta is distributed in the hope that it will be useful,
00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013 // Lesser General Public License for more details.
00014 // 
00015 // You should have received a copy of the GNU Lesser General Public
00016 // License along with Vesta; if not, write to the Free Software
00017 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00018 
00019 // Last modified on Tue Aug  3 16:36:21 EDT 2004 by ken@xorian.net
00020 //      modified on Mon Jul 15 09:26:27 PDT 1996 by heydon
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     // lookup data for a single lookup outcome
00032     class Datum {
00033       public:
00034         // data fields
00035         Basics::uint64 num;                 // number of this operation
00036         Timer::MicroSecs totalTime;        // total time for this operation
00037         Timer::MicroSecs minTime, maxTime; // minimum/maximum times seen
00038 
00039         // constructor
00040         Datum() throw ()
00041           : num(0), totalTime(0UL), minTime(0UL), maxTime(0UL)
00042           { /* SKIP */ }
00043 
00044         // update
00045         void Update(Timer::MicroSecs tm) throw ();
00046         /* Update this lookup datum to record a new event taking "tm"
00047            microseconds. */
00048 
00049         void Update(const Datum &d) throw ();
00050         /* Aggregate the lookup data in "d" into this datum. */
00051 
00052         // send/receive
00053         void Send(SRPC &srpc) const throw (SRPC::failure);
00054         void Recv(SRPC &srpc) throw (SRPC::failure);
00055 
00056         // print
00057         void Print(std::ostream &os, const char *label, int labelWidth,
00058           Timer::MicroSecs total, int indent = 2) const throw ();
00059     };
00060 
00061     // the kinds of lookup outcomes
00062     enum Kind {NewHits, WarmHits, DiskHits, AllMisses, NumKinds, NoOutcome};
00063 
00064     // a record of various kinds of lookup outcomes
00065     class Rec {
00066       public:
00067         // data fields
00068         Datum datum[NumKinds];
00069 
00070         // send/receive
00071         void Send(SRPC &srpc) const throw (SRPC::failure);
00072         void Recv(SRPC &srpc) throw (SRPC::failure);
00073 
00074         // print
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 // _LOOKUP_STATS_H
00082 

Generated on Mon May 8 00:48:32 2006 for Vesta by  doxygen 1.4.2