Loading...
Searching...
No Matches
parProfiling.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) 2019-2023 OpenCFD Ltd.
9-------------------------------------------------------------------------------
10License
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\*---------------------------------------------------------------------------*/
27
28#include "parProfiling.H"
29#include "profilingPstream.H"
30#include "Pstream.H"
33// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
35namespace Foam
36{
37namespace functionObjects
38{
40
42 (
46 );
48} // End namespace functionObject
49} // End namespace Foam
50
51
52// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
53
55(
56 const word& name,
57 const Time& runTime,
58 const dictionary& dict
59)
60:
62 reportLevel_(0)
63{
64 dict.readIfPresent("detail", reportLevel_);
66}
67
68
69// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
70
74}
75
76
77// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
78
80{
82 {
83 Info<< nl;
84 profilingPstream::report(reportLevel_);
85 }
86}
87
88
93}
94
97{
98 return true;
99}
100
101
103{
105 return true;
106}
107
108
109// ************************************************************************* //
Macros for easy insertion into run-time selection tables.
#define addToRunTimeSelectionTable(baseType, thisType, argNames)
Add to construction table with typeName as the key.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition Time.H:75
static bool parRun(const bool on) noexcept
Set as parallel run on/off.
Definition UPstream.H:1669
static label nProcs(const label communicator=worldComm)
Number of ranks in parallel run (for given communicator). It is 1 for serial run.
Definition UPstream.H:1697
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition dictionary.H:133
Abstract base-class for Time/database function objects.
const word & name() const noexcept
Return the name of this functionObject.
functionObject(const word &name, const bool withNamePrefix=defaultUseNamePrefix)
Construct from components.
Simple (simplistic) mpi-profiling.
virtual ~parProfiling()
Destructor. Disables profilingPstream.
parProfiling(const parProfiling &)=delete
No copy construct.
virtual bool execute()
Execute the function-object operations.
void report()
Report the current profiling information.
virtual bool write()
Write the function-object results (no-op).
virtual bool end()
Disables profilingPstream.
static void disable() noexcept
Remove timer for measuring communication activity. Does not affect times/counts.
static void enable()
Create timer for measuring communication or un-suspend existing.
static void report(const int reportLevel=0)
Report current information. Uses parallel communication!
A class for handling words, derived from Foam::string.
Definition word.H:66
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
Definition className.H:142
engineTime & runTime
Function objects are OpenFOAM utilities to ease workflow configurations and enhance workflows.
Namespace for OpenFOAM.
messageStream Info
Information stream (stdout output on master, null elsewhere).
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
Definition exprTraits.C:127
constexpr char nl
The newline '\n' character (0x0a).
Definition Ostream.H:50
dictionary dict