1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | foam-extend: Open Source CFD
4 \\ / O peration | Version: 3.2
5 \\ / A nd | Web: http://www.foam-extend.org
6 \\/ M anipulation | For copyright notice see file Copyright
7 -------------------------------------------------------------------------------
9 This file is part of foam-extend.
11 foam-extend is free software: you can redistribute it and/or modify it
12 under the terms of the GNU General Public License as published by the
13 Free Software Foundation, either version 3 of the License, or (at your
14 option) any later version.
16 foam-extend is distributed in the hope that it will be useful, but
17 WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 General Public License for more details.
21 You should have received a copy of the GNU General Public License
22 along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
28 Information needed for profiling
33 \*---------------------------------------------------------------------------*/
35 #ifndef profilingInfo_H
36 #define profilingInfo_H
41 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46 // Forward declaration of classes
54 Ostream& operator<<(Ostream&, const profilingInfo&);
56 /*---------------------------------------------------------------------------*\
57 Class profilingInfo Declaration
58 \*---------------------------------------------------------------------------*/
64 // nr of times this was called
70 // time spent in children
73 // unique id to identify it
76 // pointer to the parent object (if there is any)
77 profilingInfo &parent_;
82 // is this currently on the stack?
85 // Private Member Functions
87 //- Disallow default bitwise copy construct
88 profilingInfo(const profilingInfo&);
90 //- Disallow default bitwise assignment
91 void operator=(const profilingInfo&);
93 // Static data members
95 //- Counter that is used to generate the ids
98 //- get a new ID and update the counter
101 //- raise the next possible ID (to avoid ID-clashes during reading)
102 void raiseID(label maxVal);
109 void removedFromStack()
112 //- Construct null - only the master-element
115 void writeWithOffset(Ostream &os,bool offset=false,scalar time=0,scalar childTime=0) const;
121 //- Construct from components
122 profilingInfo(profilingInfo &parent,const string &descr);
124 // //- Construct from Istream
125 // profilingInfo(Istream&);
142 scalar totalTime() const
143 { return totalTime_; }
145 scalar childTime() const
146 { return childTime_; }
151 const string &description() const
152 { return description_; }
154 const profilingInfo &parent() const
157 //- Update it with a new timing information
158 void update(scalar elapsedTime);
160 friend class profilingStack;
161 friend class profilingPool;
163 // IOstream Operators
165 // friend Istream& operator>>(Istream&, profilingInfo&);
166 friend Ostream& operator<<(Ostream&, const profilingInfo&);
170 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
172 } // End namespace Foam
174 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
178 // ************************************************************************* //