Skip to content

Commit 2fc4db0

Browse files
committed
Add a bit perf more logging
1 parent 851178f commit 2fc4db0

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

mypy/build.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1173,13 +1173,15 @@ def stats_summary(self) -> Mapping[str, object]:
11731173

11741174
def broadcast(self, message: bytes) -> None:
11751175
"""Broadcast same message to all workers in parallel."""
1176+
t0 = time.time()
11761177
threads = []
11771178
for worker in self.workers:
11781179
thread = Thread(target=worker.conn.write_bytes, args=(message,))
11791180
thread.start()
11801181
threads.append(thread)
11811182
for thread in threads:
11821183
thread.join()
1184+
self.add_stats(broadcast_time=time.time() - t0)
11831185

11841186
def wait_ack(self) -> None:
11851187
"""Wait for an ack from all workers."""
@@ -1207,6 +1209,7 @@ def submit_to_workers(self, graph: Graph, sccs: list[SCC] | None = None) -> None
12071209
for mod_id in scc.mod_ids
12081210
if (path := graph[mod_id].xpath) in self.errors.recorded
12091211
}
1212+
t0 = time.time()
12101213
send(
12111214
self.workers[idx].conn,
12121215
SccRequestMessage(
@@ -1224,6 +1227,7 @@ def submit_to_workers(self, graph: Graph, sccs: list[SCC] | None = None) -> None
12241227
},
12251228
),
12261229
)
1230+
self.add_stats(scc_send_time=time.time() - t0)
12271231

12281232
def wait_for_done(
12291233
self, graph: Graph

mypy/build_worker/worker.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,9 @@ def serve(server: IPCServer, ctx: ServerContext) -> None:
197197
except CompileError as blocker:
198198
send(server, SccResponseMessage(scc_id=scc_id, blocker=blocker))
199199
else:
200+
t1 = time.time()
200201
send(server, SccResponseMessage(scc_id=scc_id, result=result))
202+
manager.add_stats(scc_send_time=time.time() - t1)
201203
manager.add_stats(total_process_stale_time=time.time() - t0, stale_sccs_processed=1)
202204

203205

0 commit comments

Comments
 (0)