00001 // =================================================================== 00002 // Per_Process_Consumer.hh 00003 // Scott F. H. Kaplan -- sfkaplan@cs.amherst.edu 00004 // November 2002 00005 00006 // A subclass of Consumer that emits one basic, page-level reference 00007 // trace for each process. Both virtual and logical page numbers are 00008 // emitted with each record so that the spatial locality of references 00009 // in the virtual address space is maintained, but the sharing of 00010 // space between processes is also revealed. 00011 00012 // The trace takes the following form: 00013 // =================================================================== 00014 00015 00016 00017 // =================================================================== 00018 // Avoid multiple inclusion. 00019 #if !defined (_BASIC_CONSUMER_HH) 00020 #define _BASIC_CONSUMER_HH 00021 // =================================================================== 00022 00023 00024 00025 // =================================================================== 00026 // INCLUDES 00027 00028 #include "Consumer.hh" 00029 // =================================================================== 00030 00031 00032 00033 // =================================================================== 00034 // CLASS DEFINITION 00035 00036 class Basic_Consumer : public Consumer { 00037 00038 public: // CONSTRUCTOR & DESTRUCTOR 00039 00040 Basic_Consumer (const char* const reference_pathname, 00041 const char* const kernel_pathname); 00042 00043 virtual ~Basic_Consumer (); 00044 00045 protected: // VIRTUAL METHODS 00046 00047 // Called before processing begins. 00048 virtual void initialize () {} 00049 00050 // Called after processing ends. 00051 virtual void clean_up () {} 00052 00053 // Called after processing a reference record. 00054 virtual void act_on_reference_record (); 00055 00056 // Called after processing a kernel record. 00057 virtual void act_on_kernel_record () {} 00058 00059 protected: // SUPPORT METHODS 00060 00061 // Obtain a logical page ID from a virtual page ID and a 00062 // virtual->logical map. The first argument will indicate whether 00063 // or not any virtual->logical mapping exists (as no such mapping 00064 // exists for buffer cache pages). The second argument will contain 00065 // the logical page ID if one does exist. Note that a non-existant 00066 // mapping is returned only for a _valid_ virtual page that has no 00067 // corresponding logical page. Invalid virtual pages will cause and 00068 // error-and-exit to occur. 00069 void lookup_logical_page_ID (bool* return_V2L_mapping_exists, 00070 logical_page_ID_t* const return_logical_page_ID, 00071 const virtual_to_logical_map_t* const map, 00072 const virtual_page_ID_t virtual_page_ID); 00073 00074 }; // class Basic_Consumer 00075 // =================================================================== 00076 00077 00078 00079 // =================================================================== 00080 #endif // _BASIC_CONSUMER_HH 00081 // ===================================================================