3 #include "Bench_Builder_Export.h"
10 #define APPLY_QOS_MASK(QOS_OUT, QOS_IN, MASK, PATH, FIELD) do { \
11 if (MASK.PATH.has_ ## FIELD) { \
12 QOS_OUT.PATH.FIELD = QOS_IN.PATH.FIELD; \
17 Bench_Builder_Export
extern const TimeStamp ZERO
;
19 Bench_Builder_Export TimeStamp
get_sys_time();
21 Bench_Builder_Export TimeStamp
get_hr_time();
23 Bench_Builder_Export TimeStamp
from_seconds(int32_t sec
);
25 Bench_Builder_Export
double to_seconds_double(const TimeStamp
& ts
);
27 Bench_Builder_Export
std::chrono::milliseconds
get_duration(const TimeStamp
& ts
);
29 Bench_Builder_Export TimeStamp
operator+(const TimeStamp
& lhs
, const TimeStamp
& rhs
);
31 Bench_Builder_Export TimeStamp
operator-(const TimeStamp
& lhs
, const TimeStamp
& rhs
);
33 Bench_Builder_Export
bool operator<(const TimeStamp
& lhs
, const TimeStamp
& rhs
);
35 Bench_Builder_Export
bool operator<=(const TimeStamp
& lhs
, const TimeStamp
& rhs
);
37 Bench_Builder_Export
bool operator==(const TimeStamp
& lhs
, const TimeStamp
& rhs
);
39 Bench_Builder_Export
bool operator!=(const TimeStamp
& lhs
, const TimeStamp
& rhs
);
41 Bench_Builder_Export
std::ostream
& operator<<(std::ostream
& out
, const TimeStamp
& ts
);
44 * This class is intended to provide constant-time access into a
45 * potentially-growing sequence of properties. We want the names and content of
46 * the properties to be dynamic (set by the users of the builder API), but for
47 * performance reasons it would be good to stay away from something with log-n
48 * access times (maps, etc)
50 class Bench_Builder_Export PropertyIndex
{
53 PropertyIndex(PropertySeq
& seq
, uint32_t index
);
55 const Property
* operator->() const;
56 Property
* operator->();
58 inline explicit operator bool() const noexcept
{ return seq_
!= 0; }
59 inline bool operator!() const noexcept
{ return seq_
== 0; }
61 PropertySeq
* get_seq() noexcept
{ return seq_
; };
62 const PropertySeq
* get_seq() const noexcept
{ return seq_
; };
69 class Bench_Builder_Export ConstPropertyIndex
{
72 ConstPropertyIndex(const PropertySeq
& seq
, uint32_t index
);
74 const Property
* operator->() const;
76 inline explicit operator bool() const noexcept
{ return seq_
!= 0; }
77 inline bool operator!() const noexcept
{ return seq_
== 0; }
79 const PropertySeq
* get_seq() const noexcept
{ return seq_
; };
82 const PropertySeq
* seq_
;
86 Bench_Builder_Export PropertyIndex
get_or_create_property(
87 PropertySeq
& seq
, const std::string
& name
, PropertyValueKind kind
);
89 Bench_Builder_Export ConstPropertyIndex
get_property(
90 const PropertySeq
& seq
, const std::string
& name
, PropertyValueKind kind
);
92 class Bench_Builder_Export NullStream
: public std::streambuf
{
97 class Bench_Builder_Export Log
{
99 static std::ostream
& log();
100 static std::ostream
* stream
;