Skip to content

process: expose uv_rusage on process.resourceUsage() - #28018

Closed
vmarchaud wants to merge 1 commit into
nodejs:masterfrom
vmarchaud:resources-usage
Closed

process: expose uv_rusage on process.resourceUsage()#28018
vmarchaud wants to merge 1 commit into
nodejs:masterfrom
vmarchaud:resources-usage

Conversation

@vmarchaud

@vmarchaudvmarchaud commented Jun 2, 2019

Copy link
Copy Markdown
Contributor

As discussed in nodejs/diagnostics#161,
the core should expose important metrics about the runtime, this PR's
goal is to let user get the number of io request made, and lower level
metrics like the page faults and context switches.

The make -j4 test are not passing locally because of a failing test test/parallel/test-worker-prof.js but i believe it's not related to my changes.
Concerning the tests, i didn't really tested the output of the function mainly because it might make the test flaky depending on the platform and runtime behavior.

This is my first PR on the core, so i might have forgotten some requirements.

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines

@nodejs-github-botnodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. errors Issues and PRs related to JavaScript errors originated in Node.js core. process Issues and PRs related to the process subsystem. labels Jun 2, 2019
@addaleaxaddaleax added the semver-minor PRs that contain new features and should be released in the next minor version. label Jun 2, 2019
Comment threaddoc/api/process.md Outdated
Comment threadsrc/node_process_methods.cc Outdated
Comment threadtest/parallel/test-resources-usage.js Outdated
@Trott

Trott commented Jun 2, 2019

Copy link
Copy Markdown
Member

This is my first PR on the core, so i might have forgotten some requirements.

Looks like you didn't forget anything. Thanks for the pull request and welcome!

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@vmarchaud
vmarchaudforce-pushed the resources-usage branch 3 times, most recently from dfdcae7 to 2eff3d1CompareJune 2, 2019 12:41
@addaleaxaddaleax removed the errors Issues and PRs related to JavaScript errors originated in Node.js core. label Jun 2, 2019
Comment threadtest/parallel/test-resources-usage.js Outdated
@Trott

Trott commented Jun 2, 2019

Copy link
Copy Markdown
Member

Any reason this would make test-worker-prof less reliable? It's failing a lot in CI here, but I'm not sure if it's because of the changes here or something else?

Comment threaddoc/api/process.md Outdated
Comment threaddoc/api/process.md Outdated
Comment threaddoc/api/process.md Outdated
Comment threaddoc/api/process.md Outdated
Comment threaddoc/api/process.md Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'm not sure if it matters at the JS level, but these are all unsigned integers.

Comment threaddoc/api/process.md Outdated
Comment threaddoc/api/process.md Outdated
Comment threaddoc/api/process.md Outdated
Comment threadtest/parallel/test-resources-usage.js Outdated
Comment threadtest/parallel/test-resources-usage.js Outdated
@vmarchaud
vmarchaudforce-pushed the resources-usage branch 4 times, most recently from 315c0e1 to 3f0d72bCompareJune 3, 2019 11:31

@bnoordhuisbnoordhuis left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM. My comments are not blockers.

Comment threaddoc/api/process.md Outdated
Comment threaddoc/api/process.md Outdated
Comment threaddoc/api/process.md Outdated
Comment threaddoc/api/process.md Outdated
Comment threadtest/parallel/test-resource-usage.js Outdated
@vmarchaudvmarchaud changed the title process: expose uv_rusage on process.resourcesUsage()process: expose uv_rusage on process.resourceUsage()Jun 5, 2019
@vmarchaud

Copy link
Copy Markdown
ContributorAuthor

I've switched to full names, added the mapping between node names and libuv ones. Also exposed all the fields even if not supported as @bnoordhuis said.

@BridgeAR

Copy link
Copy Markdown
Member

What benefit do we have by exposing entries that are not supported on any platform?

@addaleax

Copy link
Copy Markdown
Member

@BridgeAR Future-proofing and standards conformance would be the two big pro arguments, I imagine?

Comment threaddoc/api/process.md Outdated
Comment threaddoc/api/process.md Outdated
@vmarchaud
vmarchaudforce-pushed the resources-usage branch 2 times, most recently from d6374b6 to 7bed043CompareJune 5, 2019 12:51
@vmarchaud

Copy link
Copy Markdown
ContributorAuthor

I believe the PR is good to be merged expect if someone has a blocker on the exposed fields ?

@vmarchaud

Copy link
Copy Markdown
ContributorAuthor

I've rebased on master hoping that the test on worker-prof will pass now

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@vmarchaud

Copy link
Copy Markdown
ContributorAuthor

I've checked the test failures and it doesn't seems to be related to this PR, what are the next steps in this case ?

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

As discussed in nodejs/diagnostics#161,
the core should expose important metrics about the runtime, this PR's
goal is to let user get the number of io request made, and lower level
mertrics like the page faults and context switches.
@vmarchaud

Copy link
Copy Markdown
ContributorAuthor

@Trott I'm not sure what are the next steps, do you think the PR can be merged ?

@addaleax

Copy link
Copy Markdown
Member

@vmarchaud Thanks for the ping!

Landed in 6271ef0 🎉

@addaleaxaddaleax closed this Jul 1, 2019
addaleax pushed a commit that referenced this pull request Jul 1, 2019
As discussed in nodejs/diagnostics#161,
the core should expose important metrics about the runtime, this PR's
goal is to let user get the number of io request made, and lower level
mertrics like the page faults and context switches.
PR-URL: #28018
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
@vmarchaud
vmarchaud deleted the resources-usage branch July 1, 2019 20:35
targos pushed a commit that referenced this pull request Jul 2, 2019
As discussed in nodejs/diagnostics#161,
the core should expose important metrics about the runtime, this PR's
goal is to let user get the number of io request made, and lower level
mertrics like the page faults and context switches.
PR-URL: #28018
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
targos pushed a commit that referenced this pull request Jul 2, 2019
As discussed in nodejs/diagnostics#161,
the core should expose important metrics about the runtime, this PR's
goal is to let user get the number of io request made, and lower level
mertrics like the page faults and context switches.
PR-URL: #28018
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
targos added a commit that referenced this pull request Jul 2, 2019
Notable changes:
* build:
* Experimental support for building Node.js on MIPS architecture
is back. #27992
* child_process:
* The promisified versions of `child_process.exec` and
`child_process.execFile` now both return a `Promise` which has the
child instance attached to their `child` property.
#28325
* deps:
* Updated libuv to 1.30.0. #28449
* Support for the Haiku platform has been added.
* The maximum `UV_THREADPOOL_SIZE` has been increased from 128 to
1024.
* `uv_fs_copyfile()` now works properly when the source and
destination files are the same.
* process:
* A new method, `process.resourceUsage()` was added. It returns
resource usage for the current process, such as CPU time.
#28018
* src:
* Fixed an issue related to stdio that could lead to a crash of the
process in some circumstances.
#28490
* stream:
* Added a `writableFinished` property to writable streams. It
indicates that all the data has been flushed to the underlying
system. #28007
* worker:
* Fixed an issue that prevented worker threads to listen for data on
stdin. #28153
PR-URL: #28508
@targostargos mentioned this pull request Jul 2, 2019
targos added a commit that referenced this pull request Jul 2, 2019
Notable changes:
* build:
* Experimental support for building Node.js on MIPS architecture
is back. #27992
* child_process:
* The promisified versions of `child_process.exec` and
`child_process.execFile` now both return a `Promise` which has the
child instance attached to their `child` property.
#28325
* deps:
* Updated libuv to 1.30.0. #28449
* Support for the Haiku platform has been added.
* The maximum `UV_THREADPOOL_SIZE` has been increased from 128 to
1024.
* `uv_fs_copyfile()` now works properly when the source and
destination files are the same.
* process:
* A new method, `process.resourceUsage()` was added. It returns
resource usage for the current process, such as CPU time.
#28018
* src:
* Fixed an issue related to stdio that could lead to a crash of the
process in some circumstances.
#28490
* stream:
* Added a `writableFinished` property to writable streams. It
indicates that all the data has been flushed to the underlying
system. #28007
* worker:
* Fixed an issue that prevented worker threads to listen for data on
stdin. #28153
* meta:
* Added Jiawen Geng (https://github.com/gengjiawen) to collaborators.
#28322
PR-URL: #28508
targos added a commit that referenced this pull request Jul 2, 2019
Notable changes:
* build:
* Experimental support for building Node.js on MIPS architecture
is back. #27992
* child_process:
* The promisified versions of `child_process.exec` and
`child_process.execFile` now both return a `Promise` which has the
child instance attached to their `child` property.
#28325
* deps:
* Updated libuv to 1.30.1. #28449,
#28511
* Support for the Haiku platform has been added.
* The maximum `UV_THREADPOOL_SIZE` has been increased from 128 to
1024.
* `uv_fs_copyfile()` now works properly when the source and
destination files are the same.
* process:
* A new method, `process.resourceUsage()` was added. It returns
resource usage for the current process, such as CPU time.
#28018
* src:
* Fixed an issue related to stdio that could lead to a crash of the
process in some circumstances.
#28490
* stream:
* Added a `writableFinished` property to writable streams. It
indicates that all the data has been flushed to the underlying
system. #28007
* worker:
* Fixed an issue that prevented worker threads to listen for data on
stdin. #28153
* meta:
* Added Jiawen Geng (https://github.com/gengjiawen) to collaborators.
#28322
PR-URL: #28508
targos added a commit that referenced this pull request Jul 3, 2019
Notable changes:
* build:
* Experimental support for building Node.js on MIPS architecture
is back. #27992
* child_process:
* The promisified versions of `child_process.exec` and
`child_process.execFile` now both return a `Promise` which has the
child instance attached to their `child` property.
#28325
* deps:
* Updated libuv to 1.30.1. #28449,
#28511
* Support for the Haiku platform has been added.
* The maximum `UV_THREADPOOL_SIZE` has been increased from 128 to
1024.
* `uv_fs_copyfile()` now works properly when the source and
destination files are the same.
* process:
* A new method, `process.resourceUsage()` was added. It returns
resource usage for the current process, such as CPU time.
#28018
* src:
* Fixed an issue related to stdio that could lead to a crash of the
process in some circumstances.
#28490
* stream:
* Added a `writableFinished` property to writable streams. It
indicates that all the data has been flushed to the underlying
system. #28007
* worker:
* Fixed an issue that prevented worker threads to listen for data on
stdin. #28153
* meta:
* Added Jiawen Geng (https://github.com/gengjiawen) to collaborators.
#28322
PR-URL: #28508
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

c++Issues and PRs that require attention from people who are familiar with C++.processIssues and PRs related to the process subsystem.semver-minorPRs that contain new features and should be released in the next minor version.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants

@vmarchaud@Trott@nodejs-github-bot@BridgeAR@addaleax@mscdex@bnoordhuis@jasnell@cjihrig@BethGriggs