KEMBAR78
Add option to collect memory information from processes by RMacfarlane · Pull Request #11 · microsoft/vscode-windows-process-tree · GitHub
Skip to content

Conversation

@RMacfarlane
Copy link
Contributor

Adds optional flags parameter to control what information is fetched about a process. When memory bit is set, reports memory usage for each process in bytes.

@RMacfarlane RMacfarlane self-assigned this Mar 14, 2018
@RMacfarlane RMacfarlane requested a review from Tyriar March 14, 2018 17:29
}

function getProcessTree(rootPid, callback) {
function getProcessTree(rootPid, callback, flags) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We'll need a corresponding change in the typings file

src/addon.cc Outdated
return;
}

// Flags is an optional parameter. By default, all options for included process data are off.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's make it a mandatory parameter in the C++ side and use flags || 0 on JS side to simplify things.

native.getProcessList((list) => {
assert.equal(list.some((p => p.memory !== 0)), true);
done();
}, 1);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use the flags enum here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think so, since this is a js file. I can make a separate change to move to using typescript

test.js Outdated

// Memory should be a number when flag is set
native.getProcessList((list) => {
assert.equal(list.some((p => p.memory !== 0)), true);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

> 0 to be safer since !== 0 will be true when it's undefined.

}

function get(rootPid: number, callback: (tree: ProcessTreeNode) => void): void;
function get(rootPid: number, callback: (tree: ProcessTreeNode) => void, flag?: ProcessDataFlag): void;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's call this flags

@Tyriar Tyriar merged commit 9dde6e7 into master Mar 16, 2018
@Tyriar Tyriar deleted the rmacfarlane/memory branch March 16, 2018 15:24
@Tyriar Tyriar added this to the 0.2.0 milestone Mar 16, 2018
vmihdal pushed a commit to vmihdal/vscode-windows-process-tree that referenced this pull request Aug 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants