1. 학습
  2. /
  3. 강의
  4. /
  5. Optimizing Code in Java

Connected

연습 문제

Analyzing CPU time

You're optimizing a financial analysis application that performs calculations. To get a precise understanding of processor usage, you need to implement a utility that measures the exact CPU time consumed by different operations, which will help you identify which calculations are truly CPU-intensive.

The necessary lang.management packages have been imported for you.

지침

100 XP
  • Retrieve the ThreadMXBean instance from the ManagementFactory class.
  • Get the CPU time for the current thread.