本文整理汇总了C++中host::Ptr::get_current_average方法的典型用法代码示例。如果您正苦于以下问题:C++ Ptr::get_current_average方法的具体用法?C++ Ptr::get_current_average怎么用?C++ Ptr::get_current_average使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类host::Ptr
的用法示例。
在下文中一共展示了Ptr::get_current_average方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Ptr
Host::Ptr LatencyAwarePolicy::LatencyAwareQueryPlan::compute_next() {
int64_t min = policy_->min_average_.load();
const Settings& settings = policy_->settings_;
uint64_t now = uv_hrtime();
Host::Ptr host;
while ((host = child_plan_->compute_next())) {
TimestampedAverage latency = host->get_current_average();
if (min < 0 ||
latency.average < 0 ||
latency.num_measured < settings.min_measured ||
(now - latency.timestamp) > settings.retry_period_ns) {
return host;
}
if (latency.average <= static_cast<int64_t>(settings.exclusion_threshold * min)) {
return host;
}
skipped_.push_back(host);
}
if (skipped_index_ < skipped_.size()) {
return skipped_[skipped_index_++];
}
return Host::Ptr();
}