Commit cf6ee253 authored by Jim Harris's avatar Jim Harris Committed by Daniel Verkamp
Browse files

nvme/overhead: remove extra spdk_get_ticks()



The check_io function always calls spdk_get_ticks() -
so return that value to the work_fn for checking
when the test is complete, rather than have work_fn
call spdk_get_ticks() again.  This eliminates an
extra rdtsc call that counts against the completion
path.

Signed-off-by: default avatarJim Harris <james.r.harris@intel.com>
Change-Id: I5a4f52eb2bec70a119c9ea7368bc7f2e8f17155c

Reviewed-on: https://review.gerrithub.io/413152


Tested-by: default avatarSPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
parent 58bcd554
Loading
Loading
Loading
Loading
+7 −5
Original line number Diff line number Diff line
@@ -334,7 +334,7 @@ io_complete(void *ctx, const struct spdk_nvme_cpl *completion)

uint64_t g_complete_tsc_start;

static void
static uint64_t
check_io(void)
{
	uint64_t end, tsc_complete;
@@ -378,8 +378,10 @@ check_io(void)
		if (!g_ns->is_draining) {
			submit_single_io();
		}
		g_complete_tsc_start = spdk_get_ticks();
		end = g_complete_tsc_start = spdk_get_ticks();
	}

	return end;
}

static void
@@ -438,7 +440,7 @@ cleanup_ns_worker_ctx(void)
static int
work_fn(void)
{
	uint64_t tsc_end;
	uint64_t tsc_end, current;

	/* Allocate a queue pair for each namespace. */
	if (init_ns_worker_ctx() != 0) {
@@ -458,9 +460,9 @@ work_fn(void)
		 * I/O will be submitted in the io_complete callback
		 * to replace each I/O that is completed.
		 */
		check_io();
		current = check_io();

		if (spdk_get_ticks() > tsc_end) {
		if (current > tsc_end) {
			break;
		}
	}