Print prompt execution time.

This commit is contained in:
comfyanonymous 2023-05-14 01:34:25 -04:00
parent e7b9d2c02c
commit 9bf67c4c5a
1 changed files with 3 additions and 0 deletions

View File

@ -6,6 +6,7 @@ import threading
import heapq import heapq
import traceback import traceback
import gc import gc
import time
import torch import torch
import nodes import nodes
@ -215,6 +216,7 @@ class PromptExecutor:
else: else:
self.server.client_id = None self.server.client_id = None
execution_start_time = time.perf_counter()
if self.server.client_id is not None: if self.server.client_id is not None:
self.server.send_sync("execution_start", { "prompt_id": prompt_id}, self.server.client_id) self.server.send_sync("execution_start", { "prompt_id": prompt_id}, self.server.client_id)
@ -272,6 +274,7 @@ class PromptExecutor:
if self.server.client_id is not None: if self.server.client_id is not None:
self.server.send_sync("executing", { "node": None, "prompt_id": prompt_id }, self.server.client_id) self.server.send_sync("executing", { "node": None, "prompt_id": prompt_id }, self.server.client_id)
print("Prompt executed in {:.2f} seconds".format(time.perf_counter() - execution_start_time))
gc.collect() gc.collect()
comfy.model_management.soft_empty_cache() comfy.model_management.soft_empty_cache()