Get GDAX working.
[c11tester.git] / history.h
1 #ifndef __HISTORY_H__
2 #define __HISTORY_H__
3
4 #include "stl-model.h"
5 #include "common.h"
6 #include "hashtable.h"
7 #include "hashset.h"
8 #include "threads-model.h"
9
10 typedef HashSet<uint64_t, uint64_t, 0, model_malloc, model_calloc, model_free> write_set_t;
11
12 class ModelHistory {
13 public:
14         ModelHistory();
15         ~ModelHistory();
16
17         void enter_function(const uint32_t func_id, thread_id_t tid);
18         void exit_function(const uint32_t func_id, thread_id_t tid);
19
20         uint32_t get_func_counter() { return func_counter; }
21         void incr_func_counter() { func_counter++; }
22
23         void resize_func_nodes(uint32_t max_func_id);
24         void process_action(ModelAction *act, thread_id_t tid);
25
26         HashTable<const char *, uint32_t, uintptr_t, 4, model_malloc, model_calloc, model_free> * getFuncMap() { return &func_map; }
27         ModelVector<const char *> * getFuncMapRev() { return &func_map_rev; }
28
29         ModelVector<FuncNode *> * getFuncNodes() { return &func_nodes; }
30         FuncNode * get_func_node(uint32_t func_id);
31         uint64_t query_last_read(void * location, thread_id_t tid);
32
33         void add_to_write_history(void * location, uint64_t write_val);
34
35         void print();
36
37         MEMALLOC
38 private:
39         uint32_t func_counter;
40
41         /* map function names to integer ids */
42         HashTable<const char *, uint32_t, uintptr_t, 4, model_malloc, model_calloc, model_free> func_map;
43         /* map integer ids to function names */
44         ModelVector<const char *> func_map_rev;
45
46         ModelVector<FuncNode *> func_nodes;
47         HashTable<void *, write_set_t *, uintptr_t, 4, model_malloc, model_calloc, model_free> write_history;
48 };
49
50 #endif  /* __HISTORY_H__ */