报表解决方案与OSS性能分析器应用.pptx

JBOSSProfilerPerformanceProfiling

ContentsMotivation–TheproblemProfilingProfilingToolsJavaandProfilingJBossProfilerExample

MotivationMorecomputingsinsarecommittedinthenameofefficiency(withoutnecessarilyachievingit)thanforanyothersinglereason-includingblindstupidity.

--Prof.WilliamA.WulfWeshouldforgetaboutsmallefficiencies,sayabout97%ofthetime:prematureoptimizationistherootofallevil.

--Prof.DonaldE.Knuth

WhatisaprofilerAprogramthathelpsyoufigureoutwhereaprogramisspendingmostofitstime.discoverhowitisusingmemory.howmanyofwhatsortsofobject.

WhatisaprofilertoolToolusedforprogramanalysisprogramanalysisistheuseofspecializedsoftware,calledaprofiler,togatherdataaboutaprogramsexecution.Theprofilerisusedtodeterminehowlongcertainpartsoftheprogramtaketoexecutehowoftentheyareexecutedtogeneratethecallgraph(themathematicalgraphofwhichfunctionscallwhichotherfunctions)

InfluentalProfiler1982Gprof:aCallGraphExecutionProfileraddingastopwatchtoeachfunction(compilewith–pgflagwithgcc,runprogram-gmon.outrungprofprogramanalysesgmon.out)JProbeOptimizeIT2004gprofandappearedonthelistofthe20mostinfluentalPLDI(programminglanguagedesignandimplementation)ofalltime

MethodsofdatagatheringStatisticalprofilersSamplingatimerthreadsuspendsallthreadsperiodically(10ms)looksupthecallstackofeachthreadProc:fastConst:howmanytimeswasthemethodcalled–cantdeduce.InstrumentingProc:canpotentiallybeveryspecificCons:cancausebugsslowsdownthetargetprogram

HowcanIperformanceprofilemyJavacode?[*]java-profMyClassExampleAsimpleclasspublicclassTomer{ publicstaticvoidmain(String[]args){ System.out.println(hithere); }}

RunningtheclasswithprofilerAfilefwascreatedthatcontainsc:\tempjava-profTomerhithereDumpingCPUusageinoldprofformat...done.countcallee

文档评论(0)

1亿VIP精品文档

相关文档