Note: this is documentation for an old release. View the latest documentation at
docs.fenicsproject.org/v0.1.0/v0.9.0/cpp
DOLFINx
0.1.0
DOLFINx 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:33
dolfinx::common::Timer::elapsed
std::array< double, 3 > elapsed() const
Return wall, user and system time in seconds.
Definition:
Timer.cpp:53
dolfinx::common::Timer::~Timer
~Timer()
Destructor.
Definition:
Timer.cpp:25
dolfinx::common::Timer::Timer
Timer()
Create timer without logging.
Definition:
Timer.cpp:15
dolfinx::common::Timer::start
void start()
Zero and start timer.
Definition:
Timer.cpp:31
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:44
Generated by
1.8.17