Skip to content

Commit

Permalink
expose CPU and Socket counts via eventer API
Browse files Browse the repository at this point in the history
  • Loading branch information
postwait committed Jan 16, 2015
1 parent 2d0776f commit 843792f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/eventer/eventer.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
4 changes: 2 additions & 2 deletions src/eventer/eventer_impl.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 843792f

Please sign in to comment.