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()>=(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,doTimelines=True,doFiles=True):
46
48 self.time=float(match.group(1))
49 if self.hasClock:
50 self.clock=float(match.group(2))
51
53 self.lastTime = self.time
54 if self.first:
55 self.firstTime=self.time
56
57 if self.hasClock:
58 self.lastClock = self.clock
59 if self.first:
60 self.firstClock=self.clock
61
62 self.first=False
63
65 self.files.write("executionTime",self.parent.getTime(),(self.time,self.time-self.lastTime))
66
67 if self.hasClock:
68 self.files.write("wallClockTime",self.parent.getTime(),(self.clock,self.clock-self.lastClock))
69
75
77 """Returns the Wall-Clock-Time of the first timestep"""
78 if self.hasClock:
79 return self.firstClock
80 else:
81 return None
82
84 """Returns the total Wall-Clock-Time"""
85 if self.hasClock:
86 return self.clock
87 else:
88 return None
89
91 """Returns the CPU-Time of the first timestep"""
92 return self.firstTime
93
95 """Returns the total CPU-Time"""
96 return self.time
97
98
100 """Parses lines for the execution time"""
101
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
120 """Parses lines for the execution time"""
121
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148