00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #ifndef _INTROSPECTOR_DRAM_H
00013 #define _INTROSPECTOR_DRAM_H
00014
00015 #include <sst/core/introspector.h>
00016
00017
00018 using namespace SST;
00019
00020 #if DBG_INTROSPECTOR_DRAM
00021 #define _INTROSPECTOR_DRAM_DBG( fmt, args...)\
00022 printf( "%d:Introspector_dram::%s():%d: "fmt, _debug_rank, __FUNCTION__,__LINE__, ## args )
00023 #else
00024 #define _INTROSPECTOR_DRAM_DBG( fmt, args...)
00025 #endif
00026
00027
00028
00029 class Introspector_dram : public Introspector {
00030
00031 public:
00032 Introspector_dram(Component::Params_t& params ) :
00033 Introspector(),
00034 params( params ),
00035 frequency( "1ns" )
00036 {
00037 _INTROSPECTOR_DRAM_DBG( "new id=%lu\n", id );
00038
00039 Component::Params_t::iterator it = params.begin();
00040 while( it != params.end() ) {
00041 _INTROSPECTOR_DRAM_DBG("key=%s value=%s\n",
00042 it->first.c_str(),it->second.c_str());
00043 if ( ! it->first.compare("period") ) {
00044 frequency = it->second;
00045 }
00046 else if ( ! it->first.compare("model") ) {
00047 model = it->second;
00048 }
00049 ++it;
00050 }
00051
00052 intData = 0;
00053 _INTROSPECTOR_DRAM_DBG("-->frequency=%s\n",frequency.c_str());
00054
00055 TimeConverter* tc = registerClock( frequency, new Clock::Handler<Introspector_dram>(this, &Introspector_dram::pullData) );
00056
00057
00058
00059 ( this, &Introspector_dram::mpiOneTimeCollect );
00060
00061 printf("INTROSPECTOR_DRAM period: %ld\n",(long int)tc->getFactor());
00062 _INTROSPECTOR_DRAM_DBG("Done registering clock\n");
00063
00064 }
00065 int Setup() {
00066 std::pair<bool, int> pint;
00067
00068
00069 MyCompList = getModels(model);
00070
00071 for (std::list<IntrospectedComponent*>::iterator i = MyCompList.begin();
00072 i != MyCompList.end(); ++i) {
00073
00074
00075 monitorComponent(*i);
00076
00077
00078 pint = (*i)->ifMonitorIntData("dram_backgroundEnergy");
00079 if(pint.first){
00080
00081 addToIntDatabase(*i, pint.second);
00082 }
00083
00084 pint = (*i)->ifMonitorIntData("dram_burstEnergy");
00085 if(pint.first){
00086 addToIntDatabase(*i, pint.second);
00087 }
00088
00089 pint = (*i)->ifMonitorIntData("dram_actpreEnergy");
00090 if(pint.first){
00091 addToIntDatabase(*i, pint.second);
00092 }
00093
00094 pint = (*i)->ifMonitorIntData("dram_refreshEnergy");
00095 if(pint.first){
00096 addToIntDatabase(*i, pint.second);
00097 }
00098
00099
00100 }
00101
00102 _INTROSPECTOR_DRAM_DBG("\n");
00103 return 0;
00104 }
00105 int Finish() {
00106 _INTROSPECTOR_DRAM_DBG("\n");
00107 return 0;
00108 }
00109
00110
00111 private:
00112 Introspector_dram( const Introspector_dram& c );
00113
00114 Introspector_dram() : Introspector() {}
00115
00116 bool pullData( Cycle_t );
00117 bool mpiCollectInt( Cycle_t );
00118 void mpiOneTimeCollect(Event* e);
00119
00120 Event::Handler< Introspector_dram > *mpionetimehandler;
00121 Component::Params_t params;
00122 std::string frequency;
00123 std::string model;
00124 uint64_t intData;
00125
00126 friend class boost::serialization::access;
00127 template<class Archive>
00128 void serialize(Archive & ar, const unsigned int version )
00129 {
00130 ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP(Introspector);
00131 ar & BOOST_SERIALIZATION_NVP(params);
00132 ar & BOOST_SERIALIZATION_NVP(frequency);
00133 ar & BOOST_SERIALIZATION_NVP(model);
00134 }
00135 };
00136
00137 #endif