nvme: add timestamp counter interface to nvme_impl

Change-Id: Ic652163e4f5944c1516eaf58615f7eabcbe34a7a
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
This commit is contained in:
Daniel Verkamp 2016-02-22 16:01:36 -07:00
parent d82473cd7d
commit a62b194f1b
2 changed files with 15 additions and 0 deletions

View File

@ -39,6 +39,7 @@
#include "spdk/nvme_spec.h"
#include <assert.h>
#include <rte_config.h>
#include <rte_cycles.h>
#include <rte_malloc.h>
#include <rte_mempool.h>
#include <rte_memcpy.h>
@ -125,6 +126,16 @@ extern struct rte_mempool *request_mempool;
*/
#define nvme_dealloc_request(buf) rte_mempool_put(request_mempool, buf)
/**
* Get a monotonic timestamp counter (used for measuring timeouts during initialization).
*/
#define nvme_get_tsc() rte_get_timer_cycles()
/**
* Get the tick rate of nvme_get_tsc() per second.
*/
#define nvme_get_tsc_hz() rte_get_timer_hz()
/**
*
*/

View File

@ -78,6 +78,10 @@ do \
#define nvme_dealloc_request(buf) free(buf)
extern uint64_t g_ut_tsc;
#define nvme_get_tsc() (g_ut_tsc)
#define nvme_get_tsc_hz() (1000000)
static inline int
nvme_pci_enumerate(int (*enum_cb)(void *enum_ctx, struct spdk_pci_device *pci_dev), void *enum_ctx)
{