---
name: "TAU_PROFILE_TIMER"
section: "3"
platform: "linux"
package: "tau"
version: "2.17.3.1.dfsg-4.2"
release: "Debian 9 (Stretch)"
platforms: ["linux"]
url: "https://new.carta.tech/TAU_PROFILE_TIMER"
---

# TAU\_PROFILE\_TIMER(3)

Defines a static timer.

## NAME

TAU\_PROFILE\_TIMER - Defines a static timer.

## SYNOPSIS

**C/C++:**

**TAU\_PROFILE\_TIMER(Profiler** *timer***, char\* or string&** *function\_name***, char\* or string&** *type***, TauGroup\_t** *group***);**

**Fortran:**

**TAU\_PROFILE\_TIMER(integer** *profiler***(2), character** *name***(size));**

## DESCRIPTION

**C/C++ :**

With TAU\_PROFILE\_TIMER, a group of one or more statements is profiled. This macro has a timer variable as its first argument, and then strings for name and type, as described earlier. It associates the timer to the profile group specified in the last parameter.

**Fortran :**

To profile a block of Fortran code, such as a function, subroutine, loop etc., the user must first declare a profiler, which is an integer array of two elements (pointer) with the save attribute, and pass it as the first parameter to the TAU\_PROFILE\_TIMER subroutine. The second parameter must contain the name of the routine, which is enclosed in a single quote. TAU\_PROFILE\_TIMER declares the profiler that must be used to profile a block of code. The profiler is used to profile the statements using TAU\_PROFILE\_START and TAU\_PROFILE\_STOP as explained later.

## EXAMPLE

**C/C++ :**

```
template< class T, unsigned Dim >
void BareField<T,Dim>::fillGuardCells(bool reallyFill)
{
 // profiling macros
 TAU_TYPE_STRING(taustr, CT(*this) + " void (bool)" );
 TAU_PROFILE("BareField::fillGuardCells()", taustr, TAU_FIELD);
 TAU_PROFILE_TIMER(sendtimer, "fillGuardCells-send",
                   taustr, TAU_FIELD);
 TAU_PROFILE_TIMER(localstimer, "fillGuardCells-locals",
                   taustr, TAU_FIELD);
 ...
}
```

**Fortran :**

```
subroutine bcast_inputs
implicit none
integer profiler(2)
save profiler
include 'mpinpb.h'
include 'applu.incl'
interger IERR
call TAU_PROFILE_TIMER(profiler, 'bcast_inputs')
```

## SEE ALSO

[TAU\_PROFILE\_TIMER\_DYNAMIC(3)](/TAU_PROFILE_TIMER_DYNAMIC/3.md), [TAU\_PROFILE\_START(3)](/TAU_PROFILE_START/3.md), [TAU\_PROFILE\_STOP(3)](/TAU_PROFILE_STOP/3.md)
