Bird
0
0

After running node --prof app.js, no CPU profile log file appears. Which is the most probable reason?

medium📝 Debug Q6 of 15
Node.js - Debugging and Profiling
After running node --prof app.js, no CPU profile log file appears. Which is the most probable reason?
AThe app.js script has syntax errors
BThe <code>--prof</code> flag was misspelled
CThe log file was created in a different directory
DThe Node.js process exited before any CPU activity occurred
Step-by-Step Solution
Solution:
  1. Step 1: Understand profiling log creation

    CPU profiling logs are generated only if the process runs enough CPU work.
  2. Step 2: Consider process exit timing

    If the app exits immediately, no profiling data is recorded, so no log is created.
  3. Step 3: Evaluate other options

    Misspelling flags usually cause errors; logs default to current directory; syntax errors prevent running.
  4. Final Answer:

    The Node.js process exited before any CPU activity occurred -> Option D
  5. Quick Check:

    Profiling requires CPU activity before exit [OK]
Quick Trick: No CPU work means no profile log [OK]
Common Mistakes:
  • Assuming logs always generate regardless of runtime
  • Ignoring that immediate exit prevents profiling
  • Thinking logs are saved elsewhere by default

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Node.js Quizzes