Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tools-2525 throttle async #97

Draft
wants to merge 12 commits into
base: main
Choose a base branch
from
2 changes: 1 addition & 1 deletion integration_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ else
. "${1}"/bin/activate
fi

pytest src/test/integration
pytest -sv src/test/integration

3 changes: 3 additions & 0 deletions src/include/benchmark.h
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,9 @@ typedef struct threaddata_s {
// which workload stage we're currrently on
_Atomic(uint32_t) stage_idx;

// For async linear workloads
_Atomic(uint64_t) current_key;

/*
* note: to stop threads, tdata->finished must be set before tdata->do_work
* to prevent deadlocking
Expand Down
6 changes: 5 additions & 1 deletion src/include/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,11 @@ static inline void timespec_add_us(struct timespec* ts, uint64_t us)
ts->tv_nsec = nsec % 1000000000LU;
}

static inline void timespec_add_s(struct timespec* ts, uint64_t s)
{
ts->tv_sec += s;
}


/*
* returns the length of the given number were it to be printed in decimal
Expand Down Expand Up @@ -186,4 +191,3 @@ char* parse_string_literal(const char* restrict str,

void print_hdr_percentiles(struct hdr_histogram* h, const char* name,
uint64_t elapsed_s, as_vector* percentiles, FILE *out_file);

1 change: 1 addition & 0 deletions src/main/benchmark.c
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,7 @@ init_tdata(const args_t* args, cdata_t* cdata, thr_coord_t* coord,
tdata->t_idx = t_idx;
// always start on the first stage
atomic_init(&tdata->stage_idx, 0);
atomic_init(&tdata->current_key, args->start_key);

atomic_init(&tdata->do_work, true);
atomic_init(&tdata->finished, false);
Expand Down
3 changes: 3 additions & 0 deletions src/main/benchmark_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -544,6 +544,8 @@ print_usage(const char* program)

printf("-z --threads <count> # Default: 16\n");
printf(" Load generating thread count.\n");
printf(" This is set to 1 if using --async.\n");
printf(" Use --event-loops in async mode.\n");
printf("\n");

printf("-g --throughput <tps> # Default: 0\n");
Expand Down Expand Up @@ -745,6 +747,7 @@ print_usage(const char* program)

printf("-a --async # Default: synchronous mode\n");
printf(" Enable asynchronous mode.\n");
printf(" Use --event-loops to tune performance in async mode.\n");
printf("\n");

printf("-c --async-max-commands <command count> # Default: 50\n");
Expand Down
1 change: 0 additions & 1 deletion src/main/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,6 @@ void print_hdr_percentiles(struct hdr_histogram* h, const char* name,
fprintf(out_file, "\n");
}


//==========================================================
// Local helpers.
//
Expand Down
Loading