tachometer
Version:
Web benchmark runner
71 lines (70 loc) • 2.15 kB
TypeScript
/**
* @license
* Copyright (c) 2019 The Polymer Project Authors. All rights reserved.
* This code may only be used under the BSD style license found at
* http://polymer.github.io/LICENSE.txt The complete set of authors may be found
* at http://polymer.github.io/AUTHORS.txt The complete set of contributors may
* be found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by
* Google as part of the polymer project is also subject to an additional IP
* rights grant found at http://polymer.github.io/PATENTS.txt
*/
import { BrowserConfig } from './browser';
export declare class Deferred<T> {
readonly promise: Promise<T>;
resolve: (value: T) => void;
reject: (error: Error) => void;
constructor();
}
/**
* A mapping from NPM package name to version specifier, as used in a
* package.json's "dependencies" and "devDependencies".
*/
export interface PackageDependencyMap {
[pkg: string]: string;
}
/**
* The descriptor of a package version as specified by the --package-version
* flag.
*/
export interface PackageVersion {
label: string;
dependencyOverrides: PackageDependencyMap;
}
/** The subset of the format of an NPM package.json file we care about. */
export interface NpmPackageJson {
private: boolean;
dependencies: PackageDependencyMap;
}
/** The kinds of intervals we can measure. */
export declare type Measurement = 'callback' | 'fcp' | 'global';
export declare const measurements: Set<Measurement>;
/** A specification of a benchmark to run. */
export interface BenchmarkSpec {
url: LocalUrl | RemoteUrl;
measurement: Measurement;
measurementExpression?: string;
name: string;
browser: BrowserConfig;
}
export interface LocalUrl {
kind: 'local';
version?: PackageVersion;
urlPath: string;
queryString: string;
}
export interface RemoteUrl {
kind: 'remote';
url: string;
}
export interface BenchmarkResponse {
millis: number;
}
export interface BenchmarkResult {
name: string;
queryString: string;
version: string;
millis: number[];
browser: BrowserConfig;
userAgent: string;
bytesSent: number;
}