}
#if SUPPORT_MOD_ORDER_DUMP
-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);
+void CycleGraph::dumpNodes(FILE *file) {
for(unsigned int i=0;i<nodeList.size();i++) {
CycleNode *cn=nodeList[i];
std::vector<CycleNode *> * edges=cn->getEdges();
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);
}
void commitChanges();
void rollbackChanges();
#if SUPPORT_MOD_ORDER_DUMP
+ void dumpNodes(FILE *file);
void dumpGraphToFile(const char * filename);
#endif
printf("---------------------------------------------------------------------\n");
}
+#if SUPPORT_MOD_ORDER_DUMP
+void ModelChecker::dumpGraph(char *filename) {
+ char buffer[200];
+ sprintf(buffer, "%s.dot",filename);
+ FILE *file=fopen(buffer, "w");
+ fprintf(file, "digraph %s {\n",filename);
+ mo_graph->dumpNodes(file);
+ ModelAction ** thread_array=(ModelAction **)model_calloc(1, sizeof(ModelAction *)*get_num_threads());
+
+ for (action_list_t::iterator it = action_trace->begin(); it != action_trace->end(); it++) {
+ ModelAction *action=*it;
+ if (action->is_read()) {
+ fprintf(file, "N%u [label=\"%u, T%u\"];\n", action->get_seq_number(),action->get_seq_number(), action->get_tid());
+ fprintf(file, "N%u -> N%u[label=\"rf\", color=red];\n", action->get_seq_number(), action->get_reads_from()->get_seq_number());
+ }
+ if (thread_array[action->get_tid()] != NULL) {
+ fprintf(file, "N%u -> N%u[label=\"sb\", color=blue];\n", thread_array[action->get_tid()]->get_seq_number(), action->get_seq_number());
+ }
+
+ thread_array[action->get_tid()]=action;
+ }
+ fprintf(file,"}\n");
+ model_free(thread_array);
+ fclose(file);
+}
+#endif
+
void ModelChecker::print_summary()
{
printf("\n");
char buffername[100];
sprintf(buffername, "exec%04u", num_executions);
mo_graph->dumpGraphToFile(buffername);
+ sprintf(buffername, "graph%04u", num_executions);
+ dumpGraph(buffername);
#endif
if (!isfinalfeasible())
#include "clockvector.h"
#include "hashtable.h"
#include "workqueue.h"
+#include "config.h"
/* Forward declaration */
class NodeStack;
/** Prints an execution summary with trace information. */
void print_summary();
+#if SUPPORT_MOD_ORDER_DUMP
+ void dumpGraph(char *filename);
+#endif
void add_thread(Thread *t);
void remove_thread(Thread *t);
* @return true if the future_values set is empty.
*/
bool Node::future_value_empty() {
- return ((future_index + 1) >= future_values.size());
+ return ((future_index + 1) >= ((int)future_values.size()));
}
/**
* @return The first element in future_values
*/
uint64_t Node::get_future_value() {
- ASSERT(future_index<future_values.size());
+ ASSERT(future_index<((int)future_values.size()));
return future_values[future_index].value;
}
modelclock_t Node::get_future_value_expiration() {
- ASSERT(future_index<future_values.size());
+ ASSERT(future_index<((int)future_values.size()));
return future_values[future_index].expiration;
}
bool Node::increment_future_value() {
DBG();
promises.clear();
- if ((future_index+1) < future_values.size()) {
+ if ((future_index+1) < ((int)future_values.size())) {
future_index++;
return true;
}