0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-12-26 07:23:53 +01:00

ircd::util: Add pretty() convenience to timer.

This commit is contained in:
Jason Volk 2019-04-27 15:51:36 -07:00
parent 2e586fe529
commit 0cdbe472d1
2 changed files with 17 additions and 0 deletions

View file

@ -27,6 +27,8 @@ struct ircd::util::timer
bool stopped() const;
template<class duration = std::chrono::seconds> duration get() const;
template<class duration = std::chrono::seconds> duration at() const;
string_view pretty(const mutable_buffer &out, const int &fmt = 0) const;
std::string pretty(const int &fmt = 0) const;
void cont();
void stop();

View file

@ -524,6 +524,21 @@ ircd::util::timer::cont()
start = clock::now();
}
std::string
ircd::util::timer::pretty(const int &fmt)
const
{
return util::pretty(at(), fmt);
}
ircd::string_view
ircd::util::timer::pretty(const mutable_buffer &out,
const int &fmt)
const
{
return util::pretty(out, at(), fmt);
}
bool
ircd::util::timer::stopped()
const