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"



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)


Other details already mentioned : NetBSD 6.0 on i386

Mayuresh


Home | Main Index | Thread Index | Old Index