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("\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());
#include "common.h"
#include "model.h"
#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)
{
Node::Node(ModelAction *act, int nthreads)
: action(act),
num_threads(nthreads),
explored_children(num_threads),
backtrack(num_threads)
{
{
node_list.push_back(new Node());
{
node_list.push_back(new Node());
iter = node_list.begin();
}
iter = node_list.begin();
}
/* Record action */
get_head()->explore_child(act);
node_list.push_back(new Node(act, model->get_num_threads()));
/* Record action */
get_head()->explore_child(act);
node_list.push_back(new Node(act, model->get_num_threads()));
iter++;
}
return (*iter)->get_action();
iter++;
}
return (*iter)->get_action();
- static int get_total_nodes() { return total_nodes; }
-
MEMALLOC
private:
void explore(thread_id_t tid);
MEMALLOC
private:
void explore(thread_id_t tid);
- static int total_nodes;
ModelAction *action;
int num_threads;
std::vector< bool, MyAlloc<bool> > explored_children;
ModelAction *action;
int num_threads;
std::vector< bool, MyAlloc<bool> > explored_children;
Node * get_next();
void reset_execution();
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;
void print();
MEMALLOC
private:
node_list_t node_list;
node_list_t::iterator iter;
};
#endif /* __NODESTACK_H__ */
};
#endif /* __NODESTACK_H__ */