---
name: "sc_RegionTimer"
section: "3"
platform: "linux"
package: "libsc-doc"
version: "2.3.1-22"
release: "Debian 12 (Bookworm)"
platforms: ["linux"]
url: "https://new.carta.tech/sc_RegionTimer"
---

# sc\_RegionTimer(3)

The RegionTimer class is used to record the time spent in a section of code.

## NAME

sc::RegionTimer - The **RegionTimer** class is used to record the time spent in a section of code.

## SYNOPSIS

`#include <regtime.h>`

Inherits **sc::DescribedClass**.

Inherited by **sc::ParallelRegionTimer**.

### Public Member Functions

**RegionTimer** (const char \*topname='total', int cpu\_time=0, int wall\_time=1)\
 **RegionTimer** (const **Ref**\< **KeyVal** \> &)\
 void **enter** (const char \*=0)\
 void **change** (const char \*newname, const char \*oldname=0)\
 void **exit** (const char \*=0, bool do\_not\_throw=false)\
 void **set\_default** (const char \*)\
 void **unset\_default** ()\
 void **enter\_default** ()\
 void **exit\_default** ()\
 virtual void **print** (std::ostream &=**ExEnv::out0**()) const\
 Print the object.  void **update\_top** () const\
 int **nregion** () const\
 void **get\_region\_names** (const char \*names\[\]) const\
 void **get\_wall\_times** (double \*) const\
 void **get\_cpu\_times** (double \*) const\
 void **get\_flops** (double \*) const\
 void **get\_depth** (int \*) const\
 double **get\_wall\_time** () const\
 double **get\_cpu\_time** () const\
 double **get\_flops** () const\
 void **add\_wall\_time** (const char \*, double)\
 void **add\_cpu\_time** (const char \*, double)\
 void **add\_flops** (const char \*, double)\

### Static Public Member Functions

static **RegionTimer** \* **default\_regiontimer** ()\
 static void **set\_default\_regiontimer** (const **Ref**\< **RegionTimer** \> &)\

### Protected Attributes

int **wall\_time\_**\
 int **cpu\_time\_**\
 int **flops\_**\
 **TimedRegion** \* **top\_**\
 **TimedRegion** \* **current\_**\
 **TimedRegion** \* **default\_**\

### Additional Inherited Members

## Detailed Description

The **RegionTimer** class is used to record the time spent in a section of code.

During the run of a code, enter and exit members are called to begin and end timed sections. The print member is used to display the obtained times. Multiple enter calls for a region with the same name aggregate the timings. Nested regions are supported.

## Member Function Documentation

### virtual void sc::RegionTimer::print (std::ostream & = ExEnv::out0`()`) const` [virtual]`

Print the object.

Reimplemented from **sc::DescribedClass**.

Reimplemented in **sc::ParallelRegionTimer**.

## Author

Generated automatically by Doxygen for MPQC from the source code.
