inspector: split --cpu-prof-path to --cpu-prof-dir and --cpu-prof-name by joyeecheung · Pull Request #27306 · nodejs/node (original) (raw)

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 andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Conversation22 Commits4 Checks0 Files changed

Conversation

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters

[ Show hidden characters]({{ revealButtonHref }})

joyeecheung

To improve the integration of --cpu-prof with workers, this patch
splits --cpu-prof-path into --cpu-prof-dir and --cpu-prof-name,
so when a worker is launched from a thread that enables
--cpu-prof, if the parent thread sets --cpu-prof-dir, then the
profile of both thread would be generated to the specified directory.
If they end up specifying the same --cpu-prof-name the behavior
is undefined - the last profile will overwritten the first one.

Checklist

@nodejs-github-bot

This comment has been minimized.

@nodejs-github-bot nodejs-github-bot added c++

Issues and PRs that require attention from people who are familiar with C++.

lib / src

Issues and PRs related to general changes in the lib or src directory.

labels

Apr 19, 2019

@nodejs-github-bot

This comment has been minimized.

@joyeecheung

cc @nodejs/workers @nodejs/performance @nodejs/process

addaleax

mcollina

Choose a reason for hiding this comment

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

LGTM

@mscdex

Why --prof-dir instead of something more specific like --cpu-prof-dir ? Having non-V8 --prof-* options is confusing because we already have --prof and --prof-process for V8.

joyeecheung

@joyeecheung

To improve the integration of --cpu-prof with workers, this patch splits --cpu-prof-path into --prof-dir and --cpu-prof-name, so when a worker is launched from a thread that enables --cpu-prof, if the parent thread sets --prof-dir, then the profile of both thread would be generated to the specified directory. If they end up specifying the same --cpu-prof-name the behavior is undefined the last profile will overwritten the first one.

@mscdex

I prefer keeping the specific directory prefix in the flag names for clarity. If we support more profile types in the future it just gives more flexibility.

@joyeecheung

I prefer keeping the specific directory prefix in the flag names for clarity. If we support more profile types in the future it just gives more flexibility.

How would that gives more flexibility? If the whole path is specified in the flag, how would --cpu-prof-path work with workers? With --cpu-prof-path, you either hard-code the entire path, or nothing at all. With --prof-dir and --cpu-prof-name you can just hard-code the directory but let Node.js generate the file name for you, which I believe is the more common use case.

BTW, this is also closer to how the reports are generated. I think it's better to have a consistent style to generate these files.

@joyeecheung

@nodejs-github-bot

This comment has been minimized.

@joyeecheung

Moved the directory initialization to env.cc and renamed --prof-dir to --node-prof-dir to avoid the ambiguity. @mcollina @addaleax @mscdex PTAL, thanks!

@mscdex

With --cpu-prof-path, you either hard-code the entire path, or nothing at all.

I was referring to having individual profile type directory prefix flags like --cpu-prof-dir vs a --prof-dir for all profile types.

@joyeecheung

I was referring to having individual profile type directory prefix flags like --cpu-prof-dir vs a --prof-dir for all profile types.

I see, that makes sense to me, I'll switch to that instead, thanks!

@joyeecheung

@nodejs-github-bot

This comment has been minimized.

@joyeecheung joyeecheung changed the titleinspector: split --cpu-prof-path to --prof-dir and --cpu-prof-name inspector: split --cpu-prof-path to --cpu-prof-dir and --cpu-prof-name

Apr 19, 2019

mscdex

@joyeecheung

@nodejs-github-bot

This comment has been minimized.

@nodejs-github-bot

@nodejs-github-bot

@joyeecheung

If there are no more reviews, I'd like to land this later today.

@joyeecheung joyeecheung added the author ready

PRs that have at least one approval, no pending requests for changes, and a CI started.

label

Apr 22, 2019

@joyeecheung

joyeecheung added a commit that referenced this pull request

Apr 22, 2019

@joyeecheung

To improve the integration of --cpu-prof with workers, this patch splits --cpu-prof-path into --cpu-prof-dir and --cpu-prof-name, so when a worker is launched from a thread that enables --cpu-prof, if the parent thread sets --cpu-prof-dir, then the profile of both thread would be generated to the specified directory. If they end up specifying the same --cpu-prof-name the behavior is undefined the last profile will overwritten the first one.

PR-URL: #27306 Reviewed-By: Anna Henningsen anna@addaleax.net Reviewed-By: Matteo Collina matteo.collina@gmail.com

This was referenced

Apr 23, 2019

Labels

author ready

PRs that have at least one approval, no pending requests for changes, and a CI started.

c++

Issues and PRs that require attention from people who are familiar with C++.

lib / src

Issues and PRs related to general changes in the lib or src directory.