00001
00002 #include <cstdlib>
00003 #include <string>
00004 #include <iostream>
00005 #include <sstream>
00006 #include "STATUS.hpp"
00007 #include "CACHE_SET_COLLECTION.hpp"
00008
00045 #ifndef _H_CS_CACHE
00046 #define _H_CS_CACHE
00047
00049 class CACHE {
00050 private:
00052 static CACHE* _instance;
00053
00054 protected:
00055
00057 unsigned long int REINIT;
00058
00060 unsigned long int _l;
00061
00063 unsigned long int _s;
00064
00066 unsigned long int _k;
00067
00069 unsigned long int _sdl;
00070
00072 unsigned long int _ldk;
00073
00075 CACHE_SET_COLLECTION** _csccollections;
00076
00078 STATUS _status;
00079
00081 CACHE_SET_COLLECTION* getCacheLines( unsigned long int setID );
00082
00083 public:
00084
00091 static CACHE* getInstance();
00092
00094 static void createInstance( unsigned long int l, unsigned long int s, unsigned long int k );
00095
00097 static void recreateInstance( unsigned long int l, unsigned long int s, unsigned long int k );
00098
00100 void clearStatistics();
00101
00103 const STATUS &getStatus();
00104
00106 CACHE( unsigned long int l, unsigned long int s, unsigned long int k );
00107
00109 bool hitOrMiss( void* pointer, unsigned long int size );
00110
00112 void access( void* pointer, const unsigned long int size, unsigned long int &FAC );
00113
00115 std::string properties();
00116
00118 void clear();
00119
00120
00121
00122
00123 };
00124
00125 #endif
00126