redesign profiler

This commit is contained in:
Vladimir Mandic
2023-12-03 11:27:24 -05:00
parent 54ef5f8683
commit 439542d3df
22 changed files with 172 additions and 109 deletions
+1 -7
View File
@@ -2,9 +2,6 @@ import html
import threading
import time
import cProfile
import pstats
import io
from rich import print # pylint: disable=redefined-builtin
from modules import shared, progress, errors
queue_lock = threading.Lock()
@@ -62,10 +59,7 @@ def wrap_gradio_call(func, extra_outputs=None, add_stats=False, name=None):
else:
res = list(res)
if shared.cmd_opts.profile:
pr.disable()
s = io.StringIO()
pstats.Stats(pr, stream=s).sort_stats(pstats.SortKey.CUMULATIVE).print_stats(15)
print('Profile Exec:', s.getvalue())
errors.profile(pr, 'Wrap')
except Exception as e:
errors.display(e, 'gradio call')
if extra_outputs_array is None: