Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,12 @@ ifeq ($m, 64)
ARCH = -m64
endif

CFLAGS = $(ARCH) -O3 -std=gnu11 -Wall -mpclmul -march=core2 -mfpmath=sse -mssse3 -fno-strict-aliasing -fno-strict-overflow -fwrapv -DAES=1 -DCOMMIT=\"${COMMIT}\" -D_GNU_SOURCE=1 -D_FILE_OFFSET_BITS=64
LDFLAGS = $(ARCH) -ggdb -rdynamic -lm -lrt -lcrypto -lz -lpthread -lcrypto
CFLAGS = $(ARCH) -O3 -std=gnu11 -Wall -mpclmul -march=core2 -mfpmath=sse -mssse3 -fcommon -fno-strict-aliasing -fno-strict-overflow -fwrapv -DAES=1 -DCOMMIT=\"${COMMIT}\" -D_GNU_SOURCE=1 -D_FILE_OFFSET_BITS=64
LDFLAGS = $(ARCH) -ggdb -rdynamic -lm -lrt -lz -lpthread -lcrypto
LIBEXECTEST = '\#include <execinfo.h>\nint main(){return backtrace(0,0);}'
ifeq ($(shell printf ${LIBEXECTEST} | gcc -x c -o /dev/null - -lexecinfo 2>/dev/null; echo $$?), 0)
LDFLAGS := ${LDFLAGS} -lexecinfo # For systems without glibc e.g. Alpine linux that uses musl libc.
endif

LIB = ${OBJ}/lib
CINCLUDE = -iquote common -iquote .
Expand Down
18 changes: 7 additions & 11 deletions jobs/jobs.c
Original file line number Diff line number Diff line change
Expand Up @@ -370,29 +370,23 @@ __thread job_t this_job;

long int lrand48_j (void) {
if (this_job_thread) {
long int t;
lrand48_r (&this_job_thread->rand_data, &t);
return t;
return nrand48 (this_job_thread->rand_data);
} else {
return lrand48 ();
}
}

long int mrand48_j (void) {
if (this_job_thread) {
long int t;
mrand48_r (&this_job_thread->rand_data, &t);
return t;
return jrand48 (this_job_thread->rand_data);
} else {
return mrand48 ();
}
}

double drand48_j (void) {
if (this_job_thread) {
double t;
drand48_r (&this_job_thread->rand_data, &t);
return t;
return erand48 (this_job_thread->rand_data);
} else {
return drand48 ();
}
Expand Down Expand Up @@ -463,8 +457,10 @@ int create_job_thread_ex (int thread_class, void *(*thread_work)(void *)) {
JT->id = i;
assert (JT->job_queue);

srand48_r (rdtsc () ^ lrand48 (), &JT->rand_data);

long int seed = rdtsc () ^ lrand48 ();
JT->rand_data[0] = 0x330e;
JT->rand_data[1] = seed;
JT->rand_data[2] = seed >> 16;

if (thread_class != JC_MAIN) {
pthread_attr_t attr;
Expand Down
2 changes: 1 addition & 1 deletion jobs/jobs.h
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ struct job_thread {
long long jobs_created;
long long jobs_active;
int thread_system_id;
struct drand48_data rand_data;
unsigned short rand_data[3];
job_t timer_manager;
double wakeup_time;
struct job_class *job_class;
Expand Down