Uname: Linux business55.web-hosting.com 4.18.0-553.lve.el8.x86_64 #1 SMP Mon May 27 15:27:34 UTC 2024 x86_64
Software: LiteSpeed
PHP version: 8.1.31 [ PHP INFO ] PHP os: Linux
Server Ip: 162.213.251.212
Your Ip: 18.118.161.96
User: allssztx (535) | Group: allssztx (533)
Safe Mode: OFF
Disable Function:
NONE

name : benchmark.py
import time
from contextlib import contextmanager
from types import TracebackType


class Benchmark:
    def __enter__(self) -> None:
        self.start_time = time.monotonic_ns()
        return self

    def __exit__(
        self,
        exc_type: type[BaseException] | None,
        exc_val: BaseException | None,
        exc_tb: TracebackType | None,
    ) -> None:
        self.end_time = time.monotonic_ns()
        self.elapsed_time_ns = self.end_time - self.start_time

    @property
    def elapsed_time_ms(self) -> float:
        return self.elapsed_time_ns * 1e-6
© 2025 GrazzMean-Shell