2020-01-02 15:13:47 -05:00
|
|
|
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
|
2020-03-08 08:09:22 -04:00
|
|
|
|
2019-09-02 17:07:11 -04:00
|
|
|
import { sendSync } from "./dispatch_json.ts";
|
2018-10-05 13:21:15 -04:00
|
|
|
|
2020-03-08 08:09:22 -04:00
|
|
|
// TODO(bartlomieju): these two types are duplicated
|
|
|
|
// in `cli/js/build.ts` - deduplicate
|
|
|
|
export type OperatingSystem = "mac" | "win" | "linux";
|
|
|
|
export type Arch = "x64" | "arm64";
|
|
|
|
|
|
|
|
export interface Start {
|
|
|
|
cwd: string;
|
|
|
|
pid: number;
|
|
|
|
args: string[];
|
|
|
|
location: string; // Absolute URL.
|
|
|
|
repl: boolean;
|
|
|
|
debugFlag: boolean;
|
|
|
|
depsFlag: boolean;
|
|
|
|
typesFlag: boolean;
|
|
|
|
versionFlag: boolean;
|
|
|
|
denoVersion: string;
|
|
|
|
v8Version: string;
|
|
|
|
tsVersion: string;
|
|
|
|
noColor: boolean;
|
|
|
|
os: OperatingSystem;
|
|
|
|
arch: Arch;
|
|
|
|
}
|
|
|
|
|
|
|
|
export function start(): Start {
|
|
|
|
return sendSync("op_start");
|
|
|
|
}
|
|
|
|
|
2019-02-13 08:50:15 -05:00
|
|
|
export interface Metrics {
|
2018-10-05 13:21:15 -04:00
|
|
|
opsDispatched: number;
|
2020-03-02 13:13:36 -05:00
|
|
|
opsDispatchedSync: number;
|
|
|
|
opsDispatchedAsync: number;
|
|
|
|
opsDispatchedAsyncUnref: number;
|
2018-10-05 13:21:15 -04:00
|
|
|
opsCompleted: number;
|
2020-03-02 13:13:36 -05:00
|
|
|
opsCompletedSync: number;
|
|
|
|
opsCompletedAsync: number;
|
|
|
|
opsCompletedAsyncUnref: number;
|
2018-10-05 13:21:15 -04:00
|
|
|
bytesSentControl: number;
|
|
|
|
bytesSentData: number;
|
|
|
|
bytesReceived: number;
|
|
|
|
}
|
|
|
|
|
2019-03-09 12:30:38 -05:00
|
|
|
export function metrics(): Metrics {
|
2020-02-25 09:14:27 -05:00
|
|
|
return sendSync("op_metrics");
|
2019-03-09 12:30:38 -05:00
|
|
|
}
|