國(guó)際物流云商系統(tǒng)day_第1頁(yè)
國(guó)際物流云商系統(tǒng)day_第2頁(yè)
國(guó)際物流云商系統(tǒng)day_第3頁(yè)
國(guó)際物流云商系統(tǒng)day_第4頁(yè)
國(guó)際物流云商系統(tǒng)day_第5頁(yè)
已閱讀5頁(yè),還剩31頁(yè)未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡(jiǎn)介

1、JBOSS ProfilerPerformance ProfilingContentsMotivation The problemProfilingProfiling ToolsJava and ProfilingJBoss ProfilerExampleMotivationMore computing sins are committed in the name of efficiency (without necessarily achieving it) than for any other single reason - including blind stupidity. - Pro

2、f. William A. WulfWe should forget about small efficiencies, say about 97% of the time: premature optimization is the root of all evil. - Prof. Donald E. Knuth What is a profilerA program that helps you figure out where a program is spending most of its time. discover how it is using memory.how many

3、 of what sorts of object.What is a profiler toolTool used for program analysisprogram analysis is the use of specialized software, called a profiler, to gather data about a programs execution.The profiler is used to determine how long certain parts of the program take to executehow often they are ex

4、ecutedto generate the call graph (the mathematical graph of which functions call which other functions)Influental Profiler1982 Gprof: a Call Graph Execution Profileradding a stopwatch to each function (compile with pg flag with gcc, run program - gmon.out run gprof program analyses gmon.out)JProbeOp

5、timizeIT2004 gprof and appeared on the list of the 20 most influental PLDI (programming language design and implementation) of all timeMethods of data gatheringStatistical profilersSamplinga timer thread suspends all threads periodically (10ms)looks up the call stack of each threadProc: fastConst: h

6、ow many times was the method called cant deduce.InstrumentingProc: can potentially be very specificCons: can cause bugsslows down the target programHow can I performance profile my Java code?*java -prof MyClassExample A simple classpublic class Tomer public static void main(String args) System.out.p

7、rintln(hi there);Running the class with profilerA file f was created that containsc:tempjava -prof Tomerhi thereDumping CPU usage in old prof format . done.count callee caller time1032 java.lang.Math.max(II)I java.util.jar.JarFile.hasClassPathAttribute()Z 16729 java.lang.AbstractStringBuilde

8、r.append(C)Ljava/lang/AbstractStringBuilder; java.lang.StringBuffer.append(C)Ljava/lang/StringBuffer; 0506 java.io.Win32FileSystem.isSlash(C)Z java.io.Win32FileSystem.normalize(Ljava/lang/String;II)Ljava/lang/String; 0506 java.lang.String.charAt(I)C JVMPIJava Virtual Machine Profiler Interfacea two-

9、way function call interface between the Java virtual machine and an in-process profiler agentJVMPIjava -Xrunmyprofiler:heapdump=on,file=log.txt ToBeProfiledClassJVMPI Events * method enter and exit * object alloc, move, and free * heap arena create and delete * GC start and finish * JNI global refer

10、ence alloc and free * JNI weak global reference alloc and free * compiled method load and unloadshutdown JVMPI Events * thread start and end * class file data ready for instrumentation * class load and unload * contended Java monitor wait to enter , entered, and exit * contended raw monitor wait to

11、enter, entered, and exit * Java monitor wait and waitedJVMPI Events * monitor dump * heap dump * object dump * request to dump or reset profiling data * Java virtual machine initialization and ProfilersJprobe profilerOptimizeitCodeWarrior (IDE that has a profiler in it)JprofJinsightHpJMeterNumega an

12、d many moreHPROF SUNs JVM has a default implementation of JVMPI named HPROFHPROF is actually a JVM native agent library which is dynamically loaded through a command line option, at JVM startup, and es part of the JVM process. By supplying HPROF options at startup, users can request various types of

13、 heap and/or cpu profiling features from HPROF. The data generated can be in textual or binary format, and can be used to track down and isolate performance problems involving memory usage and inefficient code. The binary format file from HPROF can be used with tools such as HAT to browse the alloca

14、ted objects in the heap.Command used: javac -J-Xrunhprof:cpu=samples foo.java .HPROFCommand used: javac -J-Xrunhprof:cpu=samples foo.java .CPU SAMPLES BEGIN (total = 252378) Wed Oct 07 13:30:10 1998rank self accum count trace method 1 4.96% 4.96% 12514 303 sun/io/ByteToCharSingleByte.convert 2 3.18%

15、 8.14% 8022 306 java/lang/String.charAt 3 1.91% 10.05% 4828 301 sun/tools/java/ScannerInputReader. 4 1.80% 11.85% 4545 305 sun/io/ByteToCharSingleByte.getUnicode 5 1.50% 13.35% 3783 304 sun/io/ByteToCharSingleByte.getUnicode 6 1.30% 14.65% 3280 336 sun/tools/java/ScannerInputReader.read 7 1.13% 15.7

16、8% 2864 404 sun/io/ByteToCharSingleByte.convert 8 1.11% 16.89% 2800 307 java/lang/String.length 9 1.00% 17.89% 2516 4028 java/lang/Integer.toString 10 0.95% 18.84% 2403 162 java/lang/System.arraycopy.CPU SAMPLES ENDJVMPI Simple ImplGet the current thread cpu time with JVMPI#include / global jvmpi in

17、terface pointerstatic JVMPI_Interface *jvmpi_interface;extern C / profiler agent entry point JNIEXPORT jint JNICALL JVM_OnLoad(JavaVM *jvm, char *options, void *reserved) / get jvmpi interface pointer if (jvm-GetEnv(void *)&jvmpi_interface, JVMPI_VERSION_1) GetCurrentThreadCpuTime(); package dk.capg

18、emini.tc;public class JProf public static native long getCurrentThreadCpuTime();static System.loadLibrary(capjprof); JBOSS ProfilerIts based on a JVMPI agent written in Ccaptures the events from the JVM into binary log filesweb-application that analyzes thatJBoss-profiler its easier to configure tha

19、n most existing profilersJboss Profiler FeaturesYou can setup triggers for starting the data-event capturing Regular exclusion filters Find which objects still are alived Featuresmethod entry/exit (CPU and Time) object-alloc thread start/end class loading object-release InterceptorsJVMPI (which is b

20、eing converted to JVMTI) AOP we can focus excatly on what we need and instrumentate only the classes we would need to analyzeGetting Data into Production Environmentssleep mode select events for a finite number of methods Front-endsWEB application developing an ant integration which will generate re

21、ports that will extend functionality on JUnitInstallationNot a final moduleDownload it from CVS / SourceforgeCurrent version 1.0.0 published in february 05How it worksConfigure the parametersProfiler will stays sleeping until you send a weak-up signalAfter it starts, everything will be sent to .log.

22、gz filesAfter youve finished your test-case, you can send a stop signalusing the same method you used to send the weak-up signalHow it worksThe wake-up and stop signalkill -3 ctrl-break on windowsprofilerConsole that connects to its engine using a socketMbean Analyzing the datajboss-profiler.war ana

23、lyze your .log.gz. InstallationUnzip the jboss-profiler.tar.gzSee readme.txtWindows: put jbossInspector.dll in your PATHPOSIX: libjbossInspector.so in your LD_LIBRARY_PATHDeploy jboss-profiler.war (front-end for analysis)JBoss Profiler Getting Deep process information about applications after the application raninterceptor written in C that use JVM

溫馨提示

  • 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。

最新文檔

評(píng)論

0/150

提交評(píng)論