12 #ifndef SST_CORE_INTROSPECTED_COMPONENT_H
13 #define SST_CORE_INTROSPECTED_COMPONENT_H
14 #include <sst/core/sst_types.h>
22 #if defined(__x86_64__) && defined(__APPLE__) && !defined(__USE_ISOC99)
25 #define __USE_ISOC99 1
26 #if ((__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8))
27 #pragma GCC diagnostic push
28 #pragma GCC diagnostic ignored "-Wunused-local-typedefs"
30 #include <boost/numeric/interval.hpp>
31 #if ((__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8))
32 #pragma GCC diagnostic pop
37 #if ((__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8))
38 #pragma GCC diagnostic push
39 #pragma GCC diagnostic ignored "-Wunused-local-typedefs"
41 #include <boost/numeric/interval.hpp>
42 #if ((__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8))
43 #pragma GCC diagnostic pop
47 #include <boost/io/ios_state.hpp>
48 #include <boost/any.hpp>
50 #include <sst/core/component.h>
52 #include <sst/core/timeConverter.h>
55 template<
class T,
class Policies,
class CharType,
class CharTraits>
56 std::basic_ostream<CharType, CharTraits>
57 &operator<<(std::basic_ostream<CharType, CharTraits> &stream,
58 const boost::numeric::interval<T, Policies> &value)
61 return stream <<
"nothing";
62 }
else if (singleton(value)) {
63 boost::io::ios_precision_saver state(stream, std::numeric_limits<T>::digits10);
64 return stream << lower(value);
65 }
else if (zero_in(value)) {
66 return stream <<
"0~";
68 std::streamsize p = stream.precision();
69 p = (p > 15) ? 15 : p - 1;
70 double eps = 1.0;
for(; p > 0; --p) { eps /= 10; }
71 T eps2 =
static_cast<T
>(eps / 2) * norm(value);
72 boost::numeric::interval<T, Policies> r = widen(value, eps2);
74 return stream << median(r) <<
" ± " << width(r)/2;
79 using boost::any_cast;
85 typedef boost::numeric::interval<double> I;
88 I il1, il2, dl1, dl2, itlb, dtlb;
89 I clock, bpred, rf, io, logic;
90 I alu, fpu, mult, ib, issueQ, decoder, bypass, exeu;
91 I pipeline, lsq, rat, rob, btb, L2, mc;
92 I router, loadQ, renameU, schedulerU, L3, L1dir, L2dir;
100 I runtimeDynamicPower;
112 Time_t currentSimTime;
116 typedef std::map<ComponentId_t, Pdissipation_t> PowerDatabase;
155 virtual boost::any operator()() = 0;
160 template <
typename classT,
typename returnT,
typename argT =
void>
163 typedef returnT (classT::*PtrMember)(argT);
165 const PtrMember member;
178 boost::any operator()() {
179 return static_cast<boost::any
>( (
const_cast<classT*
>(object)->*member)(data) );
183 template <
typename classT,
typename returnT>
186 typedef returnT (classT::*PtrMember)();
187 const PtrMember member;
199 boost::any operator()() {
200 return static_cast<boost::any
>( (
const_cast<classT*
>(object)->*member)() );
204 template <
typename ptrT,
typename idxT =
void>
216 boost::any operator()() {
217 return static_cast<boost::any
>( *data[index] );
221 template <
typename ptrT>
230 boost::any operator()() {
232 return static_cast<boost::any
>( *data );
248 std::pair<bool, IntrospectedComponent::MonitorBase*>
getMonitor(std::string dataname);
279 typedef std::map<std::string, IntrospectedComponent::MonitorBase*>
MonitorMap_t;
296 #endif // SST_CORE_INTROSPECTED_COMPONENT_H
Definition: introspectedComponent.h:205
bool isTimeToPush(Cycle_t current, const char *name)
Check if current is the time for the component to push/report data (e.g.
Definition: introspectedComponent.cc:177
SimTime_t getFactor()
Return the factor used for conversions with Core Time.
Definition: timeConverter.h:50
std::pair< bool, IntrospectedComponent::MonitorBase * > getMonitor(std::string dataname)
Find monitor indicated by "dataname" from the map.
Definition: introspectedComponent.cc:142
static PowerDatabase PDB
Central power/energy database that stores power dissipation data (including current power...
Definition: introspectedComponent.h:139
void registerMonitor(std::string dataName, IntrospectedComponent::MonitorBase *handler)
Add the data to the map of monitors to specify which data to be monitored
Definition: introspectedComponent.cc:126
void triggerUpdate()
'Component-push' mechanism.
Definition: introspectedComponent.cc:159
Main component object for the simulation.
Definition: component.h:56
void regPowerStats(Pdissipation_t pusage)
Register/update power dissipation data in the central power database.
Definition: introspectedComponent.cc:43
Definition: introspectedComponent.h:54
TimeConverter * defaultTimeBase
Timebase used if no other timebase is specified for calls like Component::getCurrentSimTime().
Definition: component.h:357
std::map< std::string, IntrospectedComponent::MonitorBase * > MonitorMap_t
Return the value of the integer data indicated by "dataID" and "index" (if the data structure is a ta...
Definition: introspectedComponent.h:279
std::list< Introspector * > MyIntroList
List of id of introspectors that monitor this component.
Definition: introspectedComponent.h:133
std::pair< bool, Pdissipation_t > readPowerStats(Component *c)
Read power dissipation data of this component from database.
Definition: introspectedComponent.cc:71
Definition: introspectedComponent.h:152
Main component object for the simulation.
Definition: introspectedComponent.h:122
void registerIntrospector(std::string name)
Add the pointer to a introspector to an internal list, MyIntroList.
Definition: introspectedComponent.cc:104
Definition: introspectedComponent.h:161
Definition: introspectedComponent.h:87
SimTime_t getFreq()
Get the period set by defaultTimeBase, which is usually set by Component::registerClock().
Definition: introspectedComponent.h:256
Definition: introspectedComponent.h:95
MonitorMap_t monitorMap
Database of monitors (arbitrary data that a compopent wishes to be monitored) available through intro...
Definition: introspectedComponent.h:285