Re: CPU Profiling with (j)visualvm
In article
<28ac8cf2-0ee9-4b12-abb5-101857e7bbc1@f15g2000yqf.googlegroups.com>,
Marc van Dongen <dongen@cs.ucc.ie> wrote:
On Feb 19, 6:38??am, Marc van Dongen <don...@cs.ucc.ie> wrote:
[...]
Below I'm attaching the commands which I carried out so as to profile
the java application. The java application may be downloaded from
<http://csweb.ucc.ie:/~dongen/DebugMe.java>.
I've also uploaded two screen captures of the visualvm session:
<http://csweb.ucc.ie:/~dongen/DebugMe1.png> and
<http://csweb.ucc.ie:/~dongen/DebugMe2.png>.
I'm nonplussed. Running your example, I see no Logger invocations at all.
Using java.util.Timer as you did, I get the results below. In
particular, I see une, deux and trois invoked in the prescribed ratio
with reasonable self-times. I get comparable results with Ubuntu Linux.
<http://i52.tinypic.com/rlwcd5.png>
package news;
import java.util.*;
public final class DebugMe {
private static Timer timer = createTimer();
private static volatile int counter;
public static void main(String[] args) {
while (true) {
counter++;
}
}
private static Timer createTimer() {
timer = new Timer();
TimerTask task = new TimerTask() {
@Override
public void run() {
une();
deux(); deux();
trois(); trois(); trois();
}
public void une() { counter++; }
public void deux() { counter++; }
private void trois() { counter++; }
};
timer.schedule(task, 1000L, 1000L);
return timer;
}
}
$ jvisualvm &
[1] 54722
$ java -cp build/classes news.DebugMe
Profiler Agent: JNI On Load Initializing...
Profiler Agent: JNI OnLoad Initialized successfully
Profiler Agent: Waiting for connection on port 5140 (Protocol version: 9)
Profiler Agent: Established local connection with the tool
^CProfiler Agent: Connection with agent closed
Profiler Agent: Connection with agent closed
--
John B. Matthews
trashgod at gmail dot com
<http://sites.google.com/site/drjohnbmatthews>