Xmipp  v3.23.11-Nereus
Public Member Functions | List of all members

#include <xmipp_funcs.h>

Public Member Functions

size_t now ()
 
size_t tic ()
 
size_t toc (const char *msg=NULL, bool inSecs=true)
 
size_t elapsed ()
 

Detailed Description

This class will encapsulate the logic to time printing. Useful for debugging.

Definition at line 948 of file xmipp_funcs.h.

Member Function Documentation

◆ elapsed()

size_t Timer::elapsed ( )

Definition at line 732 of file xmipp_funcs.cpp.

733 {
734  return now() - tic_time;
735 }
size_t now()

◆ now()

size_t Timer::now ( )

Definition at line 702 of file xmipp_funcs.cpp.

703 {
704  gettimeofday(&tv, NULL);
705  localtime_r(&tv.tv_sec,&tm);
706  return tm.tm_hour * 3600 * 1000 + tm.tm_min * 60 * 1000 + tm.tm_sec * 1000 +
707  tv.tv_usec / 1000;
708 }

◆ tic()

size_t Timer::tic ( )

Definition at line 710 of file xmipp_funcs.cpp.

711 {
712  tic_time = now();
713  return tic_time;
714 }
size_t now()

◆ toc()

size_t Timer::toc ( const char *  msg = NULL,
bool  inSecs = true 
)

Definition at line 716 of file xmipp_funcs.cpp.

717 {
718  size_t diff = elapsed();
719 
720  if (msg != NULL)
721  std::cout << msg;
722  std::cout << "Elapsed time: ";
723 
724  if (inSecs)
725  std::cout << diff/1000.0 << " secs." << std::endl;
726  else
727  std::cout << diff << " msecs." << std::endl;
728 
729  return diff;
730 }
size_t elapsed()

The documentation for this class was generated from the following files: