Go to the documentation of this file.
54 static const word profilingFileName(
"profiling");
57 static const word blockNameProfiling(
"profiling");
63 {
"profiling", {
"calls",
"totalTime",
"childTime",
"maxMem" } },
64 {
"memInfo", {
"size",
"free" } },
70 int main(
int argc,
char *argv[])
74 "Collect profiling information from processor directories and"
75 " summarize time spent and number of calls as (max avg min) values."
111 <<
"No processor* directories found"
120 databases[0].times(),
124 if (timeDirs.empty())
127 <<
"No times selected" <<
nl <<
endl;
159 profiles[proci].clear();
160 databases[proci].setTime(timeDirs[timei], timei);
165 databases[proci].time(),
170 const IOobject* ioptr = objects.findObject(profilingFileName);
176 profiles[proci] =
dict;
195 Info<<
"found " << nDict <<
"/" << nProcs
196 <<
" profiling files" <<
nl <<
endl;
219 "summarized (max avg min) values from "
230 const entry& mainEntry = mainIter();
237 !processing.found(level1Name)
239 || mainEntry.
dict().empty()
245 const wordList& tags = processing[level1Name];
262 const bool hasDictEntries
272 level2Names = {level1Name};
279 for (
const word& level2Name : level2Names)
283 for (
const word& tag : tags)
285 stats(tag).reserve(nProcs);
294 if (inDictPtr && hasDictEntries)
297 inDictPtr = inDictPtr->
findDict(level2Name);
307 for (
const word& tag : tags)
316 stats(tag).append(val);
321 if (nEntry != nProcs)
331 outputDict.
add(level2Name, level1Dict.
subDict(level2Name));
332 outDictPtr = outputDict.
findDict(level2Name);
337 summary.
add(level1Name, level1Dict,
true);
338 outDictPtr = &outputDict;
359 for (
const word& tag : tags)
363 if (lst.size() == nProcs)
366 const scalar avg =
sum(lst) / nProcs;
368 if (lst.first() != lst.last())
375 lst.last(), avg, lst.first()
387 mkDir(summary.path());
391 summary.writeHeader(
os);
392 summary.writeData(
os);
393 summary.writeEndDivider(
os);
A keyword and a list of tokens is an 'entry'.
dictionary * findDict(const word &keyword, enum keyType::option matchOpt=keyType::REGEX)
Find and return a sub-dictionary pointer if present.
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,...
Functions used by OpenFOAM that are specific to POSIX compliant operating systems and need to be repl...
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
A class for handling words, derived from Foam::string.
A class for handling file names.
const fileName & caseName() const noexcept
Return case name (parallel run) or global case (serial run)
virtual bool isDict() const noexcept
Return true if this entry is a dictionary.
static word timeName(const scalar t, const int precision=precision_)
auto key(const Type &t) -> typename std::enable_if< std::is_enum< Type >::value, typename std::underlying_type< Type >::type >::type
static void addNote(const string ¬e)
Add extra notes for the usage information.
instantList select(const instantList ×) const
Select a list of Time values that are within the ranges.
const keyType & keyword() const noexcept
Return keyword.
const fileOperation & fileHandler()
Get current file handler.
Ostream & endl(Ostream &os)
Add newline and flush stream.
entry * set(entry *entryPtr)
Assign a new entry, overwriting any existing entry.
static word controlDictName
The default control dictionary name (normally "controlDict")
#define forAll(list, i)
Loop across all elements in list.
word outputName("finiteArea-edges.obj")
static void noFunctionObjects(bool addWithOption=false)
Remove '-noFunctionObjects' option and ignore any occurrences.
messageStream Info
Information stream (stdout output on master, null elsewhere)
virtual label nProcs(const fileName &dir, const fileName &local="") const
Get number of processor directories/results. Used for e.g.
const dictionary & subDict(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a sub-dictionary.
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers....
static word outputPrefix
Directory prefix.
fileName path() const
Return the full path to the (processor local) case.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
OBJstream os(runTime.globalPath()/outputName)
virtual const dictionary & dict() const =0
Return dictionary, if entry is a dictionary.
List of IOobjects with searching and retrieving facilities.
errorManipArg< error, int > exit(error &err, const int errNo=1)
Output to file stream, using an OSstream.
bool isDict(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Check if entry is found and is a sub-dictionary.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
fileName path() const
Return path.
forAllConstIters(mixture.phases(), phase)
void clear()
Clear all entries from table.
static void addOptions(const bool constant=true, const bool withZero=false)
Add timeSelector options to argList::validOptions.
virtual void setTime(const Time &t)
Reset the time and time-index to those of the given time.
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh > &df)
Encapsulation of natural order sorting for algorithms.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
entry * add(entry *entryPtr, bool mergeEntry=false)
Add a new entry.
static void noParallel()
Remove the parallel options.
Foam::argList args(argc, argv)
bool mkDir(const fileName &pathName, mode_t mode=0777)
Make a directory and return an error if it could not be created.
wordList sortedToc() const
Return the sorted table of contents.
#define WarningInFunction
Report a warning using Foam::Warning.
bool removeEnd(const std::string &text)
Remove the given text from the end of the string.
const fileName & rootPath() const noexcept
Return root path.
bool readIfPresent(const word &keyword, T &val, enum keyType::option matchOpt=keyType::REGEX) const