DOLFIN-X
DOLFIN-X C++ interface
dolfinx
common
Timer.h
1
// Copyright (C) 2008 Anders Logg, 2015 Jan Blechta
2
//
3
// This file is part of DOLFINX (https://www.fenicsproject.org)
4
//
5
// SPDX-License-Identifier: LGPL-3.0-or-later
6
7
#pragma once
8
9
#include <array>
10
#include <boost/timer/timer.hpp>
11
#include <string>
12
13
namespace
dolfinx::common
14
{
15
29
30
class
Timer
31
{
32
public
:
34
Timer
();
35
37
Timer
(
const
std::string& task);
38
40
~Timer
();
41
43
void
start
();
44
46
void
resume
();
47
50
double
stop
();
51
53
std::array<double, 3>
elapsed
()
const
;
54
55
private
:
56
// Name of task
57
std::string _task;
58
59
// Implementation of timer
60
boost::timer::cpu_timer _timer;
61
};
62
}
// namespace dolfinx::common
dolfinx::common::Timer::resume
void resume()
Resume timer. Not well-defined for logging timer.
Definition:
Timer.cpp:32
dolfinx::common::Timer::elapsed
std::array< double, 3 > elapsed() const
Return wall, user and system time in seconds.
Definition:
Timer.cpp:52
dolfinx::common::Timer::~Timer
~Timer()
Destructor.
Definition:
Timer.cpp:24
dolfinx::common::Timer::Timer
Timer()
Create timer without logging.
Definition:
Timer.cpp:14
dolfinx::common::Timer::start
void start()
Zero and start timer.
Definition:
Timer.cpp:30
dolfinx::common
Miscellaneous classes, functions and types.
dolfinx::common::Timer
A timer can be used for timing tasks. The basic usage is.
Definition:
Timer.h:30
dolfinx::common::Timer::stop
double stop()
Stop timer, return wall time elapsed and store timing data into logger.
Definition:
Timer.cpp:43
Generated by
1.8.17