#include #include #include #include #include #include "everything_else.hpp" #include "pla_getbyname.hpp" #include "sim_replay.hpp" #include "system_helpers.hpp" #include "template_helpers.hpp" #include "time.hpp" #include "model.hpp" using namespace std; template struct Replay; template<> struct Replay { virtual void operator() (TimeSpan span, IdList &ids) { assert(false); } }; template struct Replay : Replay { typedef typename Prop::quant Quant; virtual void operator() (TimeSpan span, IdList &raw_ids) { IdList ids(raw_ids); for (auto i : ids) assert(i < Ptr::numInstances()); SimReplay simReplay{ids, span.begin()()}; // header cout << "# " << Quant::name << "\n# time"; for (auto i : ids) cout << "\t" << (uint64_t) i; cout << endl; // body for (TimeSpan::iterator t=span.begin(); t.hasNext(); ++t) { cout << t()(); for (auto i : ids) cout << "\t" << simReplay.template get(Ptr(i), t()); cout << endl; } } }; template struct Replay : Replay { virtual void operator() (TimeSpan span, IdList &raw_ids) { cerr << Prop::name << " is a discrete property" << endl; exit(-1); } }; int realmain(int argc, char **argv) __attribute__((noinline)); int realmain(int argc, char **argv) { if (argc != 6) { cout << "Usage: " << argv[0] << " property instance start stop delta" << endl; return -1; } garantueeStackSize(64 * 1024 * 1024); // read cmd line params Replay *replay(NULL); { PropertyComposition pc; PLA_GetByName pla(argv[1]); 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); Time delta(strtod(argv[5], &tail)); assert(*tail == 0); assert(errno == 0); TimeSpan span(start, stop, delta); // replay simulation (*replay)(span, ids); return 0; } int main(int argc, char **argv) { garantueeStackSize(64 * 1024 * 1024); assertSimDir(); return realmain(argc, argv); }