Re: System.currentTimeMillis() on SMP systems

Attila Szegedi <[email protected]> Fri, 9 May 2008 21:01:17 +0200
Newsgroups gmane.comp.windows.devel.java.advanced
Message-ID <[email protected]>
Yeah, you'd want

<http://java.sun.com/j2se/1.5.0/docs/api/java/lang/management/ThreadMXBean.html#getCurrentThreadCpuTime()
 >

for CPU time consumed.

On 2008.05.09., at 20:32, Randall R Schulz wrote:

> On Wednesday 07 May 2008 07:37, Rodrick Brown wrote:
>> I'm stress testing my backend server and I wrote a small client
>> application that uses System.currentTimeMillis() on various
>> operations the results dont seem to be consistent with what I would
>> expect my system is a 8 core Intel x64 class machine running 64 Bit
>> linux. I heard about issues with System.currentTimeMillis() on SMP
>> machines is this true? Is there a better approach I should be taking?
>
> Are you trying to measure CPU time consumed? 'Cause if you are, that's
> not what you're getting from System.currentTimeMillis(). That call
> returns elapsed / clock time:
>
> From <http://java.sun.com/j2se/1.5.0/docs/api/java/lang/System.html>:
>
> -==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==-
> currentTimeMillis
>
> public static long currentTimeMillis()
>
>    ...
>
>    Returns:
>        the difference, measured in milliseconds, between the current
> time and midnight, January 1, 1970 UTC.
> -==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==-
>
>
>> --
>> [ Rodrick R. Brown ]
>
>
> Randall Schulz

===================================
This list is hosted by DevelopMentorĀ®  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com