Java VisualVM giving bizarre results for CPU profiling - Has anyone else run into this?

前端 未结 4 1304
有刺的猬
有刺的猬 2020-12-31 01:53

I have written this small (and brutally inefficient) class and wanted to profile it using the Java VisualVM.

public class Test {

    public static void main         


        
4条回答
  •  既然无缘
    2020-12-31 02:09

    Based on Ron's answer was able to improve the result by stopping the JVM right after the start, then activated the profiler, and finally after that continue the excetion (by pressing enter). It's crude.

    class Foobar {
        /* First line in Class */
          static {
            try {
                System.in.read();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        /* .. */
        public static void main(..) {
            doMagic()
        }
    }        
    

提交回复
热议问题