Damian
Damian

Reputation: 3050

CpuTime in Java. How does it correspond with real CPU cycles?

as above: What exactly bean.getCurrentThreadCpuTime( ) returns ? What CpuTime is?

Upvotes: 0

Views: 2109

Answers (2)

Saurabh Gokhale
Saurabh Gokhale

Reputation: 46395

I guess you are searching for : How to get CPU time ?

From the Wiki's, CPU time (or CPU usage, process time) is the amount of time for which a central processing unit (CPU) was used for processing instructions of a computer program, as opposed to, for example, waiting for input/output operations.

The amount of time the CPU is actually executing instructions. During the execution of most programs, the CPU sits idle much of the time while the computer fetches data from the keyboard or disk, or sends data to an output device. The CPU time of an executing program, therefore, is generally much less than the total execution time of the program. Multitasking operating systems take advantage of this by sharing the CPU among several programs.

See here : bean.getCurrentThreadCpuTime( )

Upvotes: 1

Guus Bosman
Guus Bosman

Reputation: 214

Is this what you are looking for?

"Returns the total CPU time for the current thread in nanoseconds."

http://download.oracle.com/javase/6/docs/api/java/lang/management/ThreadMXBean.html

Upvotes: 1

Related Questions