ABACUS develop
Atomic-orbital Based Ab-initio Computation at UStc
Loading...
Searching...
No Matches
Classes | Static Public Member Functions | Static Public Attributes | Static Private Member Functions | Static Private Attributes | List of all members
ModuleBase::timer Class Reference

Tracing computation time. More...

#include <timer.h>

Collaboration diagram for ModuleBase::timer:

Classes

struct  Timer_One
 

Static Public Member Functions

static void tick (const std::string &class_name_in, const std::string &name_in)
 Use twice at a time: the first time, set start_flag to false; the second time, calculate the time duration.
 
static void start (void)
 Start total time calculation.
 
static void finish (std::ofstream &ofs, const bool print_flag=1)
 Finish total time calculation and print computational processes with duration > 0.1 s.
 
static void enable (void)
 Enable time computation.
 
static void disable (void)
 Disable time computation.
 
static void write_to_json (std::string file_name)
 Write all computational processes to json file.
 
static void print_all (std::ofstream &ofs)
 Print all computational processes with during > 0.1 s.
 
static long double print_until_now (void)
 Stop total time calculation, print total time until now, and then start total time calculation again.
 

Static Public Attributes

static std::map< std::string, std::map< std::string, Timer_One > > timer_pool
 

Static Private Member Functions

static double cpu_time (void)
 Member function: calculate time.
 

Static Private Attributes

static bool disabled = false
 Member variable: if disabled , timer can't work.
 
static size_t n_now = 0
 Member variable: the index of clocks.
 

Detailed Description

Tracing computation time.

Authors
Fangwei, Mohan, Peize Lin

Member Function Documentation

◆ cpu_time()

double ModuleBase::timer::cpu_time ( void  )
staticprivate

Member function: calculate time.

Returns
double
Here is the caller graph for this function:

◆ disable()

static void ModuleBase::timer::disable ( void  )
inlinestatic

Disable time computation.

Here is the caller graph for this function:

◆ enable()

static void ModuleBase::timer::enable ( void  )
inlinestatic

Enable time computation.

◆ finish()

void ModuleBase::timer::finish ( std::ofstream &  ofs,
const bool  print_flag = 1 
)
static

Finish total time calculation and print computational processes with duration > 0.1 s.

Parameters
ofsThe output file for print out timings
print_flagPrint timings or not
Here is the call graph for this function:
Here is the caller graph for this function:

◆ print_all()

void ModuleBase::timer::print_all ( std::ofstream &  ofs)
static

Print all computational processes with during > 0.1 s.

Parameters
ofsThe output file for print out timings
Here is the call graph for this function:
Here is the caller graph for this function:

◆ print_until_now()

long double ModuleBase::timer::print_until_now ( void  )
static

Stop total time calculation, print total time until now, and then start total time calculation again.

Returns
long double
Here is the call graph for this function:
Here is the caller graph for this function:

◆ start()

void ModuleBase::timer::start ( void  )
static

Start total time calculation.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ tick()

void ModuleBase::timer::tick ( const std::string &  class_name_in,
const std::string &  name_in 
)
static

Use twice at a time: the first time, set start_flag to false; the second time, calculate the time duration.

Parameters
class_name_inThe class name for timing
name_inThe compuational process for timing
Here is the call graph for this function:

◆ write_to_json()

void ModuleBase::timer::write_to_json ( std::string  file_name)
static

Write all computational processes to json file.

Parameters
file_nameThe output file name
Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ disabled

bool ModuleBase::timer::disabled = false
staticprivate

Member variable: if disabled , timer can't work.

◆ n_now

size_t ModuleBase::timer::n_now = 0
staticprivate

Member variable: the index of clocks.

◆ timer_pool

std::map< std::string, std::map< std::string, timer::Timer_One > > ModuleBase::timer::timer_pool
static

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