From: Laurence Kiln <246209442+LaurenceKiln@users.noreply.github.com> Date: Wed, 17 Dec 2025 18:01:50 +0000 (+0200) Subject: Report duration of complete_step with --debug X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3a819b47f1130df8eb9f059e0daae1d403ab8abf;p=thirdparty%2Fmkosi.git Report duration of complete_step with --debug --- diff --git a/mkosi/log.py b/mkosi/log.py index 61a7fe8ba..ddfd185b2 100644 --- a/mkosi/log.py +++ b/mkosi/log.py @@ -5,6 +5,7 @@ import contextvars import logging import os import sys +import time from collections.abc import Iterator from typing import Any, NoReturn, Optional @@ -98,6 +99,7 @@ def complete_step(text: str, text2: Optional[str] = None) -> Iterator[list[Any]] global LEVEL log_step(text) + start = time.perf_counter() LEVEL += 1 try: @@ -110,6 +112,8 @@ def complete_step(text: str, text2: Optional[str] = None) -> Iterator[list[Any]] if text2 is not None: log_step(text2.format(*args)) + logging.debug(f'{" " * (LEVEL)}{time.perf_counter() - start:.1f}s for step "{text}"') + class Formatter(logging.Formatter): def __init__(self, fmt: Optional[str] = None, *args: Any, **kwargs: Any) -> None: