英文文献 科技类 原文及翻译 电子 电气 自动化 通信74Word文件下载.docx

上传人:b****1 文档编号:13542409 上传时间:2022-10-11 格式:DOCX 页数:33 大小:33.70KB
下载 相关 举报
英文文献 科技类 原文及翻译 电子 电气 自动化 通信74Word文件下载.docx_第1页
第1页 / 共33页
英文文献 科技类 原文及翻译 电子 电气 自动化 通信74Word文件下载.docx_第2页
第2页 / 共33页
英文文献 科技类 原文及翻译 电子 电气 自动化 通信74Word文件下载.docx_第3页
第3页 / 共33页
英文文献 科技类 原文及翻译 电子 电气 自动化 通信74Word文件下载.docx_第4页
第4页 / 共33页
英文文献 科技类 原文及翻译 电子 电气 自动化 通信74Word文件下载.docx_第5页
第5页 / 共33页
点击查看更多>>
下载资源
资源描述

英文文献 科技类 原文及翻译 电子 电气 自动化 通信74Word文件下载.docx

《英文文献 科技类 原文及翻译 电子 电气 自动化 通信74Word文件下载.docx》由会员分享,可在线阅读,更多相关《英文文献 科技类 原文及翻译 电子 电气 自动化 通信74Word文件下载.docx(33页珍藏版)》请在冰豆网上搜索。

英文文献 科技类 原文及翻译 电子 电气 自动化 通信74Word文件下载.docx

you,thesoftwaredeveloper,tocreatesoftwareagentsthatcanmonitorandcontrolyourJava

programminglanguageapplications.JVMTIisnewintheJava2SoftwareDevelopmentKit

(SDK),StandardEdition,version1.5.0.ItreplacestheJavaVirtualMachineProfilingInterface

(JVMPI),whichhadbeenincludedasanexperimentalfeatureoftheJava2SDKsinceversion

1.1.JVMTIisdescribedinJSR-163.

ThisarticleillustrateshowtouseJVMTItocreateadebuggingandprofilingtoolforJavaapplications.Suchatool,alsocalledanagent,usesthefunctionalityexposedbytheinterface

toregisterfornotificationofeventsastheyoccurintheapplication,andtoqueryandcontrol

theapplication.JVMTIdocumentationisavailablehere.AJVMTIagentcanbeusefulfordebuggingandtuninganapplication.Itcanillustrateaspectsoftheapplication,suchas

memoryallocation,CPUutilization,andlockcontention.

EventhoughJVMPIisexperimental,itisbeingusedbymanyJavatechnologydevelopers,andin

severalcommercially-availableJavaapplicationprofilers.PleasenotethatdevelopersarestronglyencouragedtouseJVMTIinsteadofJVMPI.JVMPIwillbediscontinuedintheverynearfuture.

JVMTIimprovesuponthefunctionalityandperformanceofJVMPIinmanyways.Forexample:

JVMTIreliesonacallbackforeachevent.ThisismoreefficientthantheJVMPIdesignofusing

eventstructures,whichneededtobemarshalledandunmarshalled.

JVMTIcontainsfourtimesasmanyfunctionsasJVMPI(includingmanymorefunctionsto

obtaininformationaboutvariables,fields,methods,andclasses).ForacompleteindexoftheJVMTI

functions,seetheFunctionIndexpage.

JVMTIprovidesnotificationformoretypesofeventsthandoesJVMPI,includingexception

events,fieldaccessandmodificationevents,andbreakpointandsingle-stepevents.

SomeoftheJVMPIeventsthatwereneverfullyutilized,suchasarenanewanddelete,orthat

canbebetterobtainedthroughbytecodeinstrumentation,ortheJVMTIfunctionsthemselves,(such

asheapdumpandobjectallocation)havebeendropped.Adescriptionoftheeventsisavailableat

theEventIndexpage.

JVMTIiscapability-based,whereasJVMPIwas"

allornothing"

withcorrespondingperformanceimpact.

JVMPIheapfunctionalitydidnotscale.

JVMPIhadnoerrorreturninformation.

JVMPIwasdeeplyinvasiveonVMimplementationswithresultingmaintenanceissuesand

performanceimpacts.

JVMPIisexperimentalandwillbediscontinuedverysoon.

Intheremainderofthisarticle,wepresentasimpleagentthatusesJVMTIfunctionstoextract

informationfromaJavaapplication.Theagentmustbewritteninnativecode.Thesample

agentshownhereiswrittenintheCprogramminglanguage.Youcandownloadthecompletesampleagentcodehere.Thefollowingparagraphsdescribehowanagentisinitialized,and

howtheagentusesJVMTIfunctionstoextractinformationaboutaJavaapplication,aswellas

howtocompileandruntheagent.Thesamplecodeandcompilationstepsarespecificto

UNIXenvironments,butcanbemodifiedforusewithWindows.TheagentdescribedherecanbeusedtoanalyzethethreadsandtodetermineJVMmemoryusageinanyJavaapplication.

AsimpleprogramwrittenintheJavaprogramminglanguage,calledSimpleThread.java,isincludedandcanbedownloadedhere.WeuseThreadSample.javatodemonstratetheexpectedoutputfromtheagent.

ThefunctionalityofJVMTIismuchmoreextensivethanwecandetailhere,butthecode

inthisarticleshouldprovideastartingplacefordevelopingprofilingtoolstomeetyourown

specificneeds.

AgentInitialization

Thissectiondescribesthecodethatisusedtoinitializetheagent.Tobeginwith,theagentmustincludethejvmti.hfilewiththestatement:

#include<

jvmti.h>

.

Inaddition,theagentmustcontainafunctioncalledAgent_OnLoad,whichisinvokedwhenthelibraryisloaded.TheAgent_OnLoadfunctionisusedtosetupfunctionalitythatis

1requiredpriortoinitializingtheJavavirtualmachine(JVM).TheAgent_OnLoadsignaturelookslikethis:

JNIEXPORTjintJNICALLAgent_OnLoad(JavaVM*jvm,char*options,void

*reserved){

...

/*WereturnJNI_OKtosignifysuccess*/

returnJNI_OK;

}

Inoursamplecode,wemustenableseveralcapabilitiesfortheJVMTIfunctionsand

eventsthatwewillbeusing.Itisgenerallydesired,andinsomecasesrequired,toaddthesecapabilitiesintheAgent_OnLoadfunction.Thecapabilitiesnecessaryforeachfunctionor

eventaredescribedintheJavaVirtualMachineToolInterfacepages.Forexample,tousetheInterruptT

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 党团工作 > 入党转正申请

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1