From owner-freebsd-java Wed Aug 14 1: 3:22 2002 Delivered-To: freebsd-java@freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 7610537B400 for ; Wed, 14 Aug 2002 01:03:16 -0700 (PDT) Received: from ns.gddsn.org.cn (ns.gddsn.org.cn [210.21.6.33]) by mx1.FreeBSD.org (Postfix) with ESMTP id 08F2E43E75 for ; Wed, 14 Aug 2002 01:03:16 -0700 (PDT) (envelope-from hwh@ns.gddsn.org.cn) Received: from mail.gddsn.org.cn (gw [210.21.6.34]) by ns.gddsn.org.cn (Postfix) with ESMTP id 183265CE; Wed, 14 Aug 2002 16:03:09 +0800 (CST) Message-ID: <3D5A0EBC.9060706@mail.gddsn.org.cn> Date: Wed, 14 Aug 2002 16:03:08 +0800 From: Huang wen hui User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; zh-CN; rv:1.0.0) Gecko/20020728 X-Accept-Language: zh-cn, zh-tw, en-us MIME-Version: 1.0 To: "Bill Huey (Hui)" Cc: java Subject: Re: Hotspot vm is extremely slower than nojit vm on current ? References: <3D59C6A4.5020708@mail.gddsn.org.cn> <20020814030231.GA4285@gnuppy.monkey.org> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Sender: owner-freebsd-java@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org Bill Huey (Hui) : >On Wed, Aug 14, 2002 at 10:55:32AM +0800, Huang wen hui wrote: > > >>hi, >>Mostly hotspot vm is stable and fast, but I got problem with Thread.sleep. >>Look at the following simple program, on current hotspot vm is extreamly >>slow. >> >> >... > > >>^^^^^^ >>%~hwh/jre/bin/java -jar TestTimer.jar ; java -jar TestTimer.jar >>query elapse time: 1354 >>query elapse time: 140221 >>^^^^^^ >> >> > >I could have blown it with the sleep math. Previously I multiplied the >value of nanosleep by a 1000x more than it should be. ;) > >bill > > > > > Do you mean you have fixed this bug? Would you mind send the patch to me ? More info of this bug, if this is no sense, I'll apologize. This bug occured in hotspot compiler[1 2] vm, not core vm. and I simplify the test case: The main thread elapse time is exactly as same as the timer sleep time. %~hwh/jre/bin/java -version java version "1.3.1-p7" Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.1-p7-root-020727-22:30) Java HotSpot(TM) Core VM (build 1.3.1-internal, interpreted mode) %~hwh/jre/bin/java TestTimer sleep time: 2006 %java -version java version "1.3.1-p7" Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.1-p7-root-020727-22:30) Java HotSpot(TM) Client VM (build 1.3.1-internal, mixed mode) %java TestTimer sleep time: 100013 ----------------------------------------------------------------------------------------------------------------------- public class Timer extends Thread{ private static ThreadGroup tGroup = new ThreadGroup("Timer"); // Number of seconds in each timer cycle int m_cycle; private boolean bQuit = false; public Timer(int cycle){ super(tGroup,"TimerThread"); m_cycle = cycle; } public void run(){ this.setName("TimerThread"); // Loop until stopped while (!bQuit) { try { // Sleep for the clock cycle sleep(m_cycle * 1000); } catch (InterruptedException ex) { } } } public void quit() { bQuit = true; } } import java.util.*; /** * Test freebsd Hotspot speed. */ public class TestTimer { Timer timer = new Timer(100); public TestTimer() { timer.start(); } public void destoryTimer() { timer.quit(); } public static void main(String[] args) throws Exception{ TestTimer tt =new TestTimer(); long now = new java.util.Date().getTime(); Thread.sleep(2*1000); System.err.println("sleep time: "+ (new java.util.Date().getTime() - now)); tt.destoryTimer(); } } To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-java" in the body of the message