3 #include "threads-model.h"
7 int Fuzzer::selectWrite(ModelAction *read, SnapVector<ModelAction *> * rf_set) {
8 int random_index = random() % rf_set->size();
12 Thread * Fuzzer::selectThread(int * threadlist, int numthreads) {
13 int random_index = random() % numthreads;
14 int thread = threadlist[random_index];
15 thread_id_t curr_tid = int_to_id(thread);
16 return model->get_thread(curr_tid);
19 Thread * Fuzzer::selectNotify(action_list_t * waiters) {
20 int numwaiters = waiters->size();
21 int random_index = random() % numwaiters;
22 sllnode<ModelAction*> * it = waiters->begin();
25 Thread *thread = model->get_thread(it->getVal());
30 bool Fuzzer::shouldSleep(const ModelAction *sleep) {
34 bool Fuzzer::shouldWake(const ModelAction *sleep) {
35 struct timespec currtime;
36 clock_gettime(CLOCK_MONOTONIC, &currtime);
37 uint64_t lcurrtime = currtime.tv_sec * 1000000000 + currtime.tv_nsec;
39 return ((sleep->get_time()+sleep->get_value()) >= lcurrtime);