Adding some comments to profiling-stuff

--HG--
branch : bgschaid/minorAdditionsBranch
This commit is contained in:
Bernhard F.W. Gschaider 2013-08-20 00:30:38 +02:00
parent 4aaa1d47e6
commit 1ef994d85c
2 changed files with 22 additions and 6 deletions

View file

@ -1,4 +1,7 @@
#! /usr/bin/python
#! /usr/bin/env python
# Lists the profiling information in time directories (uniform/profilingInfo)
# in a human readable form
from PyFoam.RunDictionary.ParsedParameterFile import ParsedParameterFile
import sys
@ -14,6 +17,11 @@ for p in pf["profilingInfo"]:
if p["id"] in data:
print "Duplicate definition of",p["id"]
sys.exit(-1)
if p["description"][0]=='"':
p["description"]=p["description"][1:]
if p["description"][-1]=='"':
p["description"]=p["description"][:-1]
data[p["id"]]=p
if "parentId" in p:
if p["parentId"] in children:
@ -46,7 +54,7 @@ def nameLen(i,d=0):
maxi=len(data[i]["description"])
if i in children:
maxi=max(maxi,max([nameLen(j,d+1) for j in children[i]]))
return maxi+2
return maxi+3
maxLen=nameLen(root)

View file

@ -27,6 +27,9 @@ Class
Description
Add everything necessary for Profiling plus a macro
Originally proposed in
http://www.cfd-online.com/Forums/openfoam-bugs/64081-feature-proposal-application-level-profiling.html
SourceFiles
\*---------------------------------------------------------------------------*/
@ -36,9 +39,14 @@ SourceFiles
#include "ProfilingTrigger.H"
// to be used at the beginning of a section to be profiled
// profiling ends automatically at the end of a block
#define addProfile(name) Foam::ProfilingTrigger profileTriggerFor##name (#name)
// Use this if a description with spaces, colons etc should be added
#define addProfile2(name,descr) Foam::ProfilingTrigger profileTriggerFor##name (descr)
// this is only needed if profiling should end before the end of a block
#define endProfile(name) profileTriggerFor##name.stop()
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //