return {dir, name};
});
+ d_lw->writeFunction("getNSSpeedTable", []() {
+ std::string ret;
+ auto number = SyncRes::getNSSpeedTable(ret);
+ return std::tuple<std::string, size_t>{ret, number};
+ });
if (!d_include_path.empty()) {
includePath(d_include_path);
float ret = std::numeric_limits<float>::max();
const float factor = iter->getFactor(now);
for (auto& entry : iter->d_collection) {
- if (float tmp = entry.second.get(factor); tmp < ret) {
- ret = tmp;
- }
+ ret = std::min(ret, entry.second.get(factor));
}
ind.modify(iter, [&](DecayingEwmaCollection& dec) { dec.d_lastget = now; });
return ret;
};
template <typename T, typename U>
- void getEntry(T& message, U entry)
+ void getEntry(T& message, U entry) const
{
message.add_bytes(PBNSSpeedEntry::required_bytes_name, entry->d_name.toString());
message.add_int64(PBNSSpeedEntry::required_int64_lastgets, entry->d_lastget.tv_sec);
}
}
- size_t getPB(std::string& ret)
+ size_t getPB(std::string& ret) const
{
protozero::pbf_builder<PBNSSpeedDump> full(ret);
full.add_string(PBNSSpeedDump::required_string_version, getPDNSVersion());
static LockGuarded<nsspeeds_t> s_nsSpeeds;
+size_t SyncRes::getNSSpeedTable(std::string& ret)
+{
+ const auto copy = *s_nsSpeeds.lock();
+ return copy.getPB(ret);
+}
+
class Throttle
{
public:
static uint64_t doDumpSavedParentNSSets(int fileDesc);
static uint64_t doDumpDoTProbeMap(int fileDesc);
+ static size_t getNSSpeedTable(std::string& ret);
+
static int getRootNS(struct timeval now, asyncresolve_t asyncCallback, unsigned int depth, Logr::log_t);
static void addDontQuery(const std::string& mask)
{