8000 feat: allow collecting profiles with more accurate line numbers by nolanmar511 · Pull Request #69 · google/pprof-nodejs · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

feat: allow collecting profiles with more accurate line numbers #69

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

Merged
merged 3 commits into from
Jun 24, 2019

Conversation

nolanmar511
Copy link
Contributor
@nolanmar511 nolanmar511 commented Jun 11, 2019

Testing:
I've run test.sh with Node 12.3.1 and the V8 canary build from 6/10/19 (with and without VERIFY_TIME_LINE_NUMBERS=true).

Also inspected time profiles from each of these runs:

Node 13, w/o detailed lines
image

Node 13 w/ detailed lines
image

Node 12 w/o detailed lines
image

Node 12 w/ detailed lines
image

@nolanmar511 nolanmar511 force-pushed the accurate-line-numbers branch 3 times, most recently from 4a33bf5 to ab65cce Compare June 19, 2019 15:36
@nolanmar511 nolanmar511 force-pushed the accurate-line-numbers branch from 48e5b07 to 77c8929 Compare June 24, 2019 18:27
@nolanmar511 nolanmar511 merged commit 138d5bd into google:master Jun 24, 2019
NAN_METHOD(StartProfiling) {
Local<String> name = info[0].As<String>();
if (info.Length() != 2) {
return Nan::ThrowTypeError("StartProfling must have two arguments.");
Copy link
Contributor

Choose a reason for hiding this comment

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

StartProfling is a typo.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done (#73)

cpuProfiler->StartProfiling(name, false);
// Sample counts and timestamps are not used, so we do not need to record
// samples.
bool recordSamples = false;
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this supposed to be a const?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done (#73)

}

Local<Value> TranslateTimeProfile(const CpuProfile* profile) {
Local<Value> TranslateTimeProfile(const CpuProfile* profile, bool hasDetailedLines) {
Copy link
Contributor

Choose a reason for hiding this comment

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

"detailed" is an unclear term. Also "has" is not super clear - is this flag requesting something or stating something?

Copy link
Contributor Author
@nolanmar511 nolanmar511 Jun 24, 2019

Choose a reason for hiding this comment

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

Switched to using "includeLineInfo" (for starting the profile, when we're requesting line information), and "includedLineInfo" (where it indicates that line info is present).

#73


// Line-level accurate line information is not available in Node 11 or earlier.
#if NODE_MODULE_VERSION > NODE_11_0_MODULE_VERSION
bool includeLineInfo =
Copy link
Contributor

Choose a reason for hiding this comment

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

terminology: what is the difference between "has" used above and "include" used here? Is this intentionally different?

Copy link
Contributor Author
@nolanmar511 nolanmar511 Jun 24, 2019

Choose a reason for hiding this comment

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

Switched to using "includeLineInfo" (for starting the profile, when we're requesting line information), and "includedLineInfo" (where it indicates that line info is present).

#73

}

async function collectAndSaveTimeProfile(durationSeconds, sourceMapper,
lineNumbers) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: I am not sure it's the right formatting, I think lineNumbers needs to be aligned with the first argument. Is this machine-formatted?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ran clang-format (#73)


if [[ "$VERIFY_TIME_LINE_NUMBERS" == "true" ]]; then
pprof -lines -top -nodecount=2 time.pb.gz | \
grep "busyLoop.*src/busybench.js:33"
Copy link
Contributor

Choose a reason for hiding this comment

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

I would change ":33" to ":34" here once and make sure the test fails, just to double-check that the "verify time line numbers" flag machinery works correctly. As if it doesn't the test would happily pass without the line numbers feature working.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done


/**
* This configuration option is experimental.
* When set to true, functions will be aggregated at the line-level, rather
Copy link
Contributor

Choose a reason for hiding this comment

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

"line-level" -> "line level"? because "function level" (and overall)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done (#73)

nolanmar511 added a commit to nolanmar511/pprof-nodejs that referenced this pull request Jun 24, 2019
nolanmar511 added a commit to nolanmar511/pprof-nodejs that referenced this pull request Jun 24, 2019
nolanmar511 added a commit to nolanmar511/pprof-nodejs that referenced this pull request Jun 24, 2019
nolanmar511 added a commit to nolanmar511/pprof-nodejs that referenced this pull request Jun 25, 2019
nolanmar511 added a commit that referenced this pull request Jun 26, 2019
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.

4 participants
0