src/share/vm/runtime/java.cpp

Print this page
rev 4773 : 8005849: JEP 167: Event-Based JVM Tracing
Reviewed-by: acorn, coleenp, sla
Contributed-by: Karen Kinnear <karen.kinnear@oracle.com>, Bengt Rutisson <bengt.rutisson@oracle.com>, Calvin Cheung <calvin.cheung@oracle.com>, Erik Gahlin <erik.gahlin@oracle.com>, Erik Helin <erik.helin@oracle.com>, Jesper Wilhelmsson <jesper.wilhelmsson@oracle.com>, Keith McGuigan <keith.mcguigan@oracle.com>, Mattias Tobiasson <mattias.tobiasson@oracle.com>, Markus Gronlund <markus.gronlund@oracle.com>, Mikael Auno <mikael.auno@oracle.com>, Nils Eliasson <nils.eliasson@oracle.com>, Nils Loodin <nils.loodin@oracle.com>, Rickard Backman <rickard.backman@oracle.com>, Staffan Larsen <staffan.larsen@oracle.com>, Stefan Karlsson <stefan.karlsson@oracle.com>, Yekaterina Kantserova <yekaterina.kantserova@oracle.com>
   1 /*
   2  * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *


  43 #include "oops/symbol.hpp"
  44 #include "prims/jvmtiExport.hpp"
  45 #include "runtime/aprofiler.hpp"
  46 #include "runtime/arguments.hpp"
  47 #include "runtime/biasedLocking.hpp"
  48 #include "runtime/compilationPolicy.hpp"
  49 #include "runtime/fprofiler.hpp"
  50 #include "runtime/init.hpp"
  51 #include "runtime/interfaceSupport.hpp"
  52 #include "runtime/java.hpp"
  53 #include "runtime/memprofiler.hpp"
  54 #include "runtime/sharedRuntime.hpp"
  55 #include "runtime/statSampler.hpp"
  56 #include "runtime/task.hpp"
  57 #include "runtime/thread.inline.hpp"
  58 #include "runtime/timer.hpp"
  59 #include "runtime/vm_operations.hpp"
  60 #include "services/memReporter.hpp"
  61 #include "services/memTracker.hpp"
  62 #include "trace/tracing.hpp"
  63 #include "trace/traceEventTypes.hpp"
  64 #include "utilities/dtrace.hpp"
  65 #include "utilities/globalDefinitions.hpp"
  66 #include "utilities/histogram.hpp"
  67 #include "utilities/macros.hpp"
  68 #include "utilities/vmError.hpp"
  69 #ifdef TARGET_ARCH_x86
  70 # include "vm_version_x86.hpp"
  71 #endif
  72 #ifdef TARGET_ARCH_sparc
  73 # include "vm_version_sparc.hpp"
  74 #endif
  75 #ifdef TARGET_ARCH_zero
  76 # include "vm_version_zero.hpp"
  77 #endif
  78 #ifdef TARGET_ARCH_arm
  79 # include "vm_version_arm.hpp"
  80 #endif
  81 #ifdef TARGET_ARCH_ppc
  82 # include "vm_version_ppc.hpp"
  83 #endif


 511   }
 512 
 513 
 514   if (Arguments::has_alloc_profile()) {
 515     HandleMark hm;
 516     // Do one last collection to enumerate all the objects
 517     // allocated since the last one.
 518     Universe::heap()->collect(GCCause::_allocation_profiler);
 519     AllocationProfiler::disengage();
 520     AllocationProfiler::print(0);
 521   }
 522 
 523   if (PrintBytecodeHistogram) {
 524     BytecodeHistogram::print();
 525   }
 526 
 527   if (JvmtiExport::should_post_thread_life()) {
 528     JvmtiExport::post_thread_end(thread);
 529   }
 530 
 531   EVENT_BEGIN(TraceEventThreadEnd, event);
 532   EVENT_COMMIT(event,
 533       EVENT_SET(event, javalangthread, java_lang_Thread::thread_id(thread->threadObj())));



 534 
 535   // Always call even when there are not JVMTI environments yet, since environments
 536   // may be attached late and JVMTI must track phases of VM execution
 537   JvmtiExport::post_vm_death();
 538   Threads::shutdown_vm_agents();
 539 
 540   // Terminate the signal thread
 541   // Note: we don't wait until it actually dies.
 542   os::terminate_signal_thread();
 543 
 544   print_statistics();
 545   Universe::heap()->print_tracing_info();
 546 
 547   { MutexLocker ml(BeforeExit_lock);
 548     _before_exit_status = BEFORE_EXIT_DONE;
 549     BeforeExit_lock->notify_all();
 550   }
 551 
 552   // Shutdown NMT before exit. Otherwise,
 553   // it will run into trouble when system destroys static variables.


   1 /*
   2  * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *


  43 #include "oops/symbol.hpp"
  44 #include "prims/jvmtiExport.hpp"
  45 #include "runtime/aprofiler.hpp"
  46 #include "runtime/arguments.hpp"
  47 #include "runtime/biasedLocking.hpp"
  48 #include "runtime/compilationPolicy.hpp"
  49 #include "runtime/fprofiler.hpp"
  50 #include "runtime/init.hpp"
  51 #include "runtime/interfaceSupport.hpp"
  52 #include "runtime/java.hpp"
  53 #include "runtime/memprofiler.hpp"
  54 #include "runtime/sharedRuntime.hpp"
  55 #include "runtime/statSampler.hpp"
  56 #include "runtime/task.hpp"
  57 #include "runtime/thread.inline.hpp"
  58 #include "runtime/timer.hpp"
  59 #include "runtime/vm_operations.hpp"
  60 #include "services/memReporter.hpp"
  61 #include "services/memTracker.hpp"
  62 #include "trace/tracing.hpp"

  63 #include "utilities/dtrace.hpp"
  64 #include "utilities/globalDefinitions.hpp"
  65 #include "utilities/histogram.hpp"
  66 #include "utilities/macros.hpp"
  67 #include "utilities/vmError.hpp"
  68 #ifdef TARGET_ARCH_x86
  69 # include "vm_version_x86.hpp"
  70 #endif
  71 #ifdef TARGET_ARCH_sparc
  72 # include "vm_version_sparc.hpp"
  73 #endif
  74 #ifdef TARGET_ARCH_zero
  75 # include "vm_version_zero.hpp"
  76 #endif
  77 #ifdef TARGET_ARCH_arm
  78 # include "vm_version_arm.hpp"
  79 #endif
  80 #ifdef TARGET_ARCH_ppc
  81 # include "vm_version_ppc.hpp"
  82 #endif


 510   }
 511 
 512 
 513   if (Arguments::has_alloc_profile()) {
 514     HandleMark hm;
 515     // Do one last collection to enumerate all the objects
 516     // allocated since the last one.
 517     Universe::heap()->collect(GCCause::_allocation_profiler);
 518     AllocationProfiler::disengage();
 519     AllocationProfiler::print(0);
 520   }
 521 
 522   if (PrintBytecodeHistogram) {
 523     BytecodeHistogram::print();
 524   }
 525 
 526   if (JvmtiExport::should_post_thread_life()) {
 527     JvmtiExport::post_thread_end(thread);
 528   }
 529 
 530 
 531   EventThreadEnd event;
 532   if (event.should_commit()) {
 533       event.set_javalangthread(java_lang_Thread::thread_id(thread->threadObj()));
 534       event.commit();
 535   }
 536 
 537   // Always call even when there are not JVMTI environments yet, since environments
 538   // may be attached late and JVMTI must track phases of VM execution
 539   JvmtiExport::post_vm_death();
 540   Threads::shutdown_vm_agents();
 541 
 542   // Terminate the signal thread
 543   // Note: we don't wait until it actually dies.
 544   os::terminate_signal_thread();
 545 
 546   print_statistics();
 547   Universe::heap()->print_tracing_info();
 548 
 549   { MutexLocker ml(BeforeExit_lock);
 550     _before_exit_status = BEFORE_EXIT_DONE;
 551     BeforeExit_lock->notify_all();
 552   }
 553 
 554   // Shutdown NMT before exit. Otherwise,
 555   // it will run into trouble when system destroys static variables.