Home > Back-end >  How a Java code statistics CPU execution time and IO execution time
How a Java code statistics CPU execution time and IO execution time

Time:04-02

as shown in figure :


Problem of :
Business code, the total time consumption contains CPU and I/o time,
How to code, or other tools, statistical any a business code of CPU and I/o time,

On the business in the figure above, for example, can get the CPU time consuming 109 ms and the rest of the IO accumulative total time consumption,
Method assumes that the business is not transparent, can only call, so the caller how to statistics the target method of these two time consumption,
(you can use the code, or tools)

Consult everybody a great god!!!!!!

CodePudding user response:

Can consider to use springAop, calculate the business method time-consuming (IO) + CPU, HttpClientUitl. The get method time-consuming (IO), as to how to make the two how to bind to a processing
Consider using ThreadLocal set number, used to identify the business and HttpClientUtil get belongs to a treatment

CodePudding user response:

So in the end is how to deal with?
Wrong, business methods are opaque, you to call, that request total time only,,
Opaque, why are you still know how IO, the operation of the CPU,
  • Related