< prev index next >

src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/utilities/HeapHprofBinWriter.java

Print this page
rev 54717 : imported patch 8223306


 691             out.writeInt(0);
 692             // no constant pool for array klasses
 693             out.writeShort((short) 0);
 694             // no static fields for array klasses
 695             out.writeShort((short) 0);
 696             // no instance fields for array klasses
 697             out.writeShort((short) 0);
 698         }
 699     }
 700 
 701     private void dumpStackTraces() throws IOException {
 702         // write a HPROF_TRACE record without any frames to be referenced as object alloc sites
 703         writeHeader(HPROF_TRACE, 3 * (int)INT_SIZE );
 704         out.writeInt(DUMMY_STACK_TRACE_ID);
 705         out.writeInt(0);                    // thread number
 706         out.writeInt(0);                    // frame count
 707 
 708         int frameSerialNum = 0;
 709         int numThreads = 0;
 710         Threads threads = VM.getVM().getThreads();
 711 
 712         for (JavaThread thread = threads.first(); thread != null; thread = thread.next()) {
 713             Oop threadObj = thread.getThreadObj();
 714             if (threadObj != null && !thread.isExiting() && !thread.isHiddenFromExternalView()) {
 715 
 716                 // dump thread stack trace
 717                 ThreadStackTrace st = new ThreadStackTrace(thread);
 718                 st.dumpStack(-1);
 719                 numThreads++;
 720 
 721                 // write HPROF_FRAME records for this thread's stack trace
 722                 int depth = st.getStackDepth();
 723                 int threadFrameStart = frameSerialNum;
 724                 for (int j=0; j < depth; j++) {
 725                     StackFrameInfo frame = st.stackFrameAt(j);
 726                     Method m = frame.getMethod();
 727                     int classSerialNum = KlassMap.indexOf(m.getMethodHolder()) + 1;
 728                     // the class serial number starts from 1
 729                     assert classSerialNum > 0:"class not found";
 730                     dumpStackFrame(++frameSerialNum, classSerialNum, m, frame.getBCI());
 731                 }
 732 




 691             out.writeInt(0);
 692             // no constant pool for array klasses
 693             out.writeShort((short) 0);
 694             // no static fields for array klasses
 695             out.writeShort((short) 0);
 696             // no instance fields for array klasses
 697             out.writeShort((short) 0);
 698         }
 699     }
 700 
 701     private void dumpStackTraces() throws IOException {
 702         // write a HPROF_TRACE record without any frames to be referenced as object alloc sites
 703         writeHeader(HPROF_TRACE, 3 * (int)INT_SIZE );
 704         out.writeInt(DUMMY_STACK_TRACE_ID);
 705         out.writeInt(0);                    // thread number
 706         out.writeInt(0);                    // frame count
 707 
 708         int frameSerialNum = 0;
 709         int numThreads = 0;
 710         Threads threads = VM.getVM().getThreads();
 711         for (int i = 0; i < threads.getNumberOfThreads(); i++) {
 712             JavaThread thread = threads.getJavaThreadAt(i);
 713             Oop threadObj = thread.getThreadObj();
 714             if (threadObj != null && !thread.isExiting() && !thread.isHiddenFromExternalView()) {
 715 
 716                 // dump thread stack trace
 717                 ThreadStackTrace st = new ThreadStackTrace(thread);
 718                 st.dumpStack(-1);
 719                 numThreads++;
 720 
 721                 // write HPROF_FRAME records for this thread's stack trace
 722                 int depth = st.getStackDepth();
 723                 int threadFrameStart = frameSerialNum;
 724                 for (int j=0; j < depth; j++) {
 725                     StackFrameInfo frame = st.stackFrameAt(j);
 726                     Method m = frame.getMethod();
 727                     int classSerialNum = KlassMap.indexOf(m.getMethodHolder()) + 1;
 728                     // the class serial number starts from 1
 729                     assert classSerialNum > 0:"class not found";
 730                     dumpStackFrame(++frameSerialNum, classSerialNum, m, frame.getBCI());
 731                 }
 732 


< prev index next >