Flow 1.0.2
Flow project: Public API.
|
Convenience wrapper around an array<Duration, N>
, which stores a duration for each of the N possible clock types in perf::Clock_type.
More...
#include <clock_type_fwd.hpp>
Public Attributes | |
std::array< Duration, size_t(Clock_type::S_END_SENTINEL)> | m_values |
The underlying data, directly readable and writable by user. NOT ZERO-INITIALIZED ON CONSTRUCTION (or ever). | |
Related Functions | |
(Note that these are not member functions.) | |
std::ostream & | operator<< (std::ostream &os, const Duration_set &duration_set) |
Prints string representation of the given Duration_set value to the given ostream . More... | |
Duration_set & | operator+= (Duration_set &target, const Duration_set &to_add) |
Advances each Duration in the target Duration_set by the given respective addend Duration s (negative Duration causes advancing backwards). More... | |
Duration_set & | operator*= (Duration_set &target, uint64_t mult_scale) |
Scales each Duration in the target Duration_set by the given numerical constant. More... | |
Duration_set & | operator/= (Duration_set &target, uint64_t div_scale) |
Divides each Duration in the target Duration_set by the given numerical constant. More... | |
Convenience wrapper around an array<Duration, N>
, which stores a duration for each of the N possible clock types in perf::Clock_type.
It is a completely tight wrapper, not even adding zeroing of the array values on construction. It only adds convenience operations (possibly as free functions), namely some common math (such as scaling all N values by some numeric factor) and stream I/O.
Performance is absolutely key, so this is to be identical to the underlying (and publicly accessible) array
in terms of data storage and operations. I wrote this struct
to avoid overloading things like operator-(a, b)
and operator<<(ostream&, x)
, when the underlying type of a
, b,
xis a standard
array`: we don't want to overload such operations on a general type, even if it's only in our namespace. Historically, the first cut simply made non-operator-overload free function versions of such things operating directly on the array
s.
|
related |
Scales each Duration
in the target Duration_set by the given numerical constant.
operator*=(Duration_set)
by a potentially negative number; same for division.target | The set of Duration s each of which may be modified. |
mult_scale | Constant by which to multiply each target Duration . |
target
to enable standard *=
semantics.
|
related |
Advances each Duration
in the target Duration_set by the given respective addend Duration
s (negative Duration causes advancing backwards).
target | The set of Duration s each of which may be modified. |
to_add | The set of Duration s each of which is added to a target Duration . |
target
to enable standard +=
semantics.
|
related |
Divides each Duration
in the target Duration_set by the given numerical constant.
target | The set of Duration s each of which may be modified. |
div_scale | Constant by which to divide each target Duration . |
target
to enable standard /=
semantics.
|
related |
Prints string representation of the given Duration_set value to the given ostream
.
os | Stream to which to write. |
duration_set | Object to serialize. |
os
.