绾跨▼銆佸唴瀛樺爢/鏍堛€佺被/鏂规硶/鍙橀噺銆佷簨浠?瀹氭椂鍣ㄥ鐞嗐€佷唬鐮佽皟"/>

Java鍗冪櫨闂甠08JDK璇﹁В锛?15锛塤JVMTI鎻愪緵鍝簺鍔熻兘

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Java鍗冪櫨闂甠08JDK璇﹁В锛?15锛塤JVMTI鎻愪緵鍝簺鍔熻兘相关的知识,希望对你有一定的参考价值。

鏍囩锛?/p>

鐐瑰嚮杩涘叆_鏇村_Java鍗冪櫨闂?/a>

1銆丣VMTI鎻愪緵鍝簺鍔熻兘

浜嗚ВJVMTI鐪嬭繖閲岋細JVMTI鏄粈涔?/a>
缂栧啓JVMTI绋嬪簭鐪嬭繖閲岋細
濡備綍缂栧啓JVMTI agent绋嬪簭
JVMTI 鐨勫姛鑳介潪甯镐赴瀵岋紝鍖呭惈浜嗚櫄鎷熸満涓?font color="#ff0000">绾跨▼銆佸唴瀛樺爢/鏍堛€佺被/鏂规硶/鍙橀噺銆佷簨浠?瀹氭椂鍣ㄥ鐞嗐€佷唬鐮佽皟璇?/font>绛夊绉嶅姛鑳斤紝杩欓噷鎴戜滑浠嬬粛涓€浜涘父鐢ㄧ殑鍔熻兘銆?/p>

璋冭瘯鍔熻兘

璋冭瘯鍔熻兘鏄疛VMTI鐨勫熀鏈姛鑳戒箣涓€锛岃繖涓昏鍖呮嫭浜?font color="#ff0000">璁剧疆鏂偣銆佽皟璇?/font>绛夛紝鍦↗VMTI閲岄潰锛岃缃柇鐐圭殑API鏈韩寰堢畝鍗曪細

jvmtiError SetBreakpoint(jvmtiEnv* env, jmethodID method, jlocation location)

jlocation杩欎釜鏁版嵁缁撴瀯鍦ㄨ繖閲屼唬琛ㄧ殑鏄搴旀柟娉曟柟娉曚腑涓€涓?font color="#ff0000">鍙墽琛屼唬鐮佺殑琛屾暟銆傚湪鏂偣鍙戠敓鐨勬椂鍊欙紝铏氭嫙鏈轰細瑙﹀彂涓€涓?font color="#ff0000">浜嬩欢锛屾垜浠彲浠ヤ娇鐢ㄥ湪涓婃枃涓粙缁嶈繃鐨勬柟寮忓浜嬩欢杩涜澶勭悊銆?/p>

浜嬩欢澶勭悊鍜屽洖璋冨嚱鏁?/font>

浣跨敤JVMTI涓€涓熀鏈殑鏂瑰紡灏辨槸璁剧疆鍥炶皟鍑芥暟锛屽湪鏌愪簺浜嬩欢鍙戠敓鐨勬椂鍊欒Е鍙戝苟浣滃嚭鐩稿簲鐨勫姩浣溿€?
鍥犳杩欎竴閮ㄥ垎鐨勫姛鑳介潪甯稿熀鏈紝鍥炶皟浜嬩欢鍖呮嫭铏氭嫙鏈哄垵濮嬪寲/寮€濮嬭繍琛?缁撴潫銆佺被鐨勫姞杞姐€佹柟娉曞嚭鍏ャ€佺嚎绋嬪鏈?/font>绛夌瓑銆傚鏋滄兂瀵规煇浜涗簨浠惰繘琛屽鐞嗭紝鎴戜滑棣栦负璇ヤ簨浠跺啓涓€涓嚱鏁帮紝鐒跺悗鍦?font color="#ff0000">jvmtiEventCallbacks杩欎釜缁撴瀯涓寚瀹氱浉搴旂殑鍑芥暟鎸囬拡銆?/p>

姣斿锛屾垜浠绾跨▼鍚姩鎰熷叴瓒o紝骞跺啓浜嗕竴涓狧andleThreadStart鍑芥暟锛岄偅涔堟垜浠渶瑕佸湪Agent_OnLoad鍑芥暟閲屽姞鍏ワ細

jvmtiEventCallbacks eventCallBacks;
memset(&ecbs, 0, sizeof(ecbs)); // 鍒濆鍖?/span>
eventCallBacks.ThreadStart = &HandleThreadStart; // 璁剧疆鍑芥暟鎸囬拡
jvmti->SetEventCallbacks(eventCallBacks, sizeof(eventCallBacks));

鍦ㄨ櫄鎷熸満杩愯杩囩▼涓紝涓€鏃︽湁绾跨▼寮€濮嬶紝铏氭嫙鏈哄氨浼氬洖璋僅andleThreadStart鏂规硶銆?/p>

璁剧疆鍥炶皟鍑芥暟鐨勬椂鍊欙紝闇€瑕佹敞鎰忥細铏氭嫙鏈?font color="#ff0000">涓嶄繚璇佸洖璋冨嚱鏁板悓姝?/font>锛屾瘮濡傦紝濂藉嚑涓嚎绋嬪悓鏃跺紑濮嬭繍琛屼簡锛岃繖涓狧andleThreadStart灏变細琚悓鏃惰皟鐢ㄥ嚑娆?

鍐呭瓨鎺у埗鍜屽璞¤幏鍙?/font>

鍐呭瓨鎺у埗鏄竴鍒囪繍琛屾€佺殑鍩烘湰鍔熻兘銆?JVMTI闄や簡鎻愪緵鏈€绠€鍗曠殑鍐呭瓨鐢宠鍜屾挙閿€涔嬪锛堣繖鍧楀唴瀛樹笉鍙?Java 鍫嗙鐞嗭紝闇€瑕佽嚜琛岃繘琛屾竻鐞嗗伐浣滐紝涓嶇劧浼氶€犳垚鍐呭瓨娉勬紡锛夛紝涔熸彁渚涗簡瀵笿ava鍫嗙殑鎿嶄綔銆備紬鎵€鍛ㄧ煡锛孞ava鍫嗕腑瀛樺偍浜咼ava鐨勫璞★紝閫氳繃瀵瑰爢鐨勬搷浣滐紝鍙互寰堝鏄撶殑鏌ユ壘浠绘剰鐨勫璞★紝杩樺彲浠?font color="#ff0000">寮鸿鎵ц鍨冨溇鏀堕泦宸ヤ綔銆?

JVMTI涓病鏈夋彁渚涗竴涓洿鎺ヨ幏鍙栫殑鏂瑰紡锛岃€屾槸浣跨敤涓€涓?font color="#ff0000">杩唬鍣紙iterater锛?/font>鐨勬柟寮忛亶鍘嗭紝鐢辨鍙锛岃櫄鎷熸満瀵瑰璞$殑绠$悊骞堕潪鏄搱甯岃〃锛岃€屾槸鏌愮鏍?鍥?/font>鏂瑰紡锛?/p>

jvmtiError FollowReferences(jvmtiEnv* env,
    jint heap_filter,
    jclass klass,
    jobject initial_object,// 璇ユ柟寮忓彲浠ユ寚瀹氭牴鑺傜偣
    const jvmtiHeapCallbacks* callbacks,// 璁剧疆鍥炶皟鍑芥暟
    const void* user_data)

鎴栬€?/p>

jvmtiError IterateThroughHeap(jvmtiEnv* env,
    jint heap_filter,
    jclass klass,
    const jvmtiHeapCallbacks* callbacks,
    const void* user_data)// 閬嶅巻鏁翠釜 heap

鍦ㄩ亶鍘嗙殑杩囩▼涓紝鎴戜滑鍙互璁惧畾涓€瀹氱殑鏉′欢锛屼緥濡傛寚瀹氭煇涓€涓被鐨勫璞★紝骞惰缃竴涓洖璋冨嚱鏁帮紝濡傛灉鏉′欢琚弧瓒筹紝鍥炶皟鍑芥暟灏变細琚墽琛屻€傝繕鍙互鍦ㄥ洖璋冨嚱鏁颁腑瀵瑰綋鍓嶄紶鍥炵殑鎸囬拡杩涜鎵撴爣璁帮紙tag锛?/font>鎿嶄綔锛屽湪閬嶅巻涓紝鍙兘瀵规弧瓒虫潯浠剁殑瀵硅薄杩涜tag锛岀劧鍚庡啀浣跨敤GetObjectsWithTags鍑芥暟鑾峰彇闇€瑕佺殑瀵硅薄銆傚涓嬶細

jvmtiError GetObjectsWithTags(jvmtiEnv* env,
    jint tag_count,
    const jlong* tags, // 璁惧畾鐗瑰畾鐨?tag锛屽嵆鎴戜滑涓婇潰鎵€璁剧疆鐨?/span>
    jint* count_ptr,
    jobject** object_result_ptr,
    jlong** tag_result_ptr)

濡傛灉浣犱粎浠呮兂瀵圭壒瀹欽ava瀵硅薄鎿嶄綔锛屽簲璇ラ伩鍏嶈缃叾浠栫被鍨嬬殑鍥炶皟鍑芥暟锛屽惁鍒欎細褰卞搷鏁堢巼銆傚澧炲姞涓€涓猵rimitive鐨勫洖璋冨嚱鏁帮紝鍙兘浼氫娇鏁翠釜鎿嶄綔鏁堢巼涓嬮檷涓€涓暟閲忕骇銆?/p>

绾跨▼鍜岄攣

鍦↗VMTI涓篃鎻愪緵浜嗗緢澶欰PI杩涜绾跨▼鐨勬搷浣滐紝鍖呮嫭鏌ヨ褰撳墠绾跨▼鐘舵€併€佹殏鍋溿€佹仮澶嶆垨鑰呯粓绔嚎绋?/font>锛岃繕鍙互瀵圭嚎绋嬮攣杩涜鎿嶄綔銆傛垜浠彲浠ヨ幏寰楃壒瀹氱嚎绋嬫墍鎷ユ湁鐨勯攣锛?/p>

jvmtiError GetOwnedMonitorInfo(jvmtiEnv* env,
    jthread thread,
    jint* owned_monitor_count_ptr,
    jobject** owned_monitors_ptr)

涔熷彲浠ヨ幏寰楀綋鍓嶇嚎绋嬫鍦ㄧ瓑寰呯殑閿侊細

jvmtiError GetCurrentContendedMonitor(jvmtiEnv* env,
    jthread thread,
    jobject* monitor_ptr)

鎴戜滑鍙互閫氳繃浠ヤ笂鎺ュ彛璁捐鑷繁鐨勭畻娉曟潵鍒ゆ柇鏄惁姝婚攣銆?/p>

JVMTI杩樻彁渚涗簡涓€绯诲垪鐨?font color="#ff0000">鐩戣鍣紙Monitor锛?/font>鎿嶄綔锛屾潵甯姪鎴戜滑鍦╪ative鐜涓疄鐜板悓姝ワ紝涓昏鐨勬搷浣滄槸鏋勫缓鐩戣鍣紙CreateRawMonitor锛夛紝鑾峰彇鐩戣鍣紙RawMonitorEnter锛夛紝閲婃斁鐩戣鍣紙RawMonitorExit锛夛紝绛夊緟鍜屽敜閱掔洃瑙嗗櫒 (RawMonitorWait,RawMonitorNotify) 绛夋搷浣滐紝閫氳繃杩欎簺绠€鍗曢攣锛岀▼搴忕殑鍚屾鎿嶄綔鍙互寰楀埌淇濊瘉銆?/p>

以上是关于Java鍗冪櫨闂甠08JDK璇﹁В锛?15锛塤JVMTI鎻愪緵鍝簺鍔熻兘的主要内容,如果未能解决你的问题,请参考以下文章

ConuntDownLatch璇﹁В

wsdl璇﹁В

property璇﹁В

mysql浜嬪姟闅旂绾у埆/鑴忚/涓嶅彲閲嶅璇?骞昏璇﹁В

閫氳繃`RestTemplate`涓婁紶鏂囦欢(InputStreamResource璇﹁В)

璇﹁ВPython涓殑鍚勭杞箟绗n

(c)2006-2024 SYSTEM All Rights Reserved IT常识