NetBSD-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: time command sometimes shows garbage in "user" and "sys"



In article <20130202042725.GA7447%SDF.ORG@localhost>, Mayuresh  
<mayuresh%acm.org@localhost> wrote:
>On Fri, Feb 01, 2013 at 11:32:32PM +0000, Christos Zoulas wrote:
>> Mayuresh  <mayuresh%acm.org@localhost> wrote:
>> >Sometimes, and I don't know how to simulate this reliably, the time
>> Can you provide a simple way to reproduce it?
>
>It is very random. But I have somewhat a way:
>
>C.java: create some workload of about .3 to .5s
>-------
>(Why Java? Read on.)
>
>class C { 
>public static void main(String args[]) {
>       for(int i=0;i<Integer.MAX_VALUE;i++)
>       for(int j=0;j<Integer.MAX_VALUE;j++);
>       }
>}
>
>
>
>Compile as
>----------
>
>       javac C.java
>
>Put that in a loop (I have used bash):
>------------------
>
>for((i=0;i<100;i++))
>do
>       echo "Iteration: " $i
>       time java C
>done
>
>
>Watch carefully for garbage figures in time's output.
>---------------
>I see the issue certainly once in the iteration count of 100, mostly
>within first 20 iterations, sometimes within 50.
>
>
>Why Java:
>--------
>
>When I encountered the problem for the first time, it was a Java task
>whose time I was measuring. I tried simulating by creating same workload
>using C. But could not reproduce the problem within 100 iterations.
>
>That definitely baffles me.
>
>Which Java:
>-----------
> # java -version
> java version "1.6.0_33"
> Java(TM) SE Runtime Environment (build 1.6.0_33-b04)
> Java HotSpot(TM) Server VM (build 20.8-b03, mixed mode)

Can't reproduce it with:

$ java -version
openjdk version "1.7.0-internal"
OpenJDK Runtime Environment (build 1.7.0-internal-christos_2011_09_08_15_27-b00)
OpenJDK 64-Bit Server VM (build 21.0-b17, mixed mode)

christos



Home | Main Index | Thread Index | Old Index