Skip to content
Snippets Groups Projects
Commit d82e59ab authored by Danny Auble's avatar Danny Auble
Browse files

BGQ - Make the status polling recursive instead of a bunch of static

for loops.
parent 190d69ef
No related branches found
No related tags found
No related merge requests found
...@@ -576,22 +576,28 @@ static void _handle_midplane_update(ComputeHardware::ConstPtr bgq, ...@@ -576,22 +576,28 @@ static void _handle_midplane_update(ComputeHardware::ConstPtr bgq,
} }
} }
static void _do_hardware_poll(void) static void _do_hardware_poll(int level, uint16_t *coords,
ComputeHardware::ConstPtr bgqsys)
{ {
#if defined HAVE_BG_FILES ba_mp_t *ba_mp;
if (!ba_main_grid)
return;
ComputeHardware::ConstPtr bgq = getComputeHardware(); if (!ba_main_grid || (level > SYSTEM_DIMENSIONS))
return;
for (int a = 0; a < DIM_SIZE[A]; a++) if (level < SYSTEM_DIMENSIONS) {
for (int x = 0; x < DIM_SIZE[X]; x++) for (coords[level] = 0;
for (int y = 0; y < DIM_SIZE[Y]; y++) coords[level] < DIM_SIZE[level];
for (int z = 0; z < DIM_SIZE[Z]; z++) coords[level]++) {
_handle_midplane_update( /* handle the outter dims here */
bgq, &ba_main_grid[a][x][y][z]); _do_hardware_poll(level+1, coords, bgqsys);
#endif }
return;
}
ba_mp = coord2ba_mp(coords);
if (ba_mp)
_handle_midplane_update(bgqsys, ba_mp);
} }
static void *_poll(void *no_data) static void *_poll(void *no_data)
{ {
event_handler_t event_hand; event_handler_t event_hand;
...@@ -609,8 +615,11 @@ static void *_poll(void *no_data) ...@@ -609,8 +615,11 @@ static void *_poll(void *no_data)
curr_time = time(NULL); curr_time = time(NULL);
_do_block_poll(); _do_block_poll();
/* only do every 30 seconds */ /* only do every 30 seconds */
if ((curr_time - 30) >= last_ran) if ((curr_time - 30) >= last_ran) {
_do_hardware_poll(); ComputeHardware::ConstPtr bgqsys = getComputeHardware();
uint16_t coords[SYSTEM_DIMENSIONS];
_do_hardware_poll(0, coords, bgqsys);
}
slurm_mutex_unlock(&rt_mutex); slurm_mutex_unlock(&rt_mutex);
last_ran = time(NULL); last_ran = time(NULL);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment