UNPKG

1.22 kBTypeScriptView Raw
1/// <reference types="node" />
2import { FunctionStats } from "./provider";
3import { SmallestN, Statistics } from "./shared";
4import { PropertiesOfType } from "./types";
5export declare class FactoryMap<K = string, V = {}> extends Map<K, V> {
6 readonly factory: (key: K) => V;
7 constructor(factory: (key: K) => V);
8 getOrCreate(key: K): V;
9}
10export declare class FunctionStatsMap {
11 fIncremental: FactoryMap<string, FunctionStats>;
12 fAggregate: FactoryMap<string, FunctionStats>;
13 aggregate: FunctionStats;
14 update(fn: string, key: keyof PropertiesOfType<FunctionStats, Statistics>, value: number): void;
15 incr(fn: string, key: keyof PropertiesOfType<FunctionStats, number>, n?: number): void;
16 resetIncremental(): void;
17 toString(): string;
18 clear(): void;
19}
20export declare class FunctionCpuUsage {
21 utime: Statistics;
22 stime: Statistics;
23 cpuTime: Statistics;
24 smallest: SmallestN<void>;
25}
26export declare class MemoryLeakDetector {
27 private instances;
28 private counters;
29 private warned;
30 private memorySize;
31 constructor(memorySize?: number);
32 detectedNewLeak(fn: string, instanceId: string, memoryUsage: NodeJS.MemoryUsage): boolean;
33 clear(): void;
34}