Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Java Performance in MAC OS X




On Jul 17, 2006, at 1:44 PM, Carlos Santiago wrote:

I have made test of perfomance exactly using different versions of JVM (since 1.3 up to 1.6).
The test is inspired in the article of Matt Love in http:// www.ddj.com/dept/java/188700760 (for example).

I am not convinced this test will tell you anything of value. You are taking unrealistic code and seeing what is done with it. The code is unrealistic in doing one single thing a very large number of times. The jvm handles this unrealistic code either well or badly and you look at the numbers and go, ah, see the jvm handles this unrealistic badly or well.
Uh, ok. But what does it do with realistic code?
If you want to measure gc performance then measure that, I have done so before, but with real code I use daily, or almost daily.
Turn on verbose gc, or profile memory usage.
For verbose gc you can accumulate the information and analyze that.
Something like....


public int handled(String line) {
if (!line.startsWith("[GC")) return 0;
// if (!connected) return TailLoggerFilter.CONSUMED; // If we don't handle it then ignore it
if (line.indexOf("->") == -1) return TailLoggerFilter.CONSUMED; // Not sure how to parse yet
if (!inited) init();
num_of_gcs++;
long now = System.currentTimeMillis();
tot_elapsed = now - wall_clock_in;
line = line.substring(line.indexOf(" ")+1);
int memin = new Integer(line.substring(0,line.indexOf ("K"))).intValue();
line = line.substring(line.indexOf("K")+3);
int memot = new Integer(line.substring(0,line.indexOf ("K"))).intValue();
tot_freed += memot - memin;
line = line.substring(line.indexOf(", ")+2);
float duration = new Float(line.substring(0,9)).floatValue();
if (duration < gc_min) gc_min = duration;
else if (duration > gc_max) gc_max = duration;
long elapsed = now - last;
if (elapsed < gap_min) gap_min = elapsed;
else if (elapsed > gap_max) gap_max = elapsed;
if (elapsed < 2000) { // continued interval?
currintv_num++;
if (now - currintv_start > interval_max) interval_max = now - currintv_start;
if (currintv_num > interval_max_num) interval_max_num = currintv_num;
}
else {
currintv_num = 1;
currintv_start = now;
}
last = now;
return TailLoggerFilter.CONSUMED;
}

class GCStatsDaemon extends Thread {

GCStatsDaemon() {
setName("[GCStatsDaemon]");
setDaemon(true);
System.out.println("GCStatsDaemon");
start();
}

public void run() {
// wait long enough to have something initial to log
synchronized(this) {
try { sleep(1000); }
catch (InterruptedException iex) { iex.printStackTrace(); }
}
System.out.println("GCStatsDaemon: logger info enabled is " + logger.isInfoEnabled());
while (true) {
if (logger.isInfoEnabled()) {
logger.info("VerboseGCTailLogFilter: GCStatsDaemon *****************************");
logger.info("tot# " + num_of_gcs + " total freed " + Math.abs (tot_freed) + " total elapsed " + tot_elapsed);
logger.info("max gap dur " + gc_max + " min gap dur " + gc_min);
logger.info("gc max bytes " + Math.abs(gap_max) + " gc min bytes " + Math.abs(gap_min));
logger.info("max interval " + Math.abs(interval_max) + " max interval num " + interval_max_num);
logger.info ("*******************************************************************");


					synchronized(this) {
						try { sleep(600000); }
						catch (InterruptedException iex) { iex.printStackTrace(); }
					}
				}
				else break;
			}
		}
	}

Actually I sort of liked the interval idea where you track more intense periods of consecutive gc's. But maybe thats just me, I like that sort of thing.
But it gives you an idea of whether or not a lot of gc is being done. If that gc is taking a lot of time. About how long between gc's. Things like that which more directly measure gc. Or so I thought.


Mike Hall        mikehall at spacestar dot net
http://www.spacestar.net/users/mikehall
http://sourceforge.net/projects/macnative



Attachment: smime.p7s
Description: S/MIME cryptographic signature

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Java-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/java-dev/email@hidden

This email sent to email@hidden

References: 
 >Java Performance in MAC OS X (From: "Carlos Santiago" <email@hidden>)
 >Re: Java Performance in MAC OS X (From: Bill Wagner <email@hidden>)
 >Re: Java Performance in MAC OS X (From: "Carlos Santiago" <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.