-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy pathwindows-process-tree.d.ts
75 lines (63 loc) · 2.63 KB
/
windows-process-tree.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
declare module '@vscode/windows-process-tree' {
export enum ProcessDataFlag {
None = 0,
Memory = 1,
CommandLine = 2
}
export interface IProcessInfo {
pid: number;
ppid: number;
name: string;
/**
* The working set size of the process, in bytes.
*/
memory?: number;
/**
* The string returned is at most 512 chars, strings exceeding this length are truncated.
*/
commandLine?: string;
}
export interface IProcessCpuInfo extends IProcessInfo {
cpu?: number;
}
export interface IProcessTreeNode {
pid: number;
name: string;
memory?: number;
commandLine?: string;
children: IProcessTreeNode[];
}
/**
* Returns a tree of processes with the rootPid process as the root.
* @param rootPid - The pid of the process that will be the root of the tree.
* @param callback - The callback to use with the returned list of processes.
* @param flags - The flags for what process data should be included.
*/
export function getProcessTree(rootPid: number, callback: (tree: IProcessTreeNode | undefined) => void, flags?: ProcessDataFlag): void;
namespace getProcessTree {
function __promisify__(rootPid: number, flags?: ProcessDataFlag): Promise<IProcessTreeNode>;
}
/**
* Returns a list of processes containing the rootPid process and all of its descendants.
* @param rootPid - The pid of the process of interest.
* @param callback - The callback to use with the returned set of processes.
* @param flags - The flags for what process data should be included.
*/
export function getProcessList(rootPid: number, callback: (processList: IProcessInfo[] | undefined) => void, flags?: ProcessDataFlag): void;
namespace getProcessList {
function __promisify__(rootPid: number, flags?: ProcessDataFlag): Promise<IProcessInfo[]>;
}
/**
* Returns the list of processes annotated with cpu usage information.
* @param processList - The list of processes.
* @param callback - The callback to use with the returned list of processes.
*/
export function getProcessCpuUsage(processList: IProcessInfo[], callback: (processListWithCpu: IProcessCpuInfo[]) => void): void;
namespace getProcessCpuUsage {
function __promisify__(processList: IProcessInfo[]): Promise<IProcessCpuInfo[]>;
}
}