Discontinuous Galerkin Library
#include "dg/algorithm.h"
dg::Timer Struct Reference

Simple tool for performance measuring. More...

Public Member Functions

void tic ()
 Start timer. More...
 
void toc ()
 Stop timer. More...
 
double diff () const
 Return time in seconds elapsed between tic and toc. More...
 

Detailed Description

Simple tool for performance measuring.

The implementation of this class is chosen with compile-time MACROS THRUST_DEVICE_SYSTEM and MPI_VERSION.

t.tic();
some_function_to_benchmark();
t.toc();
std::cout << "Function took "<<t.diff()<<"s\n";
Simple tool for performance measuring.
Definition: dg_doc.h:445
double diff() const
Return time in seconds elapsed between tic and toc.
void toc()
Stop timer.
void tic()
Start timer.

Member Function Documentation

◆ diff()

double dg::Timer::diff ( ) const

Return time in seconds elapsed between tic and toc.

Returns
Time in seconds between calls of tic and toc

◆ tic()

void dg::Timer::tic ( )

Start timer.

uses omp_get_wtime() if available, else gettimeofday. If compiled with nvcc we place cudaEvent_t in the gpu stream. The mpi version places an MPI_Barrier(MPI_COMM_WORLD) and then uses MPI_Wtime. MPI + Cuda adds an additional cudaDeviceSynchronize

◆ toc()

void dg::Timer::toc ( )

Stop timer.

uses omp_get_wtime() if available, else gettimeofday. If compiled with nvcc we place cudaEvent_t in the gpu stream. The mpi version places an MPI_Barrier(MPI_COMM_WORLD) and then uses MPI_Wtime. MPI + Cuda adds an additional cudaDeviceSynchronize


The documentation for this struct was generated from the following file: