Loading...
Searching...
No Matches
Timer utilities
Internal routines

## Functions

static void | timer_start (magma_timer_t &t)
static void | timer_sync_start (magma_timer_t &t, magma_queue_t queue)
static magma_timer_t | timer_stop (magma_timer_t &t)
static magma_timer_t | timer_sync_stop (magma_timer_t &t, magma_queue_t queue)
static void | flops_start (magma_flops_t &flops)
static magma_flops_t | flops_stop (magma_flops_t &flops)
static int | timer_printf (const char *format,...) __attribute__((format(printf
| If ENABLE_TIMER is defined, same as printf; else does nothing (returns 0).
static int | timer_fprintf (FILE *stream, const char *format,...) __attribute__((format(printf
| If ENABLE_TIMER is defined, same as fprintf; else does nothing (returns 0).
static int | timer_snprintf (char *str, size_t size, const char *format,...) __attribute__((format(printf
| If ENABLE_TIMER is defined, same as snprintf; else does nothing (returns 0).

## Detailed Description

## Function Documentation

## timer_start()

void timer_start | ( | magma_timer_t & | t | ) |

inline static

Parameters

  [out] | t | On output, set to current time.

If ENABLE_TIMER is not defined, does nothing.

## timer_sync_start()

void timer_sync_start | ( | magma_timer_t & | t,
|  | magma_queue_t | queue )

inline static

Parameters

  [out] | t | On output, set to current time.
  [in] | queue | Queue to sync with, before getting time.

If ENABLE_TIMER is not defined, does nothing.

## timer_stop()

magma_timer_t timer_stop | ( | magma_timer_t & | t | ) |

inline static

Parameters

  [in,out] | t | On input, time when timer_start() was called. On output, set to (current time - start time).

Returns
  t, to sum up times:

      magma_timer_t time, time_sum=0;
      for( ... ) {
          timer_start( time );
          ...do timed operations...
          time_sum += timer_stop( time );

          ...do other operations...
      }

If ENABLE_TIMER is not defined, returns 0.

## timer_sync_stop()

magma_timer_t timer_sync_stop | ( | magma_timer_t & | t,
|  | magma_queue_t | queue )

inline static

Parameters

  [in,out] | t | On input, time when timer_start() was called. On output, set to (current time - start time).
  [in] | queue | Queue to sync with, before getting time.

Returns
  t, to sum up times:

      magma_timer_t time, time_sum=0;
      for( ... ) {
          timer_start( time );
          ...do timed operations...
          time_sum += timer_stop( time );

          ...do other operations...
      }

If ENABLE_TIMER is not defined, returns 0.

## flops_start()

void flops_start | ( | magma_flops_t & | flops | ) |

inline static

Parameters

  [out] | flops | On output, set to current flop counter.

Requires global gPAPI_flops_set to be setup by testing/magma_util.cpp Note that newer CPUs may not support flop counts; see https://icl.cs.utk.edu/projects/papi/wiki/PAPITopics:SandyFlops

If ENABLE_TIMER and HAVE_PAPI are not both defined, does nothing.

## flops_stop()

magma_flops_t flops_stop | ( | magma_flops_t & | flops | ) |

inline static

Parameters

  [out] | flops | On input, flop counter when flops_start() was called. On output, set to (current flop counter - start flop counter).

Returns
  flops, so you can sum up; see timer_stop().

If ENABLE_TIMER and HAVE_PAPI are not both defined, returns 0.