36 #include <gflags/gflags.h>
44 DEFINE_int32(array_length, 32,
"The size of the region to test on.");
45 DEFINE_int32(mcas_size, 2,
"The number of words in a mcas operation.");
48 DEFINE_int32(operation_type, 0,
"The type of test to execute"
49 "(0: updating single multi-word object"
50 ", 1: updating multiple objects"
51 ", 2: updating overlapping multi-word updates)");
58 DEFINE_int32(num_threads, 1,
"The number of threads to spawn.");
59 DEFINE_int32(execution_time, 5,
"The amount of time to run the tests");
115 assert(y >= 0 && y <
limit_);
124 void reset2(std::function<
int()> func,
int len) {
138 void run(int64_t thread_id) {
140 int passed_count = 0;
141 int failed_count = 0;
145 std::default_random_engine generator;
146 std::uniform_int_distribution<int> distribution(0,
array_length_);
152 std::function<int()> posFunc;
153 std::function<void()> resFunc;
154 if (FLAGS_operation_type == 0) {
158 }
else if (FLAGS_operation_type == 1) {
161 std::function<int()> func = std::bind(dist_objs, generator);
164 }
else if (FLAGS_operation_type == 2) {
165 posFunc = std::bind(distribution, generator);
169 assert(
false &&
"Operation type not recognized");
197 res +=
"Test Handler Configuration\n";
198 res +=
"\tThreads:" + std::to_string(
num_threads_) +
"\n";
200 res +=
"\tarray_length: " + std::to_string(
array_length_)+
"\n";
201 res +=
"\tmcas_size: " + std::to_string(
mcas_size_)+
"\n";
210 res +=
"-- Test Results--\n";
212 res +=
"\tSuccesses: " + std::to_string(p)+
"\n";
213 res +=
"\tFailures: " + std::to_string(f)+
"\n";
214 res +=
"\tTotal: " + std::to_string(p+f)+
"\n";
std::atomic< void * > * shared_memory_
Definition: testObject.h:230
std::atomic< uint64_t > failed_count_
Definition: testObject.h:229
std::atomic< bool > wait_flag_
Definition: testObject.h:232
TestClass< Value, Value > * test_class_
Definition: testObject.h:226
void atomic_add(int passed_count, int failed_count)
Definition: testObject.h:83
std::string results()
Definition: testObject.h:206
void destroy()
Definition: testObject.h:106
void detach_thread()
Definition: blank_api.h:43
const int operation_type_
Definition: testObject.h:224
TestObject()
Definition: testObject.h:70
void attachThread(int threadID)
Definition: testObject.h:91
std::atomic< bool > running_
Definition: testObject.h:229
void run(int64_t thread_id)
Definition: testObject.h:138
Definition: testObject.h:60
int inc()
Definition: testObject.h:111
int x_
Definition: testObject.h:134
void reset1(int offset, int len)
Definition: testObject.h:119
void detachThread(int threadID)
Definition: testObject.h:95
DEFINE_int32(capacity, 64,"The initial capacity of the hash map")
Change this when including a new data structure.
int offset_
Definition: testObject.h:135
std::atomic< uint64_t > passed_count_
Definition: testObject.h:228
int limit_
Definition: testObject.h:133
std::atomic< int > ready_count_
Definition: testObject.h:230
TestType
Definition: testObject.h:53
void attach_thread()
Definition: blank_api.h:40
void reset2(std::function< int()> func, int len)
Definition: testObject.h:124
const int num_threads_
Definition: testObject.h:223
TestClass * test_class_
Definition: testObject.h:226
uint64_t Value
Definition: testObject.h:59
bool mcas(int len, std::function< int()> posFunc, std::atomic< void * > *address)
Definition: wf_mcas_api.h:63
const int execution_time_
Definition: testObject.h:224
void init()
Definition: testObject.h:103
std::string toString()
Definition: testObject.h:195
void setLimit(int l)
Definition: testObject.h:129
const int array_length_
Definition: testObject.h:221
Definition: blank_api.h:31
const int mcas_size_
Definition: testObject.h:223
Definition: testObject.h:110
~TestObject()
Definition: testObject.h:66
void extra_end_signal()
Definition: testObject.h:99