comparison src/share/vm/prims/jvm.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 6bd680e9ea35
children 836a62f43af9 ac91879aa56f 3a0774193f71
comparison
equal deleted inserted replaced
10404:d0add7016434 10405:f2110083203d
57 #include "runtime/vframe.hpp" 57 #include "runtime/vframe.hpp"
58 #include "runtime/vm_operations.hpp" 58 #include "runtime/vm_operations.hpp"
59 #include "services/attachListener.hpp" 59 #include "services/attachListener.hpp"
60 #include "services/management.hpp" 60 #include "services/management.hpp"
61 #include "services/threadService.hpp" 61 #include "services/threadService.hpp"
62 #include "trace/tracing.hpp"
62 #include "utilities/copy.hpp" 63 #include "utilities/copy.hpp"
63 #include "utilities/defaultStream.hpp" 64 #include "utilities/defaultStream.hpp"
64 #include "utilities/dtrace.hpp" 65 #include "utilities/dtrace.hpp"
65 #include "utilities/events.hpp" 66 #include "utilities/events.hpp"
66 #include "utilities/histogram.hpp" 67 #include "utilities/histogram.hpp"
2997 #else /* USDT2 */ 2998 #else /* USDT2 */
2998 HOTSPOT_THREAD_SLEEP_BEGIN( 2999 HOTSPOT_THREAD_SLEEP_BEGIN(
2999 millis); 3000 millis);
3000 #endif /* USDT2 */ 3001 #endif /* USDT2 */
3001 3002
3003 EventThreadSleep event;
3004
3002 if (millis == 0) { 3005 if (millis == 0) {
3003 // When ConvertSleepToYield is on, this matches the classic VM implementation of 3006 // When ConvertSleepToYield is on, this matches the classic VM implementation of
3004 // JVM_Sleep. Critical for similar threading behaviour (Win32) 3007 // JVM_Sleep. Critical for similar threading behaviour (Win32)
3005 // It appears that in certain GUI contexts, it may be beneficial to do a short sleep 3008 // It appears that in certain GUI contexts, it may be beneficial to do a short sleep
3006 // for SOLARIS 3009 // for SOLARIS
3017 thread->osthread()->set_state(SLEEPING); 3020 thread->osthread()->set_state(SLEEPING);
3018 if (os::sleep(thread, millis, true) == OS_INTRPT) { 3021 if (os::sleep(thread, millis, true) == OS_INTRPT) {
3019 // An asynchronous exception (e.g., ThreadDeathException) could have been thrown on 3022 // An asynchronous exception (e.g., ThreadDeathException) could have been thrown on
3020 // us while we were sleeping. We do not overwrite those. 3023 // us while we were sleeping. We do not overwrite those.
3021 if (!HAS_PENDING_EXCEPTION) { 3024 if (!HAS_PENDING_EXCEPTION) {
3025 if (event.should_commit()) {
3026 event.set_time(millis);
3027 event.commit();
3028 }
3022 #ifndef USDT2 3029 #ifndef USDT2
3023 HS_DTRACE_PROBE1(hotspot, thread__sleep__end,1); 3030 HS_DTRACE_PROBE1(hotspot, thread__sleep__end,1);
3024 #else /* USDT2 */ 3031 #else /* USDT2 */
3025 HOTSPOT_THREAD_SLEEP_END( 3032 HOTSPOT_THREAD_SLEEP_END(
3026 1); 3033 1);
3029 // to properly restore the thread state. That's likely wrong. 3036 // to properly restore the thread state. That's likely wrong.
3030 THROW_MSG(vmSymbols::java_lang_InterruptedException(), "sleep interrupted"); 3037 THROW_MSG(vmSymbols::java_lang_InterruptedException(), "sleep interrupted");
3031 } 3038 }
3032 } 3039 }
3033 thread->osthread()->set_state(old_state); 3040 thread->osthread()->set_state(old_state);
3041 }
3042 if (event.should_commit()) {
3043 event.set_time(millis);
3044 event.commit();
3034 } 3045 }
3035 #ifndef USDT2 3046 #ifndef USDT2
3036 HS_DTRACE_PROBE1(hotspot, thread__sleep__end,0); 3047 HS_DTRACE_PROBE1(hotspot, thread__sleep__end,0);
3037 #else /* USDT2 */ 3048 #else /* USDT2 */
3038 HOTSPOT_THREAD_SLEEP_END( 3049 HOTSPOT_THREAD_SLEEP_END(