Alfe
Alfe

Reputation: 59606

Java profiling with varying machines

What the best way to reduce the impact the underlying machine of a Java program has on any profiling measurement?

I have different results for profiling each time I run my program, mostly because the machine I run my program on has varying load as a whole. It's also connected to the machine being a VM, and the hypervisor returning me different VMs each time I ask for one, but that's not the point.

The point is:

Is there a way to profile a Java execution regardless of the speed of the machine the Java program runs on? Is there maybe some other measurement (like JVM-steps through the bytecode or similar?) than just the plain old nanoseconds?

I know this will be problematic about the native stuff you will eventually jump into, but that could be handled differently. I'm just concerned about "my" code and that's pure Java.

Upvotes: 0

Views: 26

Answers (1)

Mike Dunlavey
Mike Dunlavey

Reputation: 40709

Look at percents, not absolute time. Look at inclusive, never exclusive percent. Look at wall-clock percent, not CPU percent, if you can. If possible, look at inclusive percent for lines, not just methods. Don't be too concerned about "accuracy" - you're looking for things that have a high percent. Exactly how high is beside the point.

Upvotes: 1

Related Questions