profilingTrigger.C
Go to the documentation of this file.
1/*---------------------------------------------------------------------------*\
2 ========= |
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4 \\ / O peration |
5 \\ / A nd | www.openfoam.com
6 \\/ M anipulation |
7-------------------------------------------------------------------------------
8 Copyright (C) 2009-2016 Bernhard Gschaider
9 Copyright (C) 2016-2018 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
12 This file is part of OpenFOAM.
13
14 OpenFOAM is free software: you can redistribute it and/or modify it
15 under the terms of the GNU General Public License as published by
16 the Free Software Foundation, either version 3 of the License, or
17 (at your option) any later version.
18
19 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 for more details.
23
24 You should have received a copy of the GNU General Public License
25 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26
27\*---------------------------------------------------------------------------*/
28
29#include "profiling.H"
30#include "profilingTrigger.H"
32
33// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
34
36:
37 ptr_(nullptr)
38{}
39
40
42:
43 ptr_(profiling::New(name))
44{}
45
46
48:
49 ptr_(profiling::New(name))
50{}
51
52
53// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
54
56{
57 stop();
58}
59
60
61// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
62
64{
65 return ptr_;
66}
67
68
70{
71 if (ptr_)
72 {
73 // profiling info pointer managed by pool storage, so no delete here
75 }
76
77 ptr_ = nullptr;
78}
79
80
81// ************************************************************************* //
void stop()
Stop triggered profiling.
bool running() const
True if the triggered profiling is active.
~profilingTrigger()
Destructor.
profilingTrigger()
Default construct, no profiling trigger.
Code profiling.
Definition: profiling.H:85
static void unstack(const profilingInformation *info)
Remove the information from the top of the stack.
Definition: profiling.C:206
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh > > &tdf1, const word &name, const dimensionSet &dimensions)
Global function forwards to reuseTmpDimensionedField::New.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
Definition: exprTraits.C:59