1
2 """Check for Execution-Time information"""
3
4 import re
5
7 """@Return: The regular expression that parses the execution time
8 depending on the OpenFOAM-Version"""
9
10 if foamVersionNumber(useConfigurationIfNoInstallation=True)>=(1,3):
11 return "^ExecutionTime = (.+) s ClockTime = (.+) s$"
12 else:
13 return "^ExecutionTime = (.+) s$"
14
15
16
17
18 from GeneralLineAnalyzer import GeneralLineAnalyzer
19
20 from PyFoam.FoamInformation import foamVersionNumber
21
23 """Parses lines for the execution time"""
24
25 - def __init__(self,
26 doTimelines=True,
27 doFiles=True,
28 singleFile=False,
29 startTime=None,
30 endTime=None):
58
60 self.time=float(match.group(1))
61 if self.hasClock:
62 self.clock=float(match.group(2))
63
65 self.lastTime = self.time
66 if self.first:
67 self.firstTime=self.time
68
69 if self.hasClock:
70 self.lastClock = self.clock
71 if self.first:
72 self.firstClock=self.clock
73
74 self.first=False
75
77 self.files.write("executionTime",self.parent.getTime(),(self.time,self.time-self.lastTime))
78
79 if self.hasClock:
80 self.files.write("wallClockTime",self.parent.getTime(),(self.clock,self.clock-self.lastClock))
81
87
89 """Returns the Wall-Clock-Time of the first timestep"""
90 if self.hasClock:
91 return self.firstClock
92 else:
93 return None
94
96 """Returns the total Wall-Clock-Time"""
97 if self.hasClock:
98 return self.clock
99 else:
100 return None
101
103 """Returns the CPU-Time of the first timestep"""
104 return self.firstTime
105
107 """Returns the total CPU-Time"""
108 return self.time
109
110
112 """Parses lines for the execution time"""
113
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
132 """Parses lines for the execution time"""
133
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160