Static member variables of a class are going to be snapshotted. Move them so
they aren't static in order to prevent this.
(This can create interesting behavior, where the "total number of nodes
created" is decreasing at times!)
{
printf("\n");
printf("Number of executions: %d\n", num_executions);
- printf("Total nodes created: %d\n", Node::get_total_nodes());
+ printf("Total nodes created: %d\n", node_stack->get_total_nodes());
scheduler->print();
#include "common.h"
#include "model.h"
-int Node::total_nodes = 0;
-
Node::Node(ModelAction *act, int nthreads)
: action(act),
num_threads(nthreads),
explored_children(num_threads),
backtrack(num_threads)
{
- total_nodes++;
}
Node::~Node()
}
NodeStack::NodeStack()
+ : total_nodes(0)
{
node_list.push_back(new Node());
+ total_nodes++;
iter = node_list.begin();
}
/* Record action */
get_head()->explore_child(act);
node_list.push_back(new Node(act, model->get_num_threads()));
+ total_nodes++;
iter++;
}
return (*iter)->get_action();
void print();
- static int get_total_nodes() { return total_nodes; }
-
MEMALLOC
private:
void explore(thread_id_t tid);
- static int total_nodes;
ModelAction *action;
int num_threads;
std::vector< bool, MyAlloc<bool> > explored_children;
Node * get_next();
void reset_execution();
+ int get_total_nodes() { return total_nodes; }
+
void print();
MEMALLOC
private:
node_list_t node_list;
node_list_t::iterator iter;
+
+ int total_nodes;
};
#endif /* __NODESTACK_H__ */