parProfiling.H
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) 2019-2023 OpenCFD Ltd.
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 Class
27  Foam::functionObjects::parProfiling
28 
29 Group
30  grpUtilitiesFunctionObjects
31 
32 Description
33  Simple (simplistic) mpi-profiling.
34 
35 Usage
36  Example of function object specification:
37  \verbatim
38  profiling
39  {
40  type parProfiling;
41  libs (utilityFunctionObjects);
42 
43  // Report stats on exit only (instead of every time step)
44  executeControl onEnd;
45  writeControl none;
46  detail 0;
47  }
48  \endverbatim
49 
50 SourceFiles
51  parProfiling.C
52 
53 \*---------------------------------------------------------------------------*/
54 
55 #ifndef Foam_functionObjects_parProfiling_H
56 #define Foam_functionObjects_parProfiling_H
57 
58 #include "functionObject.H"
59 
60 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
61 
62 namespace Foam
63 {
64 namespace functionObjects
65 {
66 
67 /*---------------------------------------------------------------------------*\
68  Class parProfiling Declaration
69 \*---------------------------------------------------------------------------*/
70 
71 class parProfiling
72 :
73  public functionObject
74 {
75  // Private Data
76 
77  //- The reporting level
78  // 0: summary, 1: per-proc times, 2: per-proc times/counts
79  int reportLevel_;
80 
81 public:
82 
83  // Generated Methods
84 
85  //- No copy construct
86  parProfiling(const parProfiling&) = delete;
87 
88  //- No copy assignment
89  void operator=(const parProfiling&) = delete;
90 
91 
92  //- Runtime type information
93  TypeName("parProfiling");
94 
95 
96  // Constructors
97 
98  //- Construct from Time and dictionary. Enables profilingPstream
100  (
101  const word& name,
102  const Time& runTime,
103  const dictionary& dict
104  );
105 
106 
107  //- Destructor. Disables profilingPstream
108  virtual ~parProfiling();
109 
110 
111  // Member Functions
112 
113  //- Report the current profiling information
114  void report();
115 
116  //- Report
117  virtual bool execute();
118 
119  //- Do nothing
120  virtual bool write();
121 
122  //- Disables profilingPstream
123  virtual bool end();
124 };
125 
126 
127 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
128 
129 } // End namespace functionObjects
130 } // End namespace Foam
131 
132 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
133 
134 #endif
135 
136 // ************************************************************************* //
virtual bool end()
Disables profilingPstream.
Definition: parProfiling.C:95
dictionary dict
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
TypeName("parProfiling")
Runtime type information.
engineTime & runTime
Abstract base-class for Time/database function objects.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:69
const word & name() const noexcept
Return the name of this functionObject.
virtual bool execute()
Report.
Definition: parProfiling.C:82
virtual ~parProfiling()
Destructor. Disables profilingPstream.
Definition: parProfiling.C:64
A class for handling words, derived from Foam::string.
Definition: word.H:63
Simple (simplistic) mpi-profiling.
Definition: parProfiling.H:66
parProfiling(const parProfiling &)=delete
No copy construct.
void operator=(const parProfiling &)=delete
No copy assignment.
void report()
Report the current profiling information.
Definition: parProfiling.C:72
Namespace for OpenFOAM.
virtual bool write()
Do nothing.
Definition: parProfiling.C:89