Upd(performance): 调整多个模块中的性能计时器阈值以减少不必要的日志

This commit is contained in:
W1NDes 2025-08-22 08:32:18 +08:00
parent b1dcefd8a9
commit d5deeeeeeb
4 changed files with 7 additions and 8 deletions

View File

@ -216,7 +216,7 @@ class AlasGUI(Frame):
flag = True
def update(name, seq):
with measure(f"更新实例状态UI({name})", threshold_ms=10):
with measure(f"创建scope({name})", threshold_ms=2):
with measure(f"创建scope({name})", threshold_ms=5):
with use_scope(f"alas-instance-{name}", clear=True):
with measure(f"准备图标HTML({name})", threshold_ms=1):
icon_html = Icon.RUN
@ -226,7 +226,7 @@ class AlasGUI(Frame):
if rendered_state == 4: rendered_state = 2
if rendered_state == 1 and self.af_flag:
icon_html = icon_html[:31] + ' anim-rotate' + icon_html[31:]
with measure(f"渲染按钮UI({name})", threshold_ms=5):
with measure(f"渲染按钮UI({name})", threshold_ms=8):
put_icon_buttons(
icon_html,
buttons=[{"label": name, "value": name, "color": f"aside-{rendered_state}"}],
@ -250,7 +250,7 @@ class AlasGUI(Frame):
self.inst_cache.sort(key=lambda x: x[0])
if flag:
with measure("检查状态变化", threshold_ms=20):
with measure("检查状态变化", threshold_ms=40):
for index, inst in self.inst_cache:
# Check for state change
state = ProcessManager.get_manager(inst).state

View File

@ -84,7 +84,7 @@ def critical_timer(name: Optional[str] = None):
return timer(name=name, log_level="info", threshold_ms=0)
def slow_timer(name: Optional[str] = None):
"""慢操作计时器 - 只记录超过50ms的操作"""
"""慢操作计时器 - 只记录超过100ms的操作"""
return timer(name=name, log_level="info", threshold_ms=100)
def debug_timer(name: Optional[str] = None):

View File

@ -88,11 +88,10 @@ class ProcessManager:
)
logger.info(f"[{self.config_name}] exited")
@slow_timer("ProcessManager.log_queue_handler")
def _thread_log_queue_handler(self) -> None:
while self.alive:
try:
with measure("日志队列获取", threshold_ms=1100):
with measure("日志队列获取", threshold_ms=1500):
log = self._renderable_queue.get(timeout=1)
except queue.Empty:
continue

View File

@ -214,7 +214,7 @@ class TaskHandler:
try:
self._task = task
task_name = getattr(task.g, '__name__', 'unknown_task')
with measure(f"执行任务({task_name})", threshold_ms=50):
with measure(f"执行任务({task_name})", threshold_ms=100):
task.send(self)
except Exception as e:
logger.exception(e)
@ -466,7 +466,7 @@ def set_localstorage(key, value):
def get_localstorage(key):
with measure(f"get_localstorage({key})", threshold_ms=1):
with measure(f"get_localstorage({key})", threshold_ms=30):
return eval_js("localStorage.getItem(key)", key=key)