---
name: "TAU_PROFILE_TIMER_DYNAMIC"
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_DYNAMIC"
---

# TAU\_PROFILE\_TIMER\_DYNAMIC(3)

Defines a dynamic timer.

## NAME

TAU\_PROFILE\_TIMER\_DYNAMIC - Defines a dynamic timer.

## SYNOPSIS

**C/C++:**

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

**Fortran:**

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

## DESCRIPTION

TAU\_PROFILE\_TIMER\_DYNAMIC operates similar to TAU\_PROFILE\_TIMER except that the timer is created each time the statement is invoked. This way, the name of the timer can be different for each execution.

## EXAMPLE

**C/C++ :**

```
int main(int argc, char **argv) {
  int i;
  TAU_PROFILE_TIMER(t,"main()", "", TAU_DEFAULT);
  TAU_PROFILE_SET_NODE(0);
  TAU_PROFILE_START(t);
  for (i=0; i&5; i++) {
    char buf[32];
    sprintf(buf, "Iteration %d", i);
    TAU_PROFILE_TIMER_DYNAMIC(timer, buf, "", TAU_USER);
    TAU_PROFILE_START(timer);
    printf("Iteration %d\n", i);
    f1();
    TAU_PROFILE_STOP(timer);
  }
  return 0;
}
```

**Fortran :**

```
subroutine ITERATION(val)
  integer val
  character(13) cvar
  integer profiler(2) / 0, 0 /
  save profiler
  print *, "Iteration ", val
  write (cvar,'(a9,i2)') 'Iteration', val
  call TAU_PROFILE_TIMER_DYNAMIC(profiler, cvar)
  call TAU_PROFILE_START(profiler)
  call F1()
  call TAU_PROFILE_STOP(profiler)
  return
end
```

## SEE ALSO

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