cli11
Loading...
Searching...
No Matches
timer.cpp File Reference
module cli11

Small wall-clock timing helpers. More...

import std;

Classes

class  cli::timer_t
 Measures elapsed wall-clock time from construction. More...
class  cli::auto_timer_t
 A timer_t that reports to std::cout when it goes out of scope. More...

Functions

auto cli::operator<< (std::ostream &in, const timer_t &timer) -> std::ostream &
 Streams a rendered measurement.

Detailed Description

Small wall-clock timing helpers.

cli::timer_t measures elapsed time from its own construction and renders it through a caller-supplied formatting callable. cli::auto_timer_t is the same thing with a destructor that reports automatically, so timing a scope is a single declaration:

{
const cli::auto_timer_t t{"parse"};
app.parse(argc, argv);
} // prints "parse: 1.2345 ms"
A timer_t that reports to std::cout when it goes out of scope.
Definition timer.cpp:174

Function Documentation

◆ operator<<()

auto cli::operator<< ( std::ostream & in,
const timer_t & timer ) -> std::ostream &
export

Streams a rendered measurement.

Parameters
inThe stream to write to.
timerThe timer to render.
Returns
in, for chaining.