Skip to content

node --perf-basic-prof index.js - No information about JavaScript functions, only v8. #34668

New issue

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

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

Already on GitHub? # to your account

Closed
vlopp opened this issue Aug 7, 2020 · 2 comments
Labels
question Issues that look for answers.

Comments

@vlopp
Copy link

vlopp commented Aug 7, 2020

What steps will reproduce the bug?

Following this tutorial from the official node website.

perf record -e cycles:u -g -- node --perf-basic-prof index.js

This generates perf.data and a /tmp/perf-somenumbers.js file.

index.js:


function FunctionA1() {
  FunctionB2();
}

function FunctionB2() {
  console.log("Hello!");
}

FunctionA1();
perf script > perfs.out
  1. Now, this doesn't return any results, although I'd expect to see FunctionA1 calls logged by perf.
cat perfs.out | grep FunctionA1

Perf was installing via

sudo apt install linux-tools-generic

What is the expected behavior?

Javascript functions, such as FunctionA1, are visible in the captured info.

@mmarchini
Copy link
Contributor

V8 changed their optimization pipeline on Node.js v8.x, which makes it harder for perf to capture some functions. Starting on Node.js v10.x, a new flag was added (--interpreted-frames-native-stack) that works around that limitation (the flag must be used alongside --perf-basic-prof). For more details, refer to https://nodejs.org/en/docs/guides/diagnostics-flamegraph/#perf-output-issues and for historical context: nodejs/diagnostics#407 (comment)

@bnoordhuis bnoordhuis added the question Issues that look for answers. label Aug 10, 2020
@bnoordhuis
Copy link
Member

Closing as answered, let me know if there's reason to reopen.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
question Issues that look for answers.
Projects
None yet
Development

No branches or pull requests

3 participants