ConstElementPtr
ControlledDhcpv4Srv::commandStatisticSetMaxSampleCountAllHandler(const string&,
ConstElementPtr args) {
- ConstElementPtr answer = StatsMgr::statisticSetMaxSampleCountAllHandler(args);
+ StatsMgr& stats_mgr = StatsMgr::instance();
+ ConstElementPtr answer = stats_mgr.statisticSetMaxSampleCountAllHandler(args);
// Update the default parameter.
- long max_samples = StatsMgr::instance().getMaxSampleCountDefault();
+ long max_samples = stats_mgr.getMaxSampleCountDefault();
CfgMgr::instance().getCurrentCfg()->addConfiguredGlobal(
"statistic-default-sample-count", Element::create(max_samples));
return (answer);
ConstElementPtr
ControlledDhcpv4Srv::commandStatisticSetMaxSampleAgeAllHandler(const string&,
- ConstElementPtr args) {
- ConstElementPtr answer = StatsMgr::statisticSetMaxSampleAgeAllHandler(args);
+ ConstElementPtr args) {
+ StatsMgr& stats_mgr = StatsMgr::instance();
+ ConstElementPtr answer = stats_mgr.statisticSetMaxSampleAgeAllHandler(args);
// Update the default parameter.
- auto duration = StatsMgr::instance().getMaxSampleAgeDefault();
+ auto duration = stats_mgr.getMaxSampleAgeDefault();
long max_age = duration.total_seconds();
CfgMgr::instance().getCurrentCfg()->addConfiguredGlobal(
"statistic-default-sample-age", Element::create(max_age));
/// @brief handler for processing 'statistic-sample-count-set-all' command
///
/// This handler processes statistic-sample-count-set-all command,
- /// which set max_sample_count_ limit of all statistics and the default.
+ /// which sets max_sample_count_ limit of all statistics and the default.
/// @ref isc::stats::StatsMgr::statisticSetMaxSampleCountAllHandler
///
/// @param command (ignored)
/// @brief handler for processing 'statistic-sample-age-set-all' command
///
/// This handler processes statistic-sample-age-set-all command,
- /// which set max_sample_age_ limit of all statistics and the default.
+ /// which sets max_sample_age_ limit of all statistics and the default.
/// @ref isc::stats::StatsMgr::statisticSetMaxSampleAgeAllHandler
///
/// @param command (ignored)
ConstElementPtr
ControlledDhcpv6Srv::commandStatisticSetMaxSampleCountAllHandler(const string&,
ConstElementPtr args) {
- ConstElementPtr answer = StatsMgr::statisticSetMaxSampleCountAllHandler(args);
+ StatsMgr& stats_mgr = StatsMgr::instance();
+ ConstElementPtr answer = stats_mgr.statisticSetMaxSampleCountAllHandler(args);
// Update the default parameter.
- long max_samples = StatsMgr::instance().getMaxSampleCountDefault();
+ long max_samples = stats_mgr.getMaxSampleCountDefault();
CfgMgr::instance().getCurrentCfg()->addConfiguredGlobal(
"statistic-default-sample-count", Element::create(max_samples));
return (answer);
ConstElementPtr
ControlledDhcpv6Srv::commandStatisticSetMaxSampleAgeAllHandler(const string&,
- ConstElementPtr args) {
- ConstElementPtr answer = StatsMgr::statisticSetMaxSampleAgeAllHandler(args);
+ ConstElementPtr args) {
+ StatsMgr& stats_mgr = StatsMgr::instance();
+ ConstElementPtr answer = stats_mgr.statisticSetMaxSampleAgeAllHandler(args);
// Update the default parameter.
- auto duration = StatsMgr::instance().getMaxSampleAgeDefault();
+ auto duration = stats_mgr.getMaxSampleAgeDefault();
long max_age = duration.total_seconds();
CfgMgr::instance().getCurrentCfg()->addConfiguredGlobal(
"statistic-default-sample-age", Element::create(max_age));
/// @brief handler for processing 'statistic-sample-count-set-all' command
///
/// This handler processes statistic-sample-count-set-all command,
- /// which set max_sample_count_ limit of all statistics and the default.
+ /// which sets max_sample_count_ limit of all statistics and the default.
/// @ref isc::stats::StatsMgr::statisticSetMaxSampleCountAllHandler
///
/// @param command (ignored)
/// @brief handler for processing 'statistic-sample-age-set-all' command
///
/// This handler processes statistic-sample-age-set-all command,
- /// which set max_sample_age_ limit of all statistics and the default.
+ /// which sets max_sample_age_ limit of all statistics and the default.
/// @ref isc::stats::StatsMgr::statisticSetMaxSampleAgeAllHandler
///
/// @param command (ignored)
return (createAnswer(CONTROL_RESULT_ERROR, error));
}
if (MultiThreadingMgr::instance().getMode()) {
+ lock_guard<mutex> lock(*mutex_);
StatsMgr::instance().setMaxSampleCountDefaultInternal(0);
StatsMgr::instance().setMaxSampleAgeDefaultInternal(duration);
StatsMgr::instance().setMaxSampleAgeAllInternal(duration);
return (createAnswer(CONTROL_RESULT_ERROR, error));
}
if (MultiThreadingMgr::instance().getMode()) {
+ lock_guard<mutex> lock(*mutex_);
StatsMgr::instance().setMaxSampleCountDefaultInternal(max_samples);
StatsMgr::instance().setMaxSampleCountAllInternal(max_samples);
} else {
/// @brief Handles statistic-sample-age-set command
///
/// This method handles statistic-sample-age-set command,
- /// which set max_sample_age_ limit of a given statistic
+ /// which sets max_sample_age_ limit of a given statistic
/// and leaves max_sample_count_ disabled.
/// It expects two parameters stored in params map:
/// name: name of the statistic
/// @brief Handles statistic-sample-count-set command
///
/// This method handles statistic-sample-count-set command,
- /// which set max_sample_count_ limit of a given statistic
+ /// which sets max_sample_count_ limit of a given statistic
/// and leaves max_sample_age_ disabled.
/// It expects two parameters stored in params map:
/// name: name of the statistic
/// @brief Handles statistic-sample-age-set-all command
///
/// This method handles statistic-sample-age-set-all command,
- /// which set max_sample_age_ limit to all statistics and the default.
+ /// which sets max_sample_age_ limit to all statistics and the default.
/// It expects one parameter stored in params map:
/// duration: limit expressed as a number of seconds
///
///
/// @param params structure containing a map that contains "duration"
/// @return answer confirming success of this operation
- static isc::data::ConstElementPtr
+ isc::data::ConstElementPtr
statisticSetMaxSampleAgeAllHandler(const isc::data::ConstElementPtr& params);
/// @brief Handles statistic-sample-count-set-all command
///
/// This method handles statistic-sample-count-set-all command,
- /// which set max_sample_count_ limit of all statistics and the default.
+ /// which sets max_sample_count_ limit of all statistics and the default.
/// It expects one parameter stored in params map:
/// max-samples: count limit
/// The value 0 is out of range.
///
/// @param params structure containing a map that contains "max-samples"
/// @return answer confirming success of this operation
- static isc::data::ConstElementPtr
+ isc::data::ConstElementPtr
statisticSetMaxSampleCountAllHandler(const isc::data::ConstElementPtr& params);
/// @}
///
/// Should be called in a thread safe context.
///
- /// @param duration determines default maximum age of samples
+ /// @param duration default maximum age of samples to keep.
void setMaxSampleAgeDefaultInternal(const StatsDuration& duration);
/// @brief Set default count limit.
///
/// Should be called in a thread safe context.
///
- /// @param max_samples default maximum number of samples to keep
+ /// @param max_samples default maximum number of samples to keep.
/// (0 means to disable count limit and enable age limit)
void setMaxSampleCountDefaultInternal(uint32_t max_samples);