mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-10-02 00:25:34 +08:00
* Make native installs portable and smaller - Support glibc 2.34 with portable compiler binaries and static LLVM helpers. - Bundle the host runtime and discover optional cross-target packs from project dependencies. - Add application build benchmarks covering latency, executable size, and memory. * Keep bootstrap tools available in Sandbox validation - Isolate Zig for native compiler bootstrap and glibc entropy contracts. - Preserve the existing toolchain scope for cache and corpus tests. * Fix portable compiler bootstrap linking - Keep native support objects compatible with the destination host linker. - Resolve installed targets using the host declared by the toolchain manifest.
20 lines
879 B
TypeScript
20 lines
879 B
TypeScript
import { parse } from "./parse.ts";
|
|
export interface Route { path: string; count: number; errors: number; milliseconds: number; bytes: number }
|
|
export function summarize(source: string, minimum: number): Route[] {
|
|
const routes = new Map<string, Route>();
|
|
for (const line of source.split("\n")) {
|
|
const request = parse(line);
|
|
if (request === null || request.status < minimum) continue;
|
|
let route = routes.get(request.route);
|
|
if (route === undefined) {
|
|
route = { path: request.route, count: 0, errors: 0, milliseconds: 0, bytes: 0 };
|
|
routes.set(request.route, route);
|
|
}
|
|
route.count++;
|
|
route.errors += request.status >= 400 ? 1 : 0;
|
|
route.milliseconds += request.milliseconds;
|
|
route.bytes += request.bytes;
|
|
}
|
|
return [...routes.values()].sort((a, b) => b.count - a.count || (a.path < b.path ? -1 : a.path > b.path ? 1 : 0));
|
|
}
|