MCPcopy Create free account
hub / github.com/Project-OSRM/osrm-backend / report

Function report

scripts/routed_benchmark.py:159–229  ·  view source on GitHub ↗
(args)

Source from the content-addressed store, hash-verified

157
158
159def report(args):
160 rows = list()
161 index = list()
162
163 current_run = None
164 current_log = None
165
166 for logfile in args.logfiles:
167 with open(logfile) as log:
168 for line in log:
169 if m := re.search(
170 r"^### (\d+) \"(.*?)\" \"(.*?)\"$", line
171 ): # run build log
172 current_run = int(m.group(1))
173 current_log = m.group(3)
174 continue
175
176 if m := re.search(r"(/route/v1/.*$)", line):
177 current_url = m.group(1)
178 index.append([current_run, current_log, current_url])
179 if m := re.search(r"([.\d]+)ms", line):
180 current_time = float(m.group(1))
181 line = log.readline()
182 if m := re.search(r"Distance: ([.\d]+)", line):
183 current_distance = float(m.group(1))
184 rows.append(
185 {
186 "time": current_time,
187 "distance": current_distance,
188 }
189 )
190
191 df = pd.DataFrame(
192 rows, index=pd.MultiIndex.from_tuples(index, names=("run", "log", "url"))
193 )
194
195 # pd.set_option('display.max_rows', 500)
196 # pd.set_option('display.max_columns', 500)
197 # pd.set_option("display.width", 1000)
198
199 print(f"## RAW data - {datetime.datetime.now().isoformat()}\n```")
200 print(df)
201 print("```")
202
203 def norm(series):
204 return series / series.iloc[0]
205
206 check = df.distance.groupby(["url"], sort=False).agg(["std"])
207 print(check[check["std"] > 0])
208
209 groupby = ["log"]
210
211 agg = df.time.groupby(groupby, sort=False).agg(["median"])
212 agg.insert(1, "time_norm", norm(agg["median"]), allow_duplicates=True)
213
214 agg2 = df.distance.groupby(groupby, sort=False).agg(["median"])
215 agg2.insert(1, "dist_norm", norm(agg2["median"]), allow_duplicates=True)
216

Callers 1

runFunction · 0.70

Calls 4

intFunction · 0.85
insertMethod · 0.80
normFunction · 0.70
appendMethod · 0.45

Tested by

no test coverage detected