memloadgen allocate memory in thread

This commit is contained in:
oscar 2023-03-15 19:07:36 -04:00
parent 05965dbb94
commit 7e4fd3d721

View File

@ -55,10 +55,10 @@ memload_generator::worker_thrd(void *_tinfo)
}
// wait for other threads to init
tinfo->init_status.store(1);
if (tinfo->opts->verbose) {
fprintf(stdout, "memload_generator <thread %ld>: running...\n", tid);
}
tinfo->init_status.store(1);
uint64_t next_ts = topo_uptime_ns();
size_t cur_offset = 0;
@ -73,8 +73,8 @@ memload_generator::worker_thrd(void *_tinfo)
cur_offset = 0;
}
memcpy((char *)tinfo->from_buffer + cur_offset,
(char *)tinfo->to_buffer + cur_offset,
memcpy((char *)from_buffer + cur_offset,
(char *)to_buffer + cur_offset,
tinfo->opts->transaction_size);
tinfo->num_trans.fetch_add(1);
@ -136,10 +136,10 @@ memload_generator::memload_generator(cpuset_t *threads, cpuset_t *target_domain,
opt->buffer_size);
target_buffer = nms_alloc_static(target_domain_id,
opt->buffer_size);
}
if (local_buffer == nullptr || target_buffer == nullptr) {
goto end;
if (local_buffer == nullptr || target_buffer == nullptr) {
*success = false;
goto end;
}
}
while (nextcore != -1) {
@ -184,7 +184,7 @@ memload_generator::memload_generator(cpuset_t *threads, cpuset_t *target_domain,
for (auto tinfo : thr_infos) {
int status;
while ((status = tinfo->init_status.load()) != 1) {
if (tinfo->init_status.load() == -1) {
if (status == -1) {
state.store(STATE_END);
*success = false;
goto end;