mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-24 05:06:02 +08:00
add declarations for gc-stats
This commit is contained in:
11
types/gc-stats/gc-stats-tests.ts
Normal file
11
types/gc-stats/gc-stats-tests.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
import GCStats = require("gc-stats");
|
||||
import { GCStatistics } from "gc-stats";
|
||||
|
||||
const gcStats = GCStats();
|
||||
|
||||
gcStats.on("stats", (stats: GCStatistics) => {
|
||||
const { gctype: gcType, startTime, endTime, before, after, diff } = stats;
|
||||
const beforeMallocedMemory = before.mallocedMemory;
|
||||
const afterMallocedMemory = after.mallocedMemory;
|
||||
const diffMallocedMemory = diff.mallocedMemory;
|
||||
});
|
||||
34
types/gc-stats/index.d.ts
vendored
Normal file
34
types/gc-stats/index.d.ts
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
// Type definitions for gc-stats 1.2
|
||||
// Project: https://github.com/dainis/node-gcstats#readme
|
||||
// Definitions by: Vitor Fernandes <https://github.com/vfernandestoptal>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
import { EventEmitter } from "events";
|
||||
|
||||
declare namespace GCStats {
|
||||
interface MemoryStatistics {
|
||||
totalHeapSize: number;
|
||||
totalHeapExecutableSize: number;
|
||||
usedHeapSize: number;
|
||||
heapSizeLimit: number;
|
||||
totalPhysicalSize: number;
|
||||
totalAvailableSize: number;
|
||||
mallocedMemory: number;
|
||||
peakMallocedMemory: number;
|
||||
}
|
||||
|
||||
interface GCStatistics {
|
||||
startTime: number;
|
||||
endTime: number;
|
||||
pause: number;
|
||||
pauseMS: number;
|
||||
gctype: 1 | 2 | 4 | 8 | 15;
|
||||
before: MemoryStatistics;
|
||||
after: MemoryStatistics;
|
||||
diff: MemoryStatistics;
|
||||
}
|
||||
}
|
||||
|
||||
declare function GCStats(): EventEmitter;
|
||||
|
||||
export = GCStats;
|
||||
23
types/gc-stats/tsconfig.json
Normal file
23
types/gc-stats/tsconfig.json
Normal file
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"gc-stats-tests.ts"
|
||||
]
|
||||
}
|
||||
1
types/gc-stats/tslint.json
Normal file
1
types/gc-stats/tslint.json
Normal file
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user