Go to the documentation of this file.
56 children_.resize(pool_.size());
57 children_.last().clear();
69 const label parentId = parent->
id();
73 if (descr == child->description())
82 children_.resize(pool_.size());
83 children_.last().clear();
84 children_[parentId].append(info);
114 return allowed && singleton_;
128 return singleton_->writeData(os);
139 return singleton_->regIOobject::write();
152 if (allowed && !singleton_)
154 singleton_ =
new profiling(ioObj, owner);
166 if (allowed && !singleton_)
175 if (singleton_ && &owner == &(singleton_->owner_))
178 singleton_ =
nullptr;
191 info = singleton_->create(parent, descr);
192 singleton_->beginTimer(info);
194 if (singleton_->memInfo_)
199 singleton_->memInfo_->update().size()
210 if (active() && info)
214 if (info->
id() != top->
id())
217 <<
"The profiling information to unstack has different"
218 <<
" id than on the top of the profiling stack" <<
nl
231 Foam::profiling::profiling
248 this->beginTimer(info);
254 Foam::profiling::profiling
274 dict.getOrDefault(
"cpuInfo", false)
279 dict.getOrDefault(
"memInfo", false)
284 this->beginTimer(info);
298 if (singleton_ ==
this)
300 singleton_ =
nullptr;
315 return stack_.size();
325 const label nstack = stack_.size();
329 for (label stacki=0; stacki < nstack; ++stacki)
331 elapsed[stacki] = (now - times_[stacki]);
338 for (label stacki=0; stacki < nstack; ++stacki)
340 if (stacki) os <<
nl;
342 stack_[stacki]->write
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
bitSet create(const label n, const labelHashSet &locations, const bool on=true)
Create a bitSet with length n with the specified on locations.
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
static constexpr const zero Zero
Global zero (0)
Template functions to aid in the implementation of demand driven data.
static int allowed
Flag if profiling is allowed.
Ostream & endl(Ostream &os)
Add newline and flush stream.
virtual Ostream & beginBlock(const keyType &kw)
Write begin block group with the given name.
Information * create(const zero)
Clear all profiling and restart with new profiling.
InfoProxy< IOobject > info() const
Return info proxy.
clockValue elapsed() const
The time duration elapsed until now() since the start point.
int infoSwitch(const char *name, const int deflt=0)
Lookup info switch or add default value.
void deleteDemandDrivenData(DataPtr &dataPtr)
static void stop(const Time &owner)
Stop profiling, cleanup pool if possible.
static bool active()
True if profiling is allowed and is active.
The IOstreamOption is a simple container for options an IOstream can normally have.
const Time & owner() const
The owner of the profiling.
Information * endTimer()
Remove from stack of active information and update elapsed time.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
General CPU characteristics.
General system information useful for profiling.
virtual Ostream & endBlock()
Write end block group.
Access to high-resolution clock value with some basic operations. Used to calculate time durations,...
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Memory usage information for the current process, and the system memory that is free.
virtual bool writeObject(IOstreamOption streamOpt, const bool valid) const
Write using stream options.
virtual bool write(const token &tok)=0
Write token to stream or otherwise handle it.
static void disable()
Disallow profiling by forcing the InfoSwitch off.
errorManip< error > abort(error &err)
static void unstack(const profilingInformation *info)
Remove the information from the top of the stack.
void beginTimer(Information *info)
Add to stack of active information and begin timer datum.
void resize(const label nElem)
Alter addressable list size.
static void initialize(const IOobject &ioObj, const Time &owner)
Singleton to initialize profiling pool, everything enabled.
virtual bool writeData(Ostream &os) const
writeData member function required by regIOobject
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
static profilingInformation * New(const string &descr)
Existing or new element on pool, add to stack.
label size() const noexcept
The size of the current stack.
static bool print(Ostream &os)
Print profiling information to specified output.
Ostream & writeEntry(const keyType &key, const T &value)
Write a keyword/value entry.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
bool good() const
Return true if next operation might succeed.
T getOrDefault(const word &keyword, const T &deflt, enum keyType::option matchOpt=keyType::REGEX) const
profilingInformation Information
static clockValue now()
The current clock value from the system.
virtual bool writeObject(IOstreamOption, const bool valid) const
Write as uncompressed ASCII.
A class representing the concept of 0 (zero) that can be used to avoid manipulating objects known to ...
static bool writeNow()
Write profiling information now.