0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-10-01 05:08:59 +02:00

ircd::prof: Make sample_t constructions consistent for all prof objects.

This commit is contained in:
Jason Volk 2019-04-07 15:33:36 -07:00
parent 6ae6624772
commit ab6cf110d5
2 changed files with 10 additions and 13 deletions

View file

@ -22,7 +22,7 @@ namespace ircd::prof
enum counter :uint8_t;
enum cacheop :uint8_t;
using group = std::vector<std::unique_ptr<event>>;
IRCD_OVERLOAD(sample)
IRCD_EXCEPTION(ircd::error, error)
uint64_t cycles(); ///< Monotonic reference cycles (since system boot)
@ -34,7 +34,6 @@ namespace ircd::prof
// Observe
system &hotsample(system &) noexcept;
system &sample(system &) noexcept;
system &operator+=(system &a, const system &b);
system &operator-=(system &a, const system &b);
system operator+(const system &a, const system &b);
@ -65,7 +64,6 @@ struct ircd::prof::times
uint64_t kern {0};
uint64_t user {0};
IRCD_OVERLOAD(sample)
times(sample_t);
times() = default;
};
@ -87,6 +85,7 @@ struct ircd::prof::system
// 5: SWITCH_TASK,
// 6: SWITCH_CPU,
system(sample_t) noexcept;
system()
:array_type{{0}}
{}

View file

@ -220,16 +220,6 @@ ircd::prof::operator+=(system &a,
return a;
}
ircd::prof::system &
ircd::prof::sample(system &s)
noexcept
{
stop(system::group);
hotsample(s);
start(system::group);
return s;
}
ircd::prof::system &
ircd::prof::hotsample(system &s)
noexcept
@ -299,6 +289,14 @@ ircd::prof::for_each(const const_buffer &buf,
return closure(type(**it), body[i].val);
}
ircd::prof::system::system(sample_t)
noexcept
{
stop(group);
hotsample(*this);
start(group);
}
//
// event
//