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." 113 <<
"No processor* directories found" 122 databases[0].times(),
126 if (timeDirs.
empty())
129 <<
"No times selected" <<
nl <<
endl;
161 profiles[proci].clear();
162 databases[proci].setTime(timeDirs[timei], timei);
167 databases[proci].time(),
172 const IOobject* ioptr = objects.findObject(profilingFileName);
178 profiles[proci] =
dict;
197 Info<<
"found " << nDict <<
"/" << nProcs
198 <<
" profiling files" <<
nl <<
endl;
221 "summarized (max avg min) values from " 232 const entry& mainEntry = mainIter();
239 !processing.found(level1Name)
241 || mainEntry.
dict().empty()
247 const wordList& tags = processing[level1Name];
264 const bool hasDictEntries
274 level2Names = {level1Name};
281 for (
const word& level2Name : level2Names)
285 for (
const word& tag : tags)
296 if (inDictPtr && hasDictEntries)
299 inDictPtr = inDictPtr->
findDict(level2Name);
309 for (
const word& tag : tags)
318 stats(tag).append(val);
323 if (nEntry != nProcs)
333 outputDict.
add(level2Name, level1Dict.
subDict(level2Name));
334 outDictPtr = outputDict.
findDict(level2Name);
339 summary.
add(level1Name, level1Dict,
true);
340 outDictPtr = &outputDict;
361 for (
const word& tag : tags)
365 if (lst.
size() == nProcs)
368 const scalar avg =
sum(lst) / nProcs;
389 mkDir(summary.path());
393 summary.writeHeader(
os);
394 summary.writeData(
os);
static void noFunctionObjects(bool addWithOption=false)
Remove '-noFunctionObjects' option and ignore any occurrences.
static void addNote(const string ¬e)
Add extra notes for the usage information.
void size(const label n)
Older name for setAddressableSize.
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh > &f1)
fileName path() const
Return path = rootPath/caseName. Same as TimePaths::path()
A class for handling file names.
List of IOobjects with searching and retrieving facilities. Implemented as a HashTable, so the various sorted methods should be used if traversing in parallel.
errorManipArg< error, int > exit(error &err, const int errNo=1)
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
A list of keyword definitions, which are a keyword followed by a number of values (eg...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Output to file stream, using an OSstream.
constexpr char nl
The newline '\n' character (0x0a)
bool empty() const noexcept
True if List is empty (ie, size() is zero)
T & first()
Access first element of the list, position [0].
Ostream & endl(Ostream &os)
Add newline and flush stream.
virtual const dictionary & dict() const =0
Return dictionary, if entry is a dictionary.
static void noParallel()
Remove the parallel options.
refPtr< fileOperation > fileHandler(std::nullptr_t)
Delete current file handler - forwards to fileOperation::handler()
entry * add(entry *entryPtr, bool mergeEntry=false)
Add a new entry.
Ignore writing from objectRegistry::writeObject()
const dictionary & subDict(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a sub-dictionary.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
instantList select(const instantList ×) const
Select a list of Time values that are within the ranges.
bool allowFunctionObjects() const
The controlDict 'functions' entry is allowed to be used.
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
#define forAll(list, i)
Loop across all elements in list.
Functions used by OpenFOAM that are specific to POSIX compliant operating systems and need to be repl...
bool allowLibs() const
The controlDict 'libs' entry is allowed to be used. (eg, has not been disabled by the -no-libs option...
word outputName("finiteArea-edges.obj")
const keyType & keyword() const noexcept
Return keyword.
bool mkDir(const fileName &pathName, mode_t mode=0777)
Make a directory and return an error if it could not be created.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
A class for handling words, derived from Foam::string.
void sort(UList< T > &list)
Sort the list.
void clear()
Remove all entries from table.
virtual void setTime(const Time &t)
Reset the time and time-index to those of the given time.
static word controlDictName
The default control dictionary name (normally "controlDict")
const fileName & caseName() const noexcept
Return case name (parallel run) or global case (serial run)
static Ostream & writeEndDivider(Ostream &os)
Write the standard end file divider.
static word timeName(const scalar t, const int precision=precision_)
Return a time name for the given scalar time value formatted with the given precision.
bool readIfPresent(const word &keyword, T &val, enum keyType::option matchOpt=keyType::REGEX) const
Find an entry if present, and assign to T val. FatalIOError if it is found and the number of tokens i...
const fileName & rootPath() const noexcept
Return root path.
OBJstream os(runTime.globalPath()/outputName)
T & last()
Access last element of the list, position [size()-1].
Encapsulation of natural order sorting for algorithms.
fileName path() const
Return the full path to the (processor local) case.
#define WarningInFunction
Report a warning using Foam::Warning.
auto key(const Type &t) -> typename std::enable_if< std::is_enum< Type >::value, typename std::underlying_type< Type >::type >::type
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers...
void reserve(label numEntries)
Reserve space for at least the specified number of elements (not the number of buckets) and regenerat...
static word outputPrefix
Directory prefix.
messageStream Info
Information stream (stdout output on master, null elsewhere)
virtual bool isDict() const noexcept
Return true if this entry is a dictionary.
entry * set(entry *entryPtr)
Assign a new entry, overwriting any existing entry.
T * first()
The first entry in the list.
Foam::argList args(argc, argv)
Defines the attributes of an object for which implicit objectRegistry management is supported...
Do not request registration (bool: false)
bool removeEnd(const std::string &text)
Remove the given text from the end of the string.
wordList sortedToc() const
Return the sorted table of contents.
static void addOptions(const bool constant=true, const bool withZero=false)
Add timeSelector options to argList::validOptions.
forAllConstIters(mixture.phases(), phase)
A keyword and a list of tokens is an 'entry'.
const dictionary * findDict(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a sub-dictionary pointer if present (and a sub-dictionary) otherwise return nullptr...