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 start (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 end (const std::string &class_name_in, const std::string &name_in)
 
static void start (void)
 Start total time calculation.
 
static void finish (std::ofstream &ofs, const bool print_flag=true, const bool check_end=true)
 Finish total time calculation and print computational processes with duration > 0.1 s.
 
static void enable (void)
 Enable time computation.
 
static void set_nvtx_enabled (bool b)
 Toggle NVTX range emission for CUDA profiling. Caller-injected; only consulted when built with __CUDA && __USE_NVTX.
 
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, const bool check_end)
 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 bool enable_nvtx_ = false
 Member variable: NVTX range emission toggle (CUDA profiling only).
 
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.

◆ end()

void ModuleBase::timer::end ( const std::string &  class_name_in,
const std::string &  name_in 
)
static
Here is the call graph for this function:

◆ finish()

void ModuleBase::timer::finish ( std::ofstream &  ofs,
const bool  print_flag = true,
const bool  check_end = true 
)
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,
const bool  check_end 
)
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:

◆ set_nvtx_enabled()

static void ModuleBase::timer::set_nvtx_enabled ( bool  b)
inlinestatic

Toggle NVTX range emission for CUDA profiling. Caller-injected; only consulted when built with __CUDA && __USE_NVTX.

Here is the caller graph for this function:

◆ start() [1/2]

void ModuleBase::timer::start ( 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:

◆ start() [2/2]

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

Start total time calculation.

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.

◆ enable_nvtx_

bool ModuleBase::timer::enable_nvtx_ = false
staticprivate

Member variable: NVTX range emission toggle (CUDA profiling only).

◆ 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: