mirror of
https://github.com/koloideal/Argenta.git
synced 2026-06-10 10:05:28 +03:00
bbbbbbenchh
This commit is contained in:
+12
-7
@@ -9,8 +9,9 @@ from rich.text import Text
|
||||
from argenta.command.models import Command
|
||||
from argenta.response import Response
|
||||
from argenta.router import Router
|
||||
from .benchmarks.models import BenchmarkResult
|
||||
from .benchmarks.utils import run_all_benchmarks, get_kernel_version, get_gpu_info
|
||||
from .benchmarks.core.models import BenchmarkGroupResult
|
||||
from .benchmarks.entity import benchmarks as registered_benchmarks
|
||||
from .utils import get_kernel_version, get_gpu_info
|
||||
|
||||
console = Console()
|
||||
router = Router(title="Metrics commands:")
|
||||
@@ -39,10 +40,10 @@ def all_print_handler(_: Response) -> None:
|
||||
console.print(Panel(header_text, expand=False, border_style="magenta"))
|
||||
console.print(table, end="\n\n")
|
||||
|
||||
type_paired_benchmarks: dict[str, list[BenchmarkResult]] = run_all_benchmarks()
|
||||
type_grouped_benchmarks: list[BenchmarkGroupResult] = registered_benchmarks.run_benchmarks_grouped_by_type()
|
||||
|
||||
for type_, benchmarks in type_paired_benchmarks.items():
|
||||
header_text = Text(f"TYPE: {type_.upper()}", style="bold magenta")
|
||||
for results in type_grouped_benchmarks:
|
||||
header_text = Text(f"TYPE: {results.type_.upper()}", style="bold magenta")
|
||||
console.print(Panel(header_text, expand=False, border_style="magenta"))
|
||||
|
||||
table = Table(show_header=True, header_style="bold cyan", border_style="blue", show_lines=True)
|
||||
@@ -50,13 +51,17 @@ def all_print_handler(_: Response) -> None:
|
||||
table.add_column("Description", style="dim")
|
||||
table.add_column("Iterations", justify="right")
|
||||
table.add_column("Avg Time (ms)", justify="right", style="bold yellow")
|
||||
table.add_column("Median Time (ms)", justify="right", style="bold yellow")
|
||||
table.add_column("Stdev (ms)", justify="right", style="bold yellow")
|
||||
|
||||
for benchmark in benchmarks:
|
||||
for benchmark in results.benchmark_results:
|
||||
table.add_row(
|
||||
benchmark.name,
|
||||
benchmark.description,
|
||||
str(benchmark.iterations),
|
||||
str(benchmark.avg_time)
|
||||
str(benchmark.avg_time),
|
||||
str(benchmark.median_time),
|
||||
str(benchmark.std_dev),
|
||||
)
|
||||
|
||||
console.print(table)
|
||||
|
||||
Reference in New Issue
Block a user