--- old/src/share/vm/runtime/vmThread.cpp 2016-10-25 10:40:12.375779643 +0200 +++ new/src/share/vm/runtime/vmThread.cpp 2016-10-25 10:40:12.328779612 +0200 @@ -36,6 +36,7 @@ #include "runtime/vm_operations.hpp" #include "services/runtimeService.hpp" #include "trace/tracing.hpp" +#include "evtrace/traceEvents.hpp" #include "utilities/dtrace.hpp" #include "utilities/events.hpp" #include "utilities/xmlstream.hpp" @@ -272,6 +273,10 @@ // possible to set the VM thread priority higher than any Java thread. os::set_native_priority( this, prio ); + if (EnableEventTracing) { + TraceEvents::write_thread_start(); + } + // Wait for VM_Operations until termination this->loop(); @@ -458,11 +463,20 @@ // 'GuaranteedSafepointInterval' milliseconds. This will run all // the clean-up processing that needs to be done regularly at a // safepoint + + if (EnableEventTracing) { + TraceEvents::write_safepoint_begin(TraceTypes::safepoint_periodic); + } + SafepointSynchronize::begin(); #ifdef ASSERT if (GCALotAtAllSafepoints) InterfaceSupport::check_gc_alot(); #endif SafepointSynchronize::end(); + + if (EnableEventTracing) { + TraceEvents::write_safepoint_end(0); + } } _cur_vm_operation = _vm_queue->remove_next(); @@ -498,6 +512,11 @@ _vm_queue->set_drain_list(safepoint_ops); // ensure ops can be scanned + if (EnableEventTracing) { + TraceEvents::write_safepoint_begin(TraceTypes::safepoint_for_vm_op); + } + + int vm_ops_evaluated = 1; SafepointSynchronize::begin(); evaluate_operation(_cur_vm_operation); // now process all queued safepoint ops, iteratively draining @@ -515,6 +534,7 @@ if (PrintSafepointStatistics) { SafepointSynchronize::inc_vmop_coalesced_count(); } + vm_ops_evaluated++; } while (_cur_vm_operation != NULL); } // There is a chance that a thread enqueued a safepoint op @@ -542,6 +562,10 @@ // Complete safepoint synchronization SafepointSynchronize::end(); + if (EnableEventTracing) { + TraceEvents::write_safepoint_end((u4) vm_ops_evaluated); + } + } else { // not a safepoint operation if (TraceLongCompiles) { elapsedTimer t; @@ -578,9 +602,17 @@ long interval = SafepointSynchronize::last_non_safepoint_interval(); bool max_time_exceeded = GuaranteedSafepointInterval != 0 && (interval > GuaranteedSafepointInterval); if (SafepointALot || max_time_exceeded) { + if (EnableEventTracing) { + TraceEvents::write_safepoint_begin(TraceTypes::safepoint_periodic); + } + HandleMark hm(VMThread::vm_thread()); SafepointSynchronize::begin(); SafepointSynchronize::end(); + + if (EnableEventTracing) { + TraceEvents::write_safepoint_end(0); + } } } } @@ -667,9 +699,17 @@ _cur_vm_operation = op; if (op->evaluate_at_safepoint() && !SafepointSynchronize::is_at_safepoint()) { + if (EnableEventTracing) { + TraceEvents::write_safepoint_begin(TraceTypes::safepoint_for_vm_op); + } + SafepointSynchronize::begin(); op->evaluate(); SafepointSynchronize::end(); + + if (EnableEventTracing) { + TraceEvents::write_safepoint_end(1); + } } else { op->evaluate(); }