39std::unique_ptr<Foam::profiling> Foam::profiling::singleton_(
nullptr);
55 children_.resize(pool_.size());
56 children_.last().clear();
68 const label parentId = parent->
id();
72 if (descr == child->description())
81 children_.resize(pool_.size());
82 children_.last().clear();
83 children_[parentId].append(info);
113 return allowed && singleton_;
127 return singleton_->writeData(
os);
138 return singleton_->regIOobject::write();
151 if (allowed && !singleton_)
153 singleton_.reset(
new profiling(ioObj, owner));
165 if (allowed && !singleton_)
174 if (singleton_ && &owner == &(singleton_->owner_))
176 singleton_.reset(
nullptr);
189 info = singleton_->create(parent, descr);
190 singleton_->beginTimer(info);
192 if (singleton_->memInfo_)
197 singleton_->memInfo_->update().size()
208 if (active() && info)
212 if (info->
id() != top->
id())
215 <<
"Profiling information to unstack has different id than"
216 <<
" the top of the profiling stack" <<
nl
233 const bool allEnabled
288 if (
this == singleton_.get())
290 singleton_.reset(
nullptr);
305 return stack_.size();
315 const label nstack = stack_.size();
319 for (label stacki=0; stacki < nstack; ++stacki)
321 elapsed[stacki] = (now - times_[stacki]);
328 for (label stacki=0; stacki < nstack; ++stacki)
330 if (stacki)
os <<
nl;
332 stack_[stacki]->write
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
void resize(const label len)
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
Defines the attributes of an object for which implicit objectRegistry management is supported,...
InfoProxy< IOobject > info() const
Return info proxy, for printing information to a stream.
The IOstreamOption is a simple container for options an IOstream can normally have.
bool good() const noexcept
True if next operation might succeed.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
virtual Ostream & endBlock()
Write end block group.
Ostream & writeEntry(const keyType &key, const T &value)
Write a keyword/value entry.
virtual Ostream & beginBlock(const keyType &kw)
Write begin block group with the given name.
virtual bool write(const token &tok)=0
Write token to stream or otherwise handle it.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
static autoPtr< Time > New()
Construct (dummy) Time - no functionObjects or libraries.
T & last()
Return the last element of the list.
Access to high-resolution clock value with some basic operations. Used to calculate time durations,...
static clockValue now()
The current clock value from the system.
clockValue elapsed() const
The time duration elapsed until now() since the start point.
General CPU characteristics.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
T getOrDefault(const word &keyword, const T &deflt, enum keyType::option matchOpt=keyType::REGEX) const
void stop()
Stop parsing, freeing the allocated parser.
Memory usage information for the current process, and the system memory that is free.
scalar print()
Print to screen.
General system information useful for profiling.
static bool active()
True if profiling is allowed and is active.
Information * endTimer()
Remove from stack of active information and update elapsed time.
virtual bool writeObject(IOstreamOption, const bool valid) const
Write as uncompressed ASCII.
profilingInformation Information
static bool writeNow()
Write profiling information now.
virtual bool writeData(Ostream &os) const
writeData member function required by regIOobject
const Time & owner() const
The owner of the profiling.
static void unstack(const profilingInformation *info)
Remove the information from the top of the stack.
static int allowed
Flag if profiling is allowed.
Information * create()
Clear all profiling and restart with new profiling.
static void disable()
Disallow profiling by forcing the InfoSwitch off.
label size() const noexcept
The size of the current stack.
void beginTimer(Information *info)
Add to stack of active information and begin timer datum.
~profiling()
Destructor. Top-level clears the singleton.
static void initialize(const IOobject &ioObj, const Time &owner)
Singleton to initialize profiling pool, everything enabled.
virtual bool writeObject(IOstreamOption streamOpt, const bool valid) const
Write using stream options.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
OBJstream os(runTime.globalPath()/outputName)
IOobject io("surfaceFilmProperties", mesh.time().constant(), mesh, IOobject::READ_IF_PRESENT, IOobject::NO_WRITE, false)
int infoSwitch(const char *name, const int deflt=0)
Lookup info switch or add default value.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
Ostream & endl(Ostream &os)
Add newline and flush stream.
errorManip< error > abort(error &err)
constexpr char nl
The newline '\n' character (0x0a)