Skip to content

Commit 556ef7f

Browse files
authored
[Misc] Log time consumption of sleep and wake-up (#13115)
Signed-off-by: Jun Duan <[email protected]>
1 parent 83481ce commit 556ef7f

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

vllm/executor/executor_base.py

+9
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# SPDX-License-Identifier: Apache-2.0
22

33
import asyncio
4+
import time
45
from abc import ABC, abstractmethod
56
from typing import (Any, Awaitable, Callable, Dict, List, Optional, Set, Tuple,
67
Union)
@@ -200,15 +201,23 @@ def sleep(self, level: int = 1):
200201
if self.is_sleeping:
201202
logger.warning("Executor is already sleeping.")
202203
return
204+
time_before_sleep = time.perf_counter()
203205
self.collective_rpc("sleep", kwargs=dict(level=level))
206+
time_after_sleep = time.perf_counter()
204207
self.is_sleeping = True
208+
logger.info("It took %.6f seconds to fall asleep.",
209+
time_after_sleep - time_before_sleep)
205210

206211
def wake_up(self):
207212
if not self.is_sleeping:
208213
logger.warning("Executor is not sleeping.")
209214
return
215+
time_before_wakeup = time.perf_counter()
210216
self.collective_rpc("wake_up")
217+
time_after_wakeup = time.perf_counter()
211218
self.is_sleeping = False
219+
logger.info("It took %.6f seconds to wake up.",
220+
time_after_wakeup - time_before_wakeup)
212221

213222
def save_sharded_state(
214223
self,

0 commit comments

Comments
 (0)