I am running a simple java program and trying to study the same using visual vm . Not trying to debug application performance. app consist of 2 simple classes and creates 2 thread , which does nothing but sleep.
public class ThreadRunExample {
public static void main(String[] args){
Thread t1 = new Thread(new HeavyWorkRunnable(), "t1");
Thread t2 = new Thread(new HeavyWorkRunnable(), "t2");
System.out.println("Starting Runnable threads");
t1.start();
t2.start();
System.out.println("Runnable Threads has been started");
}
}
public class HeavyWorkRunnable implements Runnable{
@Override
public void run() {
System.out.println("Doing heavy processing - START "+Thread.currentThread().getName());
try {
Thread.sleep(1000);
//Get database connection, delete unused data from DB
doDBProcessing();
} catch (InterruptedException e) {
e.printStackTrace();
}
System.out.println("Doing heavy processing - END "+Thread.currentThread().getName());
}
private void doDBProcessing() throws InterruptedException {
System.out.println("Doing heavy processing - start "+Thread.currentThread().getName());
Thread.sleep(50000);
}
}
Visual VM Sampler tab shows the thread sleeping correctly
However profiler tab , after clicking for CPU profiling shows nothing .
During running of the app , profiler tab is blank . Any idea