⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 index.html

📁 Eclipse profiler plugin,Profiler 性能跟踪、测量工具
💻 HTML
📖 第 1 页 / 共 2 页
字号:
<html>
    <head>
        <title>Eclipse Profiler Plugin</title>
    </head>
    <body>
        <h1>Eclipse Profiler Plugin</h1>
            <p>
This is a plugin for the Eclipse platform which allows java code profiling.
<a href="http://sourceforge.net/projects/eclipsecolorer">Project</a>
            </p>
            <p>
<h2>License</h2> CPL.
            </p>
<!--        <h2>Limitations</h2>
            <p>
This time the profiler supports Win32 platform only due to native Win32-code used 
in core dynamic-link library.
            </p>-->
        <h2>Win32 installation</h2>
            <p>
Copy ProfilerDLL.dll from root plugin folder into bin folder of your JRE installation.
You can skip this step, plugin will ask you and copy DLL into your JRE\BIN when you
will start profiling local application inside of Eclipse first time. It will also check,
that you have in JRE\BIN same DLL as in plugin directory.
            </p>
        <h2>Linux installation</h2>
            <p>
Profiler has native part compiled with
gcc 3.2, but if you have old gcc or libraries you can build native part yourself. Extract 
files from native\profiler_linux.tgz and look at script "m". This is example of compilation
script. Change it as needed for you OS.<br/>
See also profile_cpu/profile_heap for examples of start line for cpu and
heap profiling and r_cpu/r_heap as example how to use them.
            </p>
        <h2>Usage</h2>
            <p>
Profiler plugin creates additional kind of launch configuration in Run menu. Profiler
tab allows the user to define packages which shouldn't be instrumented, 
thus, all time usage will be referred to calling methods.<br/>
You can specify refresh rate, i.e. how often plugin will read statistics from
prolifing JVM.<br/>
You can also set method, how to get time of enter in method and leave. There are two
methods: fast, but usefull only if you have one active thread, which tries to use all CPU;
or slow, which use JVMPI function GetCurrentThreadCpuTime() and allows detect how much
of CPU was used by thread. However with this method profiled program runs about 3 times slower than
with fast method.
<center>
    <img border="0" src="launch.gif">
    <br><b>Fig. 1. Launch configuration.</b><br>
</center>
            </p>
            <p>
Profiler supports inclusive (grren) and exlusive (red) filters.
You can noy only specify what packages should be excluded from 
instrumentation, but also what packages should be included. Usefull, 
if you want to profile only your own classes. You can move filters up
and down using buttons or drag and drop.
<center>
    <img border="0" src="launch_drag_filter.gif">
    <br><b>Fig. 1.1. Drag filters.</b><br>
</center>
            </p>
            <p>
Plugin allows remote profiling with "Remote Profiler" launch configuration.
Notice, that remote profiling is supported only in "run" mode, i.e. when
you create launch configuration using "Run|Run..." menu item.<br/>
You need to start remote application with special switches like:
java -XrunProfilerDLL -Xbootclasspath/a:jakarta-regexp.jar;profiler_trace.jar;commons-lang.jar -D__PROFILER_PACKAGE_FILTER=__M__sun.;__M__com.sun. -D__PROFILER_USE_PACKAGE_FILTER=1
Here __M__ prefix used for exclusive filter, __P__ can be used for inclusive filter. And you
should use __A__ for class with method "main".
<center>
    <img border="0" src="launch_remote.gif">
    <br><b>Fig. 2. Remote launch configuration.</b><br>
</center>
            </p>
<!-- Tomcat CPU -->
        <h2>Tomcat CPU profiling</h2>
            <p>
Profiler was tested with jakarta-tomcat-4.1.12.
Add after lines in catalina.bat:
<br/>
set _EXECJAVA=%_RUNJAVA%<br/>
set MAINCLASS=org.apache.catalina.startup.Bootstrap<br/>
set ACTION=start<br/>
set SECURITY_POLICY_FILE=<br/>
set DEBUG_OPTS=<br/>
set JPDA=
<br/>
following line:
<br/>
set JAVA_OPTS=-XrunProfilerDLL:1 -Xbootclasspath/a:jakarta-regexp.jar;profiler_trace.jar;commons-lang.jar -D__PROFILER_PACKAGE_FILTER=__A__%MAINCLASS%;__M__sun.;__M__com.sun.;__M__java.;__M__javax.;__M__org.apache. -D__PROFILER_TIMING_METHOD=1
<br/>
Then copy jar's: commons-lang.jar jakarta-regexp.jar profiler_trace.jar to bin directory of tomcat. Now you can start tomcat using startup.bat and it will gather statistics for you.
Next step is configuring Eclipse. You should create remote launch configuration and set host address as needed. This is all. Launch it, plugin will connect to your Tomcat and show you some statistics.
            </p>
<!-- Tomcat HEAP -->
        <h2>Tomcat heap profiling</h2>
            <p>
Profiling heap is almost same as CPU profiling, but you should use following line:
<br/>
set JAVA_OPTS=-XrunProfilerDLL:3,10,0 -D__PROFILER_PROFILE_HEAP=1 -Xbootclasspath/a:jakarta-regexp.jar;profiler_trace.jar;commons-lang.jar -D__PROFILER_PACKAGE_FILTER=__A__%MAINCLASS%;__M__ -D__PROFILER_TIMING_METHOD=1
            </p>
<!-- JBoss -->
        <h2>JBoss profiling</h2>
            <p>
Profiler was tested with jboss-3.0.6_tomcat-4.1.18.
Add following line in your bin/run.bat (directly after echo off):
<br/>
set JAVA_OPTS=-XrunProfilerDLL:1 -Xbootclasspath/a:jakarta-regexp.jar;profiler_trace.jar;commons-lang.jar -D__PROFILER_PACKAGE_FILTER=__A__org.jboss.Main;__M__sun.;__M__com.sun.;__M__java.;__M__javax. -D__PROFILER_TIMING_METHOD=1
<br/>
Then copy jar's: commons-lang.jar jakarta-regexp.jar profiler_trace.jar to bin directory of JBoss. Now you can start JBoss using run.bat and it will gather statistics for you.
Next step is configuring Eclipse. You should create remote launch configuration and set host address as needed. This is all. Launch it, plugin will connect to your JBoss and show you some statistics.
            </p>
<!-- WebLogic -->
        <h2>WebLogic profiling</h2>
            <p>
Profiler was tested with WebLogic 8.1, installed in "c:/bea".
WebLogic has its own JRE's, so you will need to copy ProfilerDLL.dll manually to C:\bea\jdk141_02\jre\bin.
For profiling examples, change file C:\bea\weblogic81\samples\domains\examples\startExamplesServer.cmd, line where
JAVA_OPTIONS is defined:<br>
set JAVA_OPTIONS=-XrunProfilerDLL:1 -Xbootclasspath/a:jakarta-regexp.jar;profiler_trace.jar;commons-lang.jar -D__PROFILER_PACKAGE_FILTER=__A__weblogic.Server;__M__sun.;__M__com.sun.;__M__java.;__M__javax.;__M__weblogic. -D__PROFILER_TIMING_METHOD=1
<br/>
Then copy jar's: commons-lang.jar jakarta-regexp.jar profiler_trace.jar to "C:\bea\weblogic81\samples\domains\examples".
Now you can start WebLogic examplex using startExamplesServer.cmd, or shortcut in Windows menu, and it will gather statistics for you.
Next step is configuring Eclipse. You should create remote launch configuration and set host address as needed. This is all. Launch it, plugin will connect to your WebLogic and show you some statistics.
            </p>
<!-- Resin -->
        <h2>Resin profiling</h2>
            <p>
Profiler was tested with Resin-ee 2.1.10.
Create batch file with following content in "bin":<br/>
httpd.exe -J-XrunProfilerDLL:1 -Xbootclasspath/a:c:/prof/jakarta-regexp.jar;c:/prof/profiler_trace.jar;c:/prof/commons-lang.jar -D__PROFILER_PACKAGE_FILTER=__A__com.caucho.server.http.HttpServer;__M__sun.;__M__com.sun.;__M__java.;__M__javax. -D__PROFILER_TIMING_METHOD=1
<br/>
Then create directory "prof" in disc "C" and copy jar's: commons-lang.jar jakarta-regexp.jar profiler_trace.jar.
Now you can start your batch file and it will gather statistics for you.
Next step is configuring Eclipse. You should create remote launch configuration and set host address as needed. This is all. Launch it, plugin will connect to your Resin and show you some statistics.
            </p>

<!-- CPU -->
        <h2>Options</h2>
            <p>
Profiler supports several options via -DXXX.
            </p>
<table border="1">
	<tr>
		<th>Options</th>
		<th>Description</th>
	</tr>
	<tr>
		<td>__PROFILER_PACKAGE_FILTER</td>
		<td>Contains list of packages to include or exclude.<br/>
		    Here __P__ - inclusive pattern, __M__ - exclusive pattern.<br/>
		    And __A__ - application start class.<br/>
		    Examples:<br/>
		    Include only ru.* and de.* packages: __P__ru.;__P__de.<br/>
		    Exclude system packages: __A__org.jboss.Main;__M__sun.;__M__com.sun.;__M__java.;__M__javax.<br/>
		    If at least one inclusive pattern used, only classes accepted by inclusive patterns will be instrumented.
		</td>
	</tr>
	<tr>
		<td>__PROFILER_TIMING_METHOD</td>
		<td>Specifies timing method - how to measure elapsed time.<br/>
		    0 - fast, System.currentTimeMillis(), good for application without sleeps and waits.<br/>
		    1 - precise, thread aware, slow, good for multithreaded applications.<br/>
		    2 - sampling profiling, very fast, good for long runned processes.<br/>
		</td>
	</tr>
	<tr>
		<td>__PROFILER_PROFILE_HEAP</td>
		<td>1, if HEAP profiling should be used.<br/>
		</td>
	</tr>
	<tr>
		<td>__PROFILER_AUTO_START</td>
		<td>0 - don't start automatically.<br/>
		    1 (default) - start automatically.<br/>
		</td>
	</tr>
	<tr>
		<td>__PROFILER_START_ON_METHOD</td>
		<td>Start method name. When applications tries to enter in this method profiling starts (see __PROFILER_AUTO_START, it should be 0).<br/>
		    Example: -D__PROFILER_START_ON_METHOD=ru.nlmk.train.Main.mainLoop<br/>
		</td>
	</tr>
	<tr>
		<td>__PROFILER_PAUSE_ON_METHOD</td>
		<td>1, if you need pause profiling when __PROFILER_START_ON_METHOD leaved.<br/>
		</td>
	</tr>
	<tr>
		<td>__PROFILER_INSTRUMENT_SYSTEM_CLASSES</td>
		<td>1, if you need instrument additional system classes, like java.lang.String, etc. Expensive!<br/>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -