Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to collect memory information from processes #11

Merged
merged 4 commits into from Mar 16, 2018

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
@@ -23,7 +23,7 @@ function buildProcessTree(processList, rootPid) {
};
}

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.

test.js Outdated
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.

children: ProcessTreeNode[]
}

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.

None yet

2 participants