cleanup performance tags

Signed-off-by: Vladimir Mandic <mandic00@live.com>
This commit is contained in:
Vladimir Mandic
2026-07-02 19:14:04 +02:00
parent 51a0eaaa21
commit 17c8fe91e2
7 changed files with 21 additions and 15 deletions
+2
View File
@@ -49,6 +49,8 @@ class Timer:
additions = [x for x in self.records.items() if x[1] >= min_time]
if max_time > 0:
additions = [x for x in additions if x[1] <= max_time]
if not total:
additions = [x for x in additions if x[0] != 'total']
additions = sorted(additions, key=lambda x: x[1], reverse=True)
if not additions:
return res
+1 -1
View File
@@ -342,7 +342,7 @@ def create_output_panel(tabname, preview=True, prompt=None, height=None, transfe
html_info = gr.HTML(elem_id=f'html_info_{tabname}', elem_classes="infotext", visible=False) # contains raw infotext as returned by wrapped call
html_info_formatted = gr.HTML(elem_id=f'html_info_formatted_{tabname}', elem_classes="infotext", visible=True) # contains html formatted infotext
html_info.change(fn=infotext_to_html, inputs=[html_info], outputs=[html_info_formatted], show_progress='hidden')
html_log = gr.HTML(elem_id=f'html_log_{tabname}')
html_log = gr.HTML(elem_id=f'html_log_{tabname}', elem_classes=["hint"])
generation_info = gr.Textbox(visible=False, elem_id=f'generation_info_{tabname}')
generation_info_button = gr.Button(visible=False, elem_id=f"{tabname}_generation_info_button")
+5 -5
View File
@@ -26,7 +26,7 @@ def return_stats(t: float | None = None):
elapsed = time.perf_counter() - t
elapsed_m = int(elapsed // 60)
elapsed_s = elapsed % 60
elapsed_text = f"Time: {elapsed_m}m {elapsed_s:.2f}s |" if elapsed_m > 0 else f"Time: {elapsed_s:.2f}s |"
elapsed_text = f" {elapsed_m}m {elapsed_s:.2f}s |" if elapsed_m > 0 else f" {elapsed_s:.2f}s |"
summary = timer.process.summary(total=False).replace('=', ' ')
gpu = ''
cpu = ''
@@ -34,18 +34,18 @@ def return_stats(t: float | None = None):
mem_mon_read = shared.mem_mon.read()
ooms = mem_mon_read.pop("oom")
retries = mem_mon_read.pop("retries")
vram = {k: v//1048576 for k, v in mem_mon_read.items()}
vram = {k: v // 1048576 for k, v in mem_mon_read.items()}
peak = max(vram['active_peak'], vram['reserved_peak'], vram['used'])
used = round(100.0 * peak / vram['total']) if vram['total'] > 0 else 0
if peak > 0:
gpu += f"| GPU {peak} MB"
gpu += f"| 🕮 GPU {peak} MB"
gpu += f" {used}%" if used > 0 else ''
gpu += f" | retries {retries} oom {ooms}" if retries > 0 or ooms > 0 else ''
ram = ram_stats()
if ram['used'] > 0:
cpu += f"| RAM {ram['used']} GB"
cpu += f" RAM {ram['used']} GB"
cpu += f" {round(100.0 * ram['used'] / ram['total'])}%" if ram['total'] > 0 else ''
return f"<div class='performance'><p>{elapsed_text} {summary} {gpu} {cpu}</p></div>"
return f"<div class='performance hint' id='control-performance'><p>{elapsed_text} {summary} {gpu} {cpu}</p></div>"
def return_controls(res, t: float | None = None):