accel_perf: add -a option for allocate depth
For benchmarking purposes, we may want to use a relatively low queue depth but spread the operations across a wider range of memory. A new -a option is added where the user can specify an "allocate depth" to do exactly that. In this case, more tasks (and their associated buffers) can be allocated than we have actual queue depth. Then when we pick a new task for the next operation, it will use a different memory range and avoid always using the same buffers over and over again. If not specified, we just allocate the same number of tasks as the queue depth, which is the current behavior. Signed-off-by: Jim Harris <james.r.harris@intel.com> Change-Id: I78042d905fd49d130c4a318e2c19eb11b84ff726 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8451 Reviewed-by: Paul Luse <paul.e.luse@intel.com> Reviewed-by: Changpeng Liu <changpeng.liu@intel.com> Reviewed-by: Ziye Yang <ziye.yang@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Community-CI: Mellanox Build Bot
This commit is contained in:
parent
c82d5789e6
commit
e1bf63afc9
@ -50,6 +50,10 @@ static uint64_t g_tsc_end;
|
||||
static int g_rc;
|
||||
static int g_xfer_size_bytes = 4096;
|
||||
static int g_queue_depth = 32;
|
||||
/* g_allocate_depth indicates how many tasks we allocate per worker. It will
|
||||
* be at least as much as the queue depth.
|
||||
*/
|
||||
static int g_allocate_depth = 0;
|
||||
static int g_ops_per_batch = 0;
|
||||
static int g_threads_per_core = 1;
|
||||
static int g_time_in_sec = 5;
|
||||
@ -130,6 +134,7 @@ dump_user_config(struct spdk_app_opts *opts)
|
||||
}
|
||||
printf("Transfer size: %u bytes\n", g_xfer_size_bytes);
|
||||
printf("Queue depth: %u\n", g_queue_depth);
|
||||
printf("Allocate depth: %u\n", g_allocate_depth);
|
||||
printf("# threads/core: %u\n", g_threads_per_core);
|
||||
printf("Run time: %u seconds\n", g_time_in_sec);
|
||||
if (g_ops_per_batch > 0) {
|
||||
@ -157,6 +162,8 @@ usage(void)
|
||||
printf("\t[-f for fill workload, use this BYTE value (default 255)\n");
|
||||
printf("\t[-y verify result if this switch is on]\n");
|
||||
printf("\t[-b batch this number of operations at a time (default 0 = disabled)]\n");
|
||||
printf("\t[-a tasks to allocate per core (default: same value as -q)]\n");
|
||||
printf("\t\tCan be used to spread operations across a wider range of memory.\n");
|
||||
}
|
||||
|
||||
static int
|
||||
@ -165,6 +172,7 @@ parse_args(int argc, char *argv)
|
||||
int argval;
|
||||
|
||||
switch (argc) {
|
||||
case 'a':
|
||||
case 'b':
|
||||
case 'C':
|
||||
case 'f':
|
||||
@ -186,6 +194,9 @@ parse_args(int argc, char *argv)
|
||||
};
|
||||
|
||||
switch (argc) {
|
||||
case 'a':
|
||||
g_allocate_depth = argval;
|
||||
break;
|
||||
case 'b':
|
||||
g_ops_per_batch = argval;
|
||||
break;
|
||||
@ -749,7 +760,7 @@ _init_thread(void *arg1)
|
||||
int i, rc, num_batches;
|
||||
int max_per_batch;
|
||||
int remaining = g_queue_depth;
|
||||
int num_tasks = g_queue_depth;
|
||||
int num_tasks = g_allocate_depth;
|
||||
struct accel_batch *tmp;
|
||||
struct accel_batch *worker_batch = NULL;
|
||||
struct display_info *display = arg1;
|
||||
@ -982,7 +993,7 @@ main(int argc, char **argv)
|
||||
pthread_mutex_init(&g_workers_lock, NULL);
|
||||
spdk_app_opts_init(&opts, sizeof(opts));
|
||||
opts.reactor_mask = "0x1";
|
||||
if (spdk_app_parse_args(argc, argv, &opts, "C:o:q:t:yw:P:f:b:T:", NULL, parse_args,
|
||||
if (spdk_app_parse_args(argc, argv, &opts, "a:C:o:q:t:yw:P:f:b:T:", NULL, parse_args,
|
||||
usage) != SPDK_APP_PARSE_ARGS_SUCCESS) {
|
||||
g_rc = -1;
|
||||
goto cleanup;
|
||||
@ -1005,6 +1016,17 @@ main(int argc, char **argv)
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (g_allocate_depth > 0 && g_queue_depth > g_allocate_depth) {
|
||||
fprintf(stdout, "allocate depth must be at least as big as queue depth\n");
|
||||
usage();
|
||||
g_rc = -1;
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (g_allocate_depth == 0) {
|
||||
g_allocate_depth = g_queue_depth;
|
||||
}
|
||||
|
||||
if (g_workload_selection == ACCEL_CRC32C &&
|
||||
g_crc32c_chained_count == 0) {
|
||||
usage();
|
||||
|
Loading…
Reference in New Issue
Block a user