comparison src/share/vm/runtime/vmThread.cpp @ 10405:f2110083203d

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>
author sla
date Mon, 10 Jun 2013 11:30:51 +0200
parents b06ac540229e
children e6195383bcaf be0ac0e8f6e7 21dd1c827123
comparison
equal deleted inserted replaced
10404:d0add7016434 10405:f2110083203d
33 #include "runtime/os.hpp" 33 #include "runtime/os.hpp"
34 #include "runtime/thread.inline.hpp" 34 #include "runtime/thread.inline.hpp"
35 #include "runtime/vmThread.hpp" 35 #include "runtime/vmThread.hpp"
36 #include "runtime/vm_operations.hpp" 36 #include "runtime/vm_operations.hpp"
37 #include "services/runtimeService.hpp" 37 #include "services/runtimeService.hpp"
38 #include "trace/tracing.hpp"
38 #include "utilities/dtrace.hpp" 39 #include "utilities/dtrace.hpp"
39 #include "utilities/events.hpp" 40 #include "utilities/events.hpp"
40 #include "utilities/xmlstream.hpp" 41 #include "utilities/xmlstream.hpp"
41 42
42 #ifndef USDT2 43 #ifndef USDT2
363 #else /* USDT2 */ 364 #else /* USDT2 */
364 HOTSPOT_VMOPS_BEGIN( 365 HOTSPOT_VMOPS_BEGIN(
365 (char *) op->name(), strlen(op->name()), 366 (char *) op->name(), strlen(op->name()),
366 op->evaluation_mode()); 367 op->evaluation_mode());
367 #endif /* USDT2 */ 368 #endif /* USDT2 */
369
370 EventExecuteVMOperation event;
371
368 op->evaluate(); 372 op->evaluate();
373
374 if (event.should_commit()) {
375 bool is_concurrent = op->evaluate_concurrently();
376 event.set_operation(op->type());
377 event.set_safepoint(op->evaluate_at_safepoint());
378 event.set_blocking(!is_concurrent);
379 // Only write caller thread information for non-concurrent vm operations.
380 // For concurrent vm operations, the thread id is set to 0 indicating thread is unknown.
381 // This is because the caller thread could have exited already.
382 event.set_caller(is_concurrent ? 0 : op->calling_thread()->osthread()->thread_id());
383 event.commit();
384 }
385
369 #ifndef USDT2 386 #ifndef USDT2
370 HS_DTRACE_PROBE3(hotspot, vmops__end, op->name(), strlen(op->name()), 387 HS_DTRACE_PROBE3(hotspot, vmops__end, op->name(), strlen(op->name()),
371 op->evaluation_mode()); 388 op->evaluation_mode());
372 #else /* USDT2 */ 389 #else /* USDT2 */
373 HOTSPOT_VMOPS_END( 390 HOTSPOT_VMOPS_END(
599 // VMOperationQueue_lock, so we can block without a safepoint check. This allows vm operation requests 616 // VMOperationQueue_lock, so we can block without a safepoint check. This allows vm operation requests
600 // to be queued up during a safepoint synchronization. 617 // to be queued up during a safepoint synchronization.
601 { 618 {
602 VMOperationQueue_lock->lock_without_safepoint_check(); 619 VMOperationQueue_lock->lock_without_safepoint_check();
603 bool ok = _vm_queue->add(op); 620 bool ok = _vm_queue->add(op);
604 op->set_timestamp(os::javaTimeMillis()); 621 op->set_timestamp(os::javaTimeMillis());
605 VMOperationQueue_lock->notify(); 622 VMOperationQueue_lock->notify();
606 VMOperationQueue_lock->unlock(); 623 VMOperationQueue_lock->unlock();
607 // VM_Operation got skipped 624 // VM_Operation got skipped
608 if (!ok) { 625 if (!ok) {
609 assert(concurrent, "can only skip concurrent tasks"); 626 assert(concurrent, "can only skip concurrent tasks");