app: add function to get current core ID

Change-Id: I3428fc9944f7117facc6488489187dcf8b6ed825
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
This commit is contained in:
Daniel Verkamp 2016-08-04 10:18:25 -07:00
parent 268ee865ab
commit ac7151b161
2 changed files with 11 additions and 0 deletions

View File

@ -198,6 +198,11 @@ uint64_t spdk_app_get_core_mask(void);
*/ */
int spdk_app_get_core_count(void); int spdk_app_get_core_count(void);
/**
* \brief Return the lcore of the current thread.
*/
uint32_t spdk_app_get_current_core(void);
/** /**
* \brief Allocate an event to be passed to \ref spdk_event_call * \brief Allocate an event to be passed to \ref spdk_event_call
*/ */

View File

@ -361,6 +361,12 @@ spdk_app_get_core_count(void)
return g_reactor_count; return g_reactor_count;
} }
uint32_t
spdk_app_get_current_core(void)
{
return rte_lcore_id();
}
int int
spdk_app_parse_core_mask(const char *mask, uint64_t *cpumask) spdk_app_parse_core_mask(const char *mask, uint64_t *cpumask)
{ {