Bird
0
0

You want to find which function in your Node.js app uses the most CPU time. You run node --prof app.js and get a log file. What is the correct next step to analyze this data?

hard📝 Application Q15 of 15
Node.js - Debugging and Profiling
You want to find which function in your Node.js app uses the most CPU time. You run node --prof app.js and get a log file. What is the correct next step to analyze this data?
ARun <code>node --prof-process</code> on the log file to get a readable CPU profile report
BOpen the log file in a text editor and search for function names manually
CRun <code>node --inspect</code> to debug the app instead
DRestart the app without profiling to compare performance
Step-by-Step Solution
Solution:
  1. Step 1: Understand how to analyze CPU profile logs

    The raw log file is not human-friendly; it needs processing.
  2. Step 2: Use the correct tool for analysis

    Running node --prof-process on the log file converts it into a readable report showing CPU usage per function.
  3. Final Answer:

    Run node --prof-process on the log file to get a readable CPU profile report -> Option A
  4. Quick Check:

    Use --prof-process to analyze CPU profile logs [OK]
Quick Trick: Process logs with --prof-process for readable CPU report [OK]
Common Mistakes:
  • Trying to read raw logs manually
  • Confusing profiling with debugging
  • Restarting app without analyzing logs

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Node.js Quizzes