Move back timer comments to header (#2572)
This commit is contained in:
parent
2859c22009
commit
e0fe3fca69
3 changed files with 47 additions and 29 deletions
|
|
@ -66,7 +66,6 @@ desc (description_a)
|
|||
{
|
||||
}
|
||||
|
||||
/** Do not output if measured time is below the time units threshold in \p minimum_a */
|
||||
template <typename UNIT, typename CLOCK>
|
||||
nano::timer<UNIT, CLOCK> & nano::timer<UNIT, CLOCK>::set_minimum (UNIT minimum_a)
|
||||
{
|
||||
|
|
@ -74,11 +73,6 @@ nano::timer<UNIT, CLOCK> & nano::timer<UNIT, CLOCK>::set_minimum (UNIT minimum_a
|
|||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a child timer without starting it.
|
||||
* Since the timing API needs to have low overhead, this function
|
||||
* does not check if a timer with the same name already exists.
|
||||
*/
|
||||
template <typename UNIT, typename CLOCK>
|
||||
nano::timer<UNIT, CLOCK> & nano::timer<UNIT, CLOCK>::child (std::string const & description_a)
|
||||
{
|
||||
|
|
@ -86,7 +80,6 @@ nano::timer<UNIT, CLOCK> & nano::timer<UNIT, CLOCK>::child (std::string const &
|
|||
return children.back ();
|
||||
}
|
||||
|
||||
/** Create and start a child timer */
|
||||
template <typename UNIT, typename CLOCK>
|
||||
nano::timer<UNIT, CLOCK> & nano::timer<UNIT, CLOCK>::start_child (std::string const & description_a)
|
||||
{
|
||||
|
|
@ -95,7 +88,6 @@ nano::timer<UNIT, CLOCK> & nano::timer<UNIT, CLOCK>::start_child (std::string co
|
|||
return child_timer;
|
||||
}
|
||||
|
||||
/** Start the timer. This will assert if the timer is already started. */
|
||||
template <typename UNIT, typename CLOCK>
|
||||
void nano::timer<UNIT, CLOCK>::start ()
|
||||
{
|
||||
|
|
@ -104,7 +96,6 @@ void nano::timer<UNIT, CLOCK>::start ()
|
|||
begin = CLOCK::now ();
|
||||
}
|
||||
|
||||
/** Restarts the timer */
|
||||
template <typename UNIT, typename CLOCK>
|
||||
void nano::timer<UNIT, CLOCK>::restart ()
|
||||
{
|
||||
|
|
@ -114,11 +105,6 @@ void nano::timer<UNIT, CLOCK>::restart ()
|
|||
measurements = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Stops the timer and increases the measurement count. A timer can be started and paused
|
||||
* multiple times (e.g. in a loop).
|
||||
* @return duration
|
||||
*/
|
||||
template <typename UNIT, typename CLOCK>
|
||||
UNIT nano::timer<UNIT, CLOCK>::pause ()
|
||||
{
|
||||
|
|
@ -126,10 +112,6 @@ UNIT nano::timer<UNIT, CLOCK>::pause ()
|
|||
return stop ();
|
||||
}
|
||||
|
||||
/**
|
||||
* Stop timer
|
||||
* @return duration
|
||||
*/
|
||||
template <typename UNIT, typename CLOCK>
|
||||
UNIT nano::timer<UNIT, CLOCK>::stop ()
|
||||
{
|
||||
|
|
@ -141,16 +123,12 @@ UNIT nano::timer<UNIT, CLOCK>::stop ()
|
|||
return ticks;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return current units.
|
||||
*/
|
||||
template <typename UNIT, typename CLOCK>
|
||||
UNIT nano::timer<UNIT, CLOCK>::value () const
|
||||
{
|
||||
return ticks;
|
||||
}
|
||||
|
||||
/** Returns the duration in UNIT since the timer was last started. */
|
||||
template <typename UNIT, typename CLOCK>
|
||||
UNIT nano::timer<UNIT, CLOCK>::since_start () const
|
||||
{
|
||||
|
|
@ -158,7 +136,6 @@ UNIT nano::timer<UNIT, CLOCK>::since_start () const
|
|||
return std::chrono::duration_cast<UNIT> (end - begin);
|
||||
}
|
||||
|
||||
/** Returns true if the timer was last started longer than \p duration_a units ago*/
|
||||
template <typename UNIT, typename CLOCK>
|
||||
bool nano::timer<UNIT, CLOCK>::after_deadline (UNIT duration_a)
|
||||
{
|
||||
|
|
@ -166,7 +143,6 @@ bool nano::timer<UNIT, CLOCK>::after_deadline (UNIT duration_a)
|
|||
return std::chrono::duration_cast<UNIT> (end - begin) > duration_a;
|
||||
}
|
||||
|
||||
/** Returns true if the timer was last started shorter than \p duration_a units ago*/
|
||||
template <typename UNIT, typename CLOCK>
|
||||
bool nano::timer<UNIT, CLOCK>::before_deadline (UNIT duration_a)
|
||||
{
|
||||
|
|
@ -174,7 +150,6 @@ bool nano::timer<UNIT, CLOCK>::before_deadline (UNIT duration_a)
|
|||
return std::chrono::duration_cast<UNIT> (end - begin) < duration_a;
|
||||
}
|
||||
|
||||
/** Stop timer and write measurements to \p stream_a */
|
||||
template <typename UNIT, typename CLOCK>
|
||||
void nano::timer<UNIT, CLOCK>::stop (std::ostream & stream_a)
|
||||
{
|
||||
|
|
@ -182,7 +157,6 @@ void nano::timer<UNIT, CLOCK>::stop (std::ostream & stream_a)
|
|||
print (stream_a);
|
||||
}
|
||||
|
||||
/** Stop timer and write measurements to \p output_a */
|
||||
template <typename UNIT, typename CLOCK>
|
||||
void nano::timer<UNIT, CLOCK>::stop (std::string & output_a)
|
||||
{
|
||||
|
|
@ -191,7 +165,6 @@ void nano::timer<UNIT, CLOCK>::stop (std::string & output_a)
|
|||
output_a = stream.str ();
|
||||
}
|
||||
|
||||
/** Print measurements to the \p stream_a */
|
||||
template <typename UNIT, typename CLOCK>
|
||||
void nano::timer<UNIT, CLOCK>::print (std::ostream & stream_a)
|
||||
{
|
||||
|
|
@ -222,7 +195,6 @@ void nano::timer<UNIT, CLOCK>::print (std::ostream & stream_a)
|
|||
}
|
||||
}
|
||||
|
||||
/** Returns the SI unit string */
|
||||
template <typename UNIT, typename CLOCK>
|
||||
std::string nano::timer<UNIT, CLOCK>::unit () const
|
||||
{
|
||||
|
|
|
|||
|
|
@ -22,20 +22,66 @@ public:
|
|||
timer (nano::timer_state state_a, std::string const & description_a = "timer");
|
||||
timer (std::string const & description_a);
|
||||
timer (std::string const & description_a, timer * parent_a);
|
||||
|
||||
/** Do not output if measured time is below the time units threshold in \p minimum_a */
|
||||
timer & set_minimum (UNIT minimum_a);
|
||||
|
||||
/**
|
||||
* Create a child timer without starting it.
|
||||
* Since the timing API needs to have low overhead, this function
|
||||
* does not check if a timer with the same name already exists.
|
||||
*/
|
||||
timer & child (std::string const & description_a = "child timer");
|
||||
|
||||
/** Create and start a child timer */
|
||||
timer & start_child (std::string const & description_a = "child timer");
|
||||
|
||||
/** Start the timer. This will assert if the timer is already started. */
|
||||
void start ();
|
||||
|
||||
/**
|
||||
* Restarts the timer by setting start time to current time and resetting tick count.
|
||||
* This can be called in any timer state.
|
||||
*/
|
||||
void restart ();
|
||||
|
||||
/**
|
||||
* Stops the timer and increases the measurement count. A timer can be started and paused
|
||||
* multiple times (e.g. in a loop).
|
||||
* @return duration
|
||||
*/
|
||||
UNIT pause ();
|
||||
|
||||
/**
|
||||
* Stop timer. This will assert if the timer is not in a started state.
|
||||
* @return duration
|
||||
*/
|
||||
UNIT stop ();
|
||||
|
||||
/**
|
||||
* Return current tick count.
|
||||
*/
|
||||
UNIT value () const;
|
||||
|
||||
/** Returns the duration in UNIT since the timer was last started. */
|
||||
UNIT since_start () const;
|
||||
|
||||
/** Returns true if the timer was last started longer than \p duration_a units ago*/
|
||||
bool after_deadline (UNIT duration_a);
|
||||
|
||||
/** Returns true if the timer was last started shorter than \p duration_a units ago*/
|
||||
bool before_deadline (UNIT duration_a);
|
||||
|
||||
/** Stop timer and write measurements to \p stream_a */
|
||||
void stop (std::ostream & stream_a);
|
||||
|
||||
/** Stop timer and write measurements to \p output_a */
|
||||
void stop (std::string & output_a);
|
||||
|
||||
/** Print measurements to the \p stream_a */
|
||||
void print (std::ostream & stream_a);
|
||||
|
||||
/** Returns the SI unit string */
|
||||
std::string unit () const;
|
||||
nano::timer_state current_state () const;
|
||||
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@
|
|||
|
||||
namespace nano
|
||||
{
|
||||
/** Policy to affects at which stage a buffer can be dropped */
|
||||
/** Policy to affect at which stage a buffer can be dropped */
|
||||
enum class buffer_drop_policy
|
||||
{
|
||||
/** Can be dropped by bandwidth limiter (default) */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue