0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-17 23:40:57 +01:00

ircd::db: Deinline stats ctor; zero-init histogram; implement Reset().

This commit is contained in:
Jason Volk 2018-09-25 21:20:02 -07:00
parent a806ce2762
commit e5a96aab93
2 changed files with 17 additions and 4 deletions

View file

@ -21,7 +21,7 @@ struct ircd::db::database::stats final
{ {
database *d; database *d;
std::array<uint64_t, rocksdb::TICKER_ENUM_MAX> ticker {{0}}; std::array<uint64_t, rocksdb::TICKER_ENUM_MAX> ticker {{0}};
std::array<rocksdb::HistogramData, rocksdb::HISTOGRAM_ENUM_MAX> histogram; std::array<rocksdb::HistogramData, rocksdb::HISTOGRAM_ENUM_MAX> histogram {{0.0}};
uint64_t getTickerCount(const uint32_t tickerType) const noexcept override; uint64_t getTickerCount(const uint32_t tickerType) const noexcept override;
void recordTick(const uint32_t tickerType, const uint64_t count) noexcept override; void recordTick(const uint32_t tickerType, const uint64_t count) noexcept override;
@ -30,8 +30,7 @@ struct ircd::db::database::stats final
void measureTime(const uint32_t histogramType, const uint64_t time) noexcept override; void measureTime(const uint32_t histogramType, const uint64_t time) noexcept override;
bool HistEnabledForType(const uint32_t type) const noexcept override; bool HistEnabledForType(const uint32_t type) const noexcept override;
uint64_t getAndResetTickerCount(const uint32_t tickerType) noexcept override; uint64_t getAndResetTickerCount(const uint32_t tickerType) noexcept override;
rocksdb::Status Reset() noexcept override;
stats(database *const &d) stats(database *const &d);
:d{d}
{}
}; };

View file

@ -1884,6 +1884,20 @@ ircd::db::histogram_max
// database::stats (db/database/stats.h) internal // database::stats (db/database/stats.h) internal
// //
ircd::db::database::stats::stats(database *const &d)
:d{d}
{
}
rocksdb::Status
ircd::db::database::stats::Reset()
noexcept
{
ticker.fill(0);
histogram.fill({0.0});
return rocksdb::Status::OK();
}
uint64_t uint64_t
ircd::db::database::stats::getAndResetTickerCount(const uint32_t type) ircd::db::database::stats::getAndResetTickerCount(const uint32_t type)
noexcept noexcept