+#if SUPPORT_MOD_ORDER_DUMP
+void CycleGraph::dumpNodes(FILE *file) {
+ for(unsigned int i=0;i<nodeList.size();i++) {
+ CycleNode *cn=nodeList[i];
+ std::vector<CycleNode *> * edges=cn->getEdges();
+ const ModelAction *action=cn->getAction();
+ fprintf(file, "N%u [label=\"%u, T%u\"];\n",action->get_seq_number(),action->get_seq_number(), action->get_tid());
+ if (cn->getRMW()!=NULL) {
+ fprintf(file, "N%u -> N%u[style=dotted];\n", action->get_seq_number(), cn->getRMW()->getAction()->get_seq_number());
+ }
+ for(unsigned int j=0;j<edges->size();j++) {
+ CycleNode *dst=(*edges)[j];
+ const ModelAction *dstaction=dst->getAction();
+ fprintf(file, "N%u -> N%u;\n", action->get_seq_number(), dstaction->get_seq_number());
+ }
+ }
+}
+
+void CycleGraph::dumpGraphToFile(const char *filename) {
+ char buffer[200];
+ sprintf(buffer, "%s.dot",filename);
+ FILE *file=fopen(buffer, "w");
+ fprintf(file, "digraph %s {\n",filename);
+ dumpNodes(file);
+ fprintf(file,"}\n");
+ fclose(file);
+}
+#endif
+