From 843792f9881b096bf145ba09615cb3e0bd0981bd Mon Sep 17 00:00:00 2001 From: Theo Schlossnagle Date: Fri, 16 Jan 2015 11:38:40 -0500 Subject: [PATCH] expose CPU and Socket counts via eventer API --- src/eventer/eventer.h | 1 + src/eventer/eventer_impl.c | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/eventer/eventer.h b/src/eventer/eventer.h index cb5a63429..609a0bd57 100644 --- a/src/eventer/eventer.h +++ b/src/eventer/eventer.h @@ -193,6 +193,7 @@ API_EXPORT(eventer_t) eventer_remove_recurrent(eventer_t e); API_EXPORT(void) eventer_add_recurrent(eventer_t e); API_EXPORT(int) eventer_get_epoch(struct timeval *epoch); API_EXPORT(void *) eventer_get_spec_for_event(eventer_t); +API_EXPORT(int) eventer_cpu_sockets_and_cores(int *sockets, int *cores); API_EXPORT(pthread_t) eventer_choose_owner(int); /* Helpers to schedule timed events */ diff --git a/src/eventer/eventer_impl.c b/src/eventer/eventer_impl.c index f307c5484..281969602 100644 --- a/src/eventer/eventer_impl.c +++ b/src/eventer/eventer_impl.c @@ -298,7 +298,7 @@ static int assess_hw_topo() { topo = NULL; return -1; } -static int cpu_sockets_and_cores(int *sockets, int *cores) { +int eventer_cpu_sockets_and_cores(int *sockets, int *cores) { int depth, nsockets = 0, ncores = 0; if(!topo) return -1; @@ -335,7 +335,7 @@ int eventer_impl_init() { if(__loop_concurrency <= 0) { int sockets = 0, cores = 0; - (void)cpu_sockets_and_cores(&sockets, &cores); + (void)eventer_cpu_sockets_and_cores(&sockets, &cores); if(sockets == 0) sockets = 1; if(cores == 0) cores = sockets; __loop_concurrency = 1 + PARALLELISM_MULTIPLIER * cores;