Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion report/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Base Bench Metrics</title>
<title>Base Load Tests</title>
</head>
<body>
<div id="root"></div>
Expand Down
18 changes: 14 additions & 4 deletions report/src/pages/LoadTestDetail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ import {
durationToNanos,
formatDuration,
formatEthFromWei,
formatGps,
formatGasVerbose,
formatGpsVerbose,
formatLoadTestTimestamp,
formatPercent,
formatTps,
formatValue,
} from "../utils/formatters";
import {
FlashblocksLatencyStats,
Expand Down Expand Up @@ -107,17 +107,27 @@ const SummarySection = ({ result }: { result: LoadTestResult }) => {
/>
<Stat label="Failed" value={failed.toLocaleString()} />
<Stat label="Avg TPS" value={formatTps(result.throughput.tps)} />
<Stat label="Avg gas/s" value={formatGps(result.throughput.gps)} />
<Stat
label="Avg gas/s"
value={formatGpsVerbose(result.throughput.gps)}
/>
<Stat
label="Total gas"
value={formatValue(result.gas.total_gas, "gas")}
value={formatGasVerbose(result.gas.total_gas)}
hint={`${result.gas.avg_gas.toLocaleString()} avg / tx`}
/>
<Stat
label="Total cost"
value={formatEthFromWei(result.gas.total_cost_wei)}
hint={`${result.gas.avg_gas_price.toLocaleString()} wei avg gas price`}
/>
{result.block_range && (
<Stat
label="Block range"
value={`${result.block_range.first_block.toLocaleString()} → ${result.block_range.last_block.toLocaleString()}`}
hint={`${result.block_range.block_count.toLocaleString()} blocks`}
/>
)}
</StatGrid>
</StatCard>
);
Expand Down
9 changes: 9 additions & 0 deletions report/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,12 @@ export interface ThroughputPercentiles {
gps_max: number;
}

export interface BlockRange {
first_block: number;
last_block: number;
block_count: number;
}

export interface GasStats {
total_gas: number;
avg_gas: number;
Expand Down Expand Up @@ -229,6 +235,9 @@ export interface LoadTestResult {
// gated on its presence rather than rendering empty placeholders.
config?: LoadTestConfig;
throughput_timeseries?: ThroughputSample[];
// Optional for back-compat: older runs predate this field. The summary
// section gates the block range stats on its presence.
block_range?: BlockRange;
}

/**
Expand Down
25 changes: 25 additions & 0 deletions report/src/utils/formatters.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,31 @@ export const formatTps = (n: number): string => `${n.toFixed(1)} tx/s`;

export const formatGps = (n: number): string => formatValue(n, "gas/s");

const WRITTEN_PREFIXES: Record<string, string> = {
"": "",
k: "thousand ",
M: "million ",
G: "billion ",
T: "trillion ",
};

const formatGasWritten = (value: number, suffix: string): string => {
if (value === 0) return `0 gas${suffix}`;
const sortedPrefixes = Object.entries(PREFIXES).sort(([, a], [, b]) => b - a);
for (const [prefix, multiplier] of sortedPrefixes) {
if (Math.abs(value) >= multiplier) {
const written = WRITTEN_PREFIXES[prefix] ?? `${prefix} `;
return `${(value / multiplier).toFixed(1)} ${written}gas${suffix}`;
}
}
return `${value.toFixed(1)} gas${suffix}`;
};

export const formatGasVerbose = (n: number): string => formatGasWritten(n, "");

export const formatGpsVerbose = (n: number): string =>
formatGasWritten(n, "/s");

export const formatPercent = (
numerator: number,
denominator: number,
Expand Down
Loading