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 Mon Nov 10 17:34:26 EST 2003 by ken@xorian.net 00020 // modified on Fri May 23 15:43:29 PDT 1997 by heydon 00021 00022 /* StatCFP.H 00023 00024 Defines objects and iterators at level 1 of the stable cache hierarchy, 00025 namely, at the level of sets of cache entries with a common fingerprint 00026 (CFP). Abstractly, a "CFPObj" is a collection of cache entries. 00027 */ 00028 00029 #ifndef _STAT_CFP_H 00030 #define _STAT_CFP_H 00031 00032 #include <Basics.H> 00033 #include <FP.H> 00034 #include "SPKFile.H" 00035 #include "CacheEntry.H" 00036 #include "StatCount.H" 00037 #include "StatCollection.H" 00038 00039 class CFPIter; // defined below 00040 00041 class CFPObj { 00042 public: 00043 CFPObj(Stat::Location *loc, const SPKFile *pkFile, 00044 FP::Tag cfp, CE::List *entries) throw () 00045 : loc(loc), pkFile(pkFile), cfp(cfp), entries(entries) { /*SKIP*/ } 00046 /* Initialize this CFPObj for the common fingerprint "cfp" with 00047 corresponding cache entries "entries". */ 00048 00049 int Search(int verbose, /*INOUT*/ Stat::Collection &stats) const throw (); 00050 /* Search this CFPObj, returning the height of the CFPObj in the search 00051 tree (i.e., 1). Update "entryStats" with statistical values at the 00052 leaves of the subtree rooted at this CFPObj; update "fanout" at all 00053 levels at and below this CFPObj with the fanout of each object in the 00054 subtree. */ 00055 00056 private: 00057 // The PKFile we belong to. Used for access to free variable 00058 // names. 00059 const SPKFile *pkFile; 00060 00061 FP::Tag cfp; 00062 CE::List *entries; 00063 Stat::Location *loc; 00064 00065 friend class CFPIter; 00066 }; 00067 00068 class CFPIter { 00069 public: 00070 CFPIter(const CFPObj *cfp) throw () 00071 : next(cfp->entries) { /*SKIP*/ } 00072 /* Initialize this iterator on the CFPObj "cfp". */ 00073 00074 bool Next(/*OUT*/ CE::T* &ce) throw (); 00075 /* If the iterator is not finished, set "ce" to point to the next cache 00076 entry in it and return true. Otherwise, return false. */ 00077 00078 private: 00079 CE::List *next; 00080 }; 00081 00082 #endif // _STAT_CFP_H