#include #include #include #include #include #include "everything_else.hpp" #include "id_list.hpp" #include "time.hpp" #include "template_helpers.hpp" #include "pla_getbyname.hpp" #include "property_composition.hpp" #include "model.hpp" #include "mempool.hpp" using namespace std; template struct CoarseReplay; // define base case with virtual op() to runtime dispatch call by property name template<> struct CoarseReplay { virtual void operator() (Time start, Time stop, IdList rawIds) { assert(false); } }; template struct CoarseReplay : CoarseReplay { virtual void operator() (Time start, Time stop, IdList rawIds) { IdList::ptr_t> ids(rawIds); PropertyInstance pi; assert(stop <= pi.data.timeLimit); assert(start >= 0); // print header cout << "#"; for (auto i : ids) cout << "\tval(" << (uint64_t) i << ")"; for (auto i : ids) cout << "\ttime(" << (uint64_t) i << ")"; cout << endl; // print data for (Time t = start; t <= stop; t = t + pi.data.interval()) { cout << t(); for (auto i : ids) cout << "\t" << pi.data.getValue(t, i); for (auto i : ids) cout << "\t" << pi.data.getTime (t, i); cout << endl; } } }; template struct CoarseReplay : CoarseReplay { virtual void operator() (Time start, Time stop, uint64_t raw_addr) { cerr << Prop::name << " is a discrete property" << endl; exit(-1); } }; int main(int argc, char **argv) { // read cmd line params assert(argc == 5); assertSimDir(); { PropertyComposition pc; PLA_GetByName pla(argv[1]); CoarseReplay *replay(pc.call(pla)); assert(replay != NULL); errno = 0; char *tail; IdList ids(argv[2]); Time start( strtod( argv[3], &tail)); assert(*tail == 0); Time stop( strtod( argv[4], &tail)); assert(*tail == 0); assert(errno == 0); // output (*replay)(start, stop, ids); } return 0; }