bug fix
[c11tester.git] / history.h
1 #include "stl-model.h"
2 #include "common.h"
3 #include "hashtable.h"
4 #include "threads-model.h"
5
6 class ModelHistory {
7 public:
8         ModelHistory();
9         ~ModelHistory();
10
11         void enter_function(const uint32_t func_id, thread_id_t tid);
12         void exit_function(const uint32_t func_id, thread_id_t tid);
13
14         uint32_t get_func_counter() { return func_counter; }
15         void incr_func_counter() { func_counter++; }
16
17         void resize_func_nodes(uint32_t max_func_id);
18         void process_action(ModelAction *act, thread_id_t tid);
19
20         HashTable<const char *, uint32_t, uintptr_t, 4, model_malloc, model_calloc, model_free> * getFuncMap() { return &func_map; }
21         ModelVector<const char *> * getFuncMapRev() { return &func_map_rev; }
22
23         ModelVector<FuncNode *> * getFuncNodes() { return &func_nodes; }
24         FuncNode * get_func_node(uint32_t func_id);
25
26         void print();
27
28         MEMALLOC
29 private:
30         uint32_t func_counter;
31
32         /* map function names to integer ids */
33         HashTable<const char *, uint32_t, uintptr_t, 4, model_malloc, model_calloc, model_free> func_map;
34         /* map integer ids to function names */
35         ModelVector<const char *> func_map_rev;
36
37         ModelVector<FuncNode *> func_nodes;
38 };