import { useEffect, useState } from "react"; import axios from "axios"; interface BenchmarkStatus { current_dataset: string; current_algorithm: string; completed_count: number; total_count: number; progress_percentage: number; elapsed_time: number; last_update: string; completed_benchmarks: Array<{ dataset: string; algorithm: string; compression_ratio: number; encode_time: number; decode_time: number; cache_status: string; }>; } export default function Monitor() { const [status, setStatus] = useState(null); const [error, setError] = useState(null); const [loading, setLoading] = useState(true); const fetchStatus = async () => { setLoading(true); try { const cacheBust = Math.random().toString(36).substring(2, 15); const response = await axios.get( `https://tempory.net/f/memobin/ephys_compression_tests/benchmark_status/current.json?cachebust=${cacheBust}`, ); setStatus(response.data); setError(null); } catch (error) { const message = error instanceof Error ? error.message : "Failed to fetch status"; setError(message); console.error("Error fetching benchmark status:", error); } finally { setLoading(false); } }; useEffect(() => { fetchStatus(); }, []); if (loading) { return
Loading benchmark status...
; } if (error) { return
Error: {error}
; } if (!status) { return
No active benchmark run found.
; } const formatTime = (seconds: number) => { const hours = Math.floor(seconds / 3600); const minutes = Math.floor((seconds % 3600) / 60); const remainingSeconds = Math.floor(seconds % 60); return `${hours}h ${minutes}m ${remainingSeconds}s`; }; return (

Benchmark Progress

Current Status

Current Dataset: {status.current_dataset}

Current Algorithm: {status.current_algorithm}

Progress: {status.completed_count} /{" "} {status.total_count} ({status.progress_percentage.toFixed(1)}%)

Elapsed Time: {formatTime(status.elapsed_time)}

Last Update:{" "} {new Date(status.last_update).toLocaleString()}

Completed Benchmarks

{status.completed_benchmarks.map((benchmark, index) => ( ))}
Dataset Algorithm Compression Ratio Encode Time (ms) Decode Time (ms) Cache Status
{benchmark.dataset} {benchmark.algorithm} {benchmark.compression_ratio.toFixed(2)}x {(benchmark.encode_time * 1000).toFixed(2)} {(benchmark.decode_time * 1000).toFixed(2)} {benchmark.cache_status}
); }