Commit 0aa29864 authored by Ben Walker's avatar Ben Walker
Browse files

Replace rte_get_tsc calls with spdk_get_ticks



Change-Id: I809b900321433693ff9f2498183ad0dcdbb15030
Signed-off-by: default avatarBen Walker <benjamin.walker@intel.com>
parent 2224ff21
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -39,7 +39,6 @@
#include <rte_config.h>
#include <rte_eal.h>
#include <rte_lcore.h>
#include <rte_cycles.h>
#include <rte_mempool.h>

#include "spdk/ioat.h"
@@ -298,11 +297,11 @@ work_fn(void *arg)
		return 1;
	}

	tsc_end = rte_get_timer_cycles() + g_user_config.time_in_sec * rte_get_timer_hz();
	tsc_end = spdk_get_ticks() + g_user_config.time_in_sec * spdk_get_ticks_hz();

	// begin to submit transfers
	submit_xfers(t, g_user_config.queue_depth);
	while (rte_get_timer_cycles() < tsc_end) {
	while (spdk_get_ticks() < tsc_end) {
		spdk_ioat_process_events(t->chan);
	}

+2 −3
Original line number Diff line number Diff line
@@ -39,7 +39,6 @@
#include <rte_config.h>
#include <rte_lcore.h>
#include <rte_eal.h>
#include <rte_cycles.h>
#include <rte_mempool.h>

#include "spdk/ioat.h"
@@ -348,10 +347,10 @@ work_fn(void *arg)
		return 1;
	}

	tsc_end = rte_get_timer_cycles() + g_user_config.time_in_sec * rte_get_timer_hz();
	tsc_end = spdk_get_ticks() + g_user_config.time_in_sec * spdk_get_ticks_hz();

	submit_xfers(t, g_user_config.queue_depth);
	while (rte_get_timer_cycles() < tsc_end) {
	while (spdk_get_ticks() < tsc_end) {
		spdk_ioat_process_events(t->chan);
	}

+3 −4
Original line number Diff line number Diff line
@@ -37,7 +37,6 @@
#include <unistd.h>

#include <rte_config.h>
#include <rte_cycles.h>
#include <rte_mempool.h>
#include <rte_lcore.h>

@@ -461,7 +460,7 @@ work_fn(void *arg)
		ns_ctx = ns_ctx->next;
	}

	tsc_end = rte_get_timer_cycles() + g_arbitration.time_in_sec * g_arbitration.tsc_rate;
	tsc_end = spdk_get_ticks() + g_arbitration.time_in_sec * g_arbitration.tsc_rate;

	/* Submit initial I/O for each namespace. */
	ns_ctx = worker->ns_ctx;
@@ -483,7 +482,7 @@ work_fn(void *arg)
			ns_ctx = ns_ctx->next;
		}

		if (rte_get_timer_cycles() > tsc_end) {
		if (spdk_get_ticks() > tsc_end) {
			break;
		}
	}
@@ -1133,7 +1132,7 @@ main(int argc, char **argv)
				       64, 0, NULL, NULL, task_ctor, NULL,
				       SOCKET_ID_ANY, 0);

	g_arbitration.tsc_rate = rte_get_timer_hz();
	g_arbitration.tsc_rate = spdk_get_ticks_hz();

	if (register_workers() != 0) {
		return 1;
+5 −6
Original line number Diff line number Diff line
@@ -37,7 +37,6 @@
#include <unistd.h>

#include <rte_config.h>
#include <rte_cycles.h>
#include <rte_mempool.h>
#include <rte_lcore.h>

@@ -423,7 +422,7 @@ submit_single_io(struct ns_worker_ctx *ns_ctx)
		}
	}

	task->submit_tsc = rte_get_timer_cycles();
	task->submit_tsc = spdk_get_ticks();

	if ((g_rw_percentage == 100) ||
	    (g_rw_percentage != 0 && ((rand_r(&seed) % 100) < g_rw_percentage))) {
@@ -468,7 +467,7 @@ task_complete(struct perf_task *task)
	ns_ctx = task->ns_ctx;
	ns_ctx->current_queue_depth--;
	ns_ctx->io_completed++;
	tsc_diff = rte_get_timer_cycles() - task->submit_tsc;
	tsc_diff = spdk_get_ticks() - task->submit_tsc;
	ns_ctx->total_tsc += tsc_diff;
	if (ns_ctx->min_tsc > tsc_diff) {
		ns_ctx->min_tsc = tsc_diff;
@@ -589,7 +588,7 @@ work_fn(void *arg)
		ns_ctx = ns_ctx->next;
	}

	tsc_end = rte_get_timer_cycles() + g_time_in_sec * g_tsc_rate;
	tsc_end = spdk_get_ticks() + g_time_in_sec * g_tsc_rate;

	/* Submit initial I/O for each namespace. */
	ns_ctx = worker->ns_ctx;
@@ -610,7 +609,7 @@ work_fn(void *arg)
			ns_ctx = ns_ctx->next;
		}

		if (rte_get_timer_cycles() > tsc_end) {
		if (spdk_get_ticks() > tsc_end) {
			break;
		}
	}
@@ -1113,7 +1112,7 @@ int main(int argc, char **argv)
				       64, 0, NULL, NULL, task_ctor, NULL,
				       SOCKET_ID_ANY, 0);

	g_tsc_rate = rte_get_timer_hz();
	g_tsc_rate = spdk_get_ticks_hz();

	if (register_workers() != 0) {
		rc = -1;
+11 −11
Original line number Diff line number Diff line
@@ -48,7 +48,6 @@
#endif

#include <rte_config.h>
#include <rte_cycles.h>
#include <rte_mempool.h>
#include <rte_ring.h>

@@ -56,6 +55,7 @@

#include "spdk/log.h"
#include "spdk/io_channel.h"
#include "spdk/env.h"

#define SPDK_MAX_SOCKET		64

@@ -341,14 +341,14 @@ _spdk_reactor_run(void *arg)
	set_reactor_thread_name();
	SPDK_NOTICELOG("Reactor started on core 0x%x\n", rte_lcore_id());

	spin_cycles = SPDK_REACTOR_SPIN_TIME_US * rte_get_timer_hz() / 1000000ULL;
	sleep_cycles = reactor->max_delay_us * rte_get_timer_hz() / 1000000ULL;
	last_action = rte_get_timer_cycles();
	spin_cycles = SPDK_REACTOR_SPIN_TIME_US * spdk_get_ticks_hz() / 1000000ULL;
	sleep_cycles = reactor->max_delay_us * spdk_get_ticks_hz() / 1000000ULL;
	last_action = spdk_get_ticks();

	while (1) {
		event_count = spdk_event_queue_run_all(rte_lcore_id());
		if (event_count > 0) {
			last_action = rte_get_timer_cycles();
			last_action = spdk_get_ticks();
		}

		poller = TAILQ_FIRST(&reactor->active_pollers);
@@ -362,12 +362,12 @@ _spdk_reactor_run(void *arg)
				poller->state = SPDK_POLLER_STATE_WAITING;
				TAILQ_INSERT_TAIL(&reactor->active_pollers, poller, tailq);
			}
			last_action = rte_get_timer_cycles();
			last_action = spdk_get_ticks();
		}

		poller = TAILQ_FIRST(&reactor->timer_pollers);
		if (poller) {
			now = rte_get_timer_cycles();
			now = spdk_get_ticks();

			if (now >= poller->next_run_tick) {
				TAILQ_REMOVE(&reactor->timer_pollers, poller, tailq);
@@ -384,7 +384,7 @@ _spdk_reactor_run(void *arg)

		/* Determine if the thread can sleep */
		if (sleep_cycles > 0) {
			now = rte_get_timer_cycles();
			now = spdk_get_ticks();
			if (now >= (last_action + spin_cycles)) {
				sleep_us = reactor->max_delay_us;

@@ -396,7 +396,7 @@ _spdk_reactor_run(void *arg)
						if (poller->next_run_tick <= now) {
							sleep_us = 0;
						} else {
							sleep_us = ((poller->next_run_tick - now) * 1000000ULL) / rte_get_timer_hz();
							sleep_us = ((poller->next_run_tick - now) * 1000000ULL) / spdk_get_ticks_hz();
						}
					}
				}
@@ -668,7 +668,7 @@ _spdk_event_add_poller(spdk_event_t event)
	struct spdk_event *next = spdk_event_get_next(event);

	if (poller->period_ticks) {
		spdk_poller_insert_timer(reactor, poller, rte_get_timer_cycles());
		spdk_poller_insert_timer(reactor, poller, spdk_get_ticks());
	} else {
		TAILQ_INSERT_TAIL(&reactor->active_pollers, poller, tailq);
	}
@@ -698,7 +698,7 @@ spdk_poller_register(struct spdk_poller **ppoller, spdk_poller_fn fn, void *arg,
	poller->arg = arg;

	if (period_microseconds) {
		poller->period_ticks = (rte_get_timer_hz() * period_microseconds) / 1000000ULL;
		poller->period_ticks = (spdk_get_ticks_hz() * period_microseconds) / 1000000ULL;
	} else {
		poller->period_ticks = 0;
	}
Loading