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

StatPKFile.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 Fri Apr 29 00:26:30 EDT 2005 by ken@xorian.net        
00020 //      modified on Mon Jul 15 17:10:29 EDT 2002 by kcschalk@shr.intel.com
00021 //      modified on Fri Mar 28 17:13:18 PST 1997 by heydon
00022 
00023 /* StatPKFile.H 
00024 
00025    Defines objects and iterators at level 2 of the stable cache hierarchy,
00026    namely, at the level of sets of cache entries with the same primary
00027    key (PK). Abstractly, a "PKFileObj" is a collection of "CFPObj" objects.
00028 */
00029 
00030 #ifndef _STAT_PKFILE_H
00031 #define _STAT_PKFILE_H
00032 
00033 #include <Basics.H>
00034 #include "SPKFileRep.H"
00035 #include "SMultiPKFileRep.H"
00036 #include "SPKFile.H"
00037 #include "StatCFP.H"
00038 #include "StatCollection.H"
00039 
00040 class PKFileIter; // defined below
00041 
00042 class PKFileObj {
00043   public:
00044     PKFileObj(const Stat::Location &parent_loc,
00045               const SMultiPKFileRep::HeaderEntry *he) throw ()
00046       : len(he->pkLen), pkHdr(he->pkhdr), pkFile(he->pkfile)
00047     {
00048       loc = NEW_CONSTR(Stat::Location,
00049                        (parent_loc.add_pk(pkFile->PK(),
00050                                           pkFile->SourceFunc())));
00051     }
00052     /* Create a new "PKFileObj" from the MultiPKFile header entry "he". */
00053 
00054     int Search(int verbose, /*INOUT*/ Stat::Collection &stats) const throw ();
00055     /* Search this PKFileObj, returning the height of the PKFileObj
00056        in the search tree (i.e., 2). Update "entryStats" with statistical
00057        values at the leaves of the subtree rooted at this PKFileObj;
00058        update "fanout" at all levels at and below this PKFileObj with
00059        the fanout of each object in the subtree. */
00060 
00061   private:
00062     int len;
00063     const SPKFileRep::Header *pkHdr;
00064     const SPKFile *pkFile;
00065     Stat::Location *loc;
00066 
00067     friend class PKFileIter;
00068 };
00069 
00070 class PKFileIter {
00071   public:
00072     PKFileIter(const PKFileObj *pkf) throw ();
00073     /* Initialize this iterator on the PKFileObj "pkf". */
00074 
00075     bool Next(/*OUT*/ CFPObj* &cfp) throw ();
00076     /* If the iterator is not finished, set "cfp" to point to the next
00077        "CFPObj" in it and return true. Otherwise, return false. */
00078 
00079   private:
00080     const PKFileObj* pkf;
00081     const SPKFileRep::Header *pkHdr;
00082     const SPKFile::CFPEntryMap *cfpEntryMap;
00083     int cfpIndex;
00084 };
00085 
00086 #endif // _STAT_PKFILE_H

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