@@ -167,8 +167,11 @@ inline static void osm_perfmgr_set_state(osm_perfmgr_t * p_perfmgr,
osm_perfmgr_state_t state)
{
p_perfmgr->state = state;
- if (state == PERFMGR_STATE_ENABLED)
- osm_sm_signal(p_perfmgr->sm, OSM_SIGNAL_PERFMGR_SWEEP);
+ if (state == PERFMGR_STATE_ENABLED) {
+ cl_timer_start(&p_perfmgr->sweep_timer, p_perfmgr->sweep_time_s * 1000);
+ } else {
+ cl_timer_stop(&p_perfmgr->sweep_timer);
+ }
}
inline static osm_perfmgr_state_t osm_perfmgr_get_state(osm_perfmgr_t * perfmgr)
@@ -860,8 +860,7 @@ static void perfmgr_sweep(void *arg)
{
osm_perfmgr_t *pm = arg;
- if (pm->state == PERFMGR_STATE_ENABLED)
- osm_sm_signal(pm->sm, OSM_SIGNAL_PERFMGR_SWEEP);
+ osm_sm_signal(pm->sm, OSM_SIGNAL_PERFMGR_SWEEP);
cl_timer_start(&pm->sweep_timer, pm->sweep_time_s * 1000);
}
@@ -1380,7 +1379,8 @@ ib_api_status_t osm_perfmgr_init(osm_perfmgr_t * pm, osm_opensm_t * osm,
init_monitored_nodes(pm);
- cl_timer_start(&pm->sweep_timer, pm->sweep_time_s * 1000);
+ if (pm->state == PERFMGR_STATE_ENABLED)
+ cl_timer_start(&pm->sweep_timer, pm->sweep_time_s * 1000);
status = IB_SUCCESS;
Exit:
Signed-off-by: Ira Weiny <weiny2@llnl.gov> --- include/opensm/osm_perfmgr.h | 7 +++++-- opensm/osm_perfmgr.c | 6 +++--- 2 files changed, 8 insertions(+), 5 deletions(-)