void DaemonCore::Stats::Reconfig() { int window = param_integer("DCSTATISTICS_WINDOW_SECONDS", -1, -1, INT_MAX); if (window < 0) window = param_integer("STATISTICS_WINDOW_SECONDS", 1200, 1, INT_MAX); int quantum = configured_statistics_window_quantum(); this->RecentWindowQuantum = quantum; this->RecentWindowMax = (window + quantum - 1) / quantum * quantum; this->PublishFlags = 0 | IF_RECENTPUB; char * tmp = param("STATISTICS_TO_PUBLISH"); if (tmp) { this->PublishFlags = generic_stats_ParseConfigString(tmp, "DC", "DAEMONCORE", this->PublishFlags); free(tmp); } SetWindowSize(this->RecentWindowMax); std::string strWhitelist; if (param(strWhitelist, "STATISTICS_TO_PUBLISH_LIST")) { this->Pool.SetVerbosities(strWhitelist.c_str(), this->PublishFlags, true); } std::string timespans; param(timespans,"DCSTATISTICS_TIMESPANS"); std::string timespans_err; if( !ParseEMAHorizonConfiguration(timespans.c_str(),ema_config,timespans_err) ) { EXCEPT("Error in DCSTATISTICS_TIMESPANS=%s: %s",timespans.c_str(),timespans_err.c_str()); } this->Commands.ConfigureEMAHorizons(ema_config); }
void TransferQueueManager::InitAndReconfig() { m_max_downloads = param_integer("MAX_CONCURRENT_DOWNLOADS",10,0); m_max_uploads = param_integer("MAX_CONCURRENT_UPLOADS",10,0); m_default_max_queue_age = param_integer("MAX_TRANSFER_QUEUE_AGE",3600*2,0); parseThrottleConfig("FILE_TRANSFER_DISK_LOAD_THROTTLE",m_throttle_disk_load,m_disk_load_low_throttle,m_disk_load_high_throttle,m_disk_throttle_short_horizon,m_disk_throttle_long_horizon,m_throttle_disk_load_increment_wait); if( m_throttle_disk_load ) { m_stat_pool.AddProbe(ATTR_FILE_TRANSFER_DISK_THROTTLE_LOW,&m_disk_throttle_low_stat,NULL,IF_BASICPUB|m_disk_throttle_low_stat.PubValue); m_stat_pool.AddProbe(ATTR_FILE_TRANSFER_DISK_THROTTLE_HIGH,&m_disk_throttle_high_stat,NULL,IF_BASICPUB|m_disk_throttle_high_stat.PubValue); m_stat_pool.AddProbe(ATTR_FILE_TRANSFER_DISK_THROTTLE_LIMIT,&m_disk_throttle_limit_stat,NULL,IF_BASICPUB|m_disk_throttle_limit_stat.PubValue); m_stat_pool.AddProbe(ATTR_FILE_TRANSFER_DISK_THROTTLE_EXCESS,&m_disk_throttle_excess,NULL,IF_BASICPUB|m_disk_throttle_excess.PubDefault); m_stat_pool.AddProbe(ATTR_FILE_TRANSFER_DISK_THROTTLE_SHORTFALL,&m_disk_throttle_shortfall,NULL,IF_BASICPUB|m_disk_throttle_shortfall.PubDefault); } else { m_stat_pool.RemoveProbe(ATTR_FILE_TRANSFER_DISK_THROTTLE_LOW); m_stat_pool.RemoveProbe(ATTR_FILE_TRANSFER_DISK_THROTTLE_HIGH); m_stat_pool.RemoveProbe(ATTR_FILE_TRANSFER_DISK_THROTTLE_LIMIT); m_stat_pool.RemoveProbe(ATTR_FILE_TRANSFER_DISK_THROTTLE_EXCESS); m_stat_pool.RemoveProbe(ATTR_FILE_TRANSFER_DISK_THROTTLE_SHORTFALL); } m_update_iostats_interval = param_integer("TRANSFER_IO_REPORT_INTERVAL",10,0); if( m_update_iostats_interval != 0 ) { if( m_update_iostats_timer != -1 ) { ASSERT( daemonCore->Reset_Timer_Period(m_update_iostats_timer,m_update_iostats_interval) == 0 ); } else { m_update_iostats_timer = daemonCore->Register_Timer( m_update_iostats_interval, m_update_iostats_interval, (TimerHandlercpp)&TransferQueueManager::UpdateIOStats, "UpdateIOStats",this); ASSERT( m_update_iostats_timer != -1 ); } } m_publish_flags = IF_BASICPUB; std::string publish_config; if( param(publish_config,"STATISTICS_TO_PUBLISH") ) { m_publish_flags = generic_stats_ParseConfigString(publish_config.c_str(), "TRANSFER", "TRANSFER", m_publish_flags); } std::string iostat_timespans; param(iostat_timespans,"TRANSFER_IO_REPORT_TIMESPANS"); std::string iostat_timespans_err; if( !ParseEMAHorizonConfiguration(iostat_timespans.c_str(),ema_config,iostat_timespans_err) ) { EXCEPT("Error in TRANSFER_IO_REPORT_TIMESPANS=%s: %s",iostat_timespans.c_str(),iostat_timespans_err.c_str()); } m_iostats.ConfigureEMAHorizons(ema_config); if( m_throttle_disk_load ) { if( !m_iostats.file_read.HasEMAHorizonNamed(m_disk_throttle_short_horizon.c_str()) ) { std::string shortest_horizon = m_iostats.file_read.ShortestHorizonEMAName(); dprintf(D_ALWAYS,"WARNING: FILE_TRANSFER_DISK_LOAD_THROTTLE_SHORT_HORIZON=%s does not match a timespan listed in TRANSFER_IO_REPORT_TIMESPANS=%s; using %s instead\n", m_disk_throttle_short_horizon.c_str(), iostat_timespans.c_str(), shortest_horizon.c_str()); m_disk_throttle_short_horizon = shortest_horizon; } if( !m_iostats.file_read.HasEMAHorizonNamed(m_disk_throttle_long_horizon.c_str()) ) { std::string shortest_horizon = m_iostats.file_read.ShortestHorizonEMAName(); dprintf(D_ALWAYS,"WARNING: FILE_TRANSFER_DISK_LOAD_THROTTLE_LONG_HORIZON=%s does not match a timespan listed in TRANSFER_IO_REPORT_TIMESPANS=%s; using %s instead\n", m_disk_throttle_long_horizon.c_str(), iostat_timespans.c_str(), shortest_horizon.c_str()); m_disk_throttle_long_horizon = shortest_horizon; } } for( QueueUserMap::iterator user_itr = m_queue_users.begin(); user_itr != m_queue_users.end(); ++user_itr ) { user_itr->second.iostats.ConfigureEMAHorizons(ema_config); } m_disk_throttle_excess.ConfigureEMAHorizons(ema_config); m_disk_throttle_shortfall.ConfigureEMAHorizons(ema_config); }