1#ifndef AMPGEN_PROFILECLOCK_H 
    2#define AMPGEN_PROFILECLOCK_H 1 
   10    std::chrono::time_point<std::chrono::high_resolution_clock>       
t_start;
 
   11    std::chrono::time_point<std::chrono::high_resolution_clock>       
t_end;
 
   17      t_end      = std::chrono::high_resolution_clock::now() ; 
 
 
   22      auto now = std::chrono::high_resolution_clock::now() ; 
 
   23      return std::chrono::duration<double, std::milli>(now - 
t_start ).count();
 
 
   25    void start(){ 
t_start = std::chrono::high_resolution_clock::now() ; }
 
 
   29  template <
int N, 
class FCN> 
 
   30    double  Profile( 
const FCN& 
fcn, 
const std::string& name =
"" ){
 
   32      for( 
size_t i = 0 ; i < N; ++i ) 
fcn();
 
 
   37  template <
int N, 
class FCN> 
 
   43      for( 
size_t i = 0 ; i < N; ++i ){
 
   49        tmin = pi < tmin ? pi : tmin;
 
   50        tmax = pi > tmax ? pi : tmax;
 
   53      t2 = std::sqrt( t2 / 
double(N) - t*t);
 
   54      INFO( (name == 
"" ? 
type_string<FCN>() : name ) << 
" " << t << 
" ± " << t2 << 
"[ms] per iteration << [" << tmin << 
", " << tmax << 
"]" );
 
 
   58  template <
int N, 
class FCN> 
 
   62      for( 
size_t i = 0 ; i < N; ++i ) z += 
fcn();
 
 
#define INFO(X)
Used for printing information messages, and will always be printed.
double ProfileWithStat(const FCN &fcn, const std::string &name="")
double Profile(const FCN &fcn, const std::string &name="")
std::string type_string()
Utility classes for compile-time metaprogramming, such as identifying the types of arguments for gene...
double Profile2(const FCN &fcn)
std::chrono::time_point< std::chrono::high_resolution_clock > t_end
std::chrono::time_point< std::chrono::high_resolution_clock > t_start