调试 Eclipse 性能问题

Debugging Eclipse performance problems

为了调试 Eclipse 性能问题,我创建了这个 .options 文件:

org.eclipse.jdt.ui/debug=true
org.eclipse.jdt.launching/debug = true
org.eclipse.jdt.launching/debug/classpath/jreContainer = true

# trace generation of type constraints and create toString info for debugging
org.eclipse.jdt.ui/debug/TypeConstraints=false

# timing output for code assist
org.eclipse.jdt.ui/debug/ResultCollector=false

org.eclipse.jdt.debug/debug=false
org.eclipse.jdt.debug/debug/jdiEvents=false
org.eclipse.jdt.debug/debug/jdiRequestTimes=false
org.eclipse.jdt.debug/debug/astEvaluations=false
org.eclipse.jdt.debug/debug/astEvaluations/callingThreads=false

# Turn on debug tracing for org.eclipse.jdt.core plugin
org.eclipse.jdt.core/debug=true

# Reports java  builder activity : nature of build, built state reading, indictment process
org.eclipse.jdt.core/debug/builder=true

# Reports java builder stats
org.eclipse.jdt.core/debug/builder/stats=true

# Reports compiler activity
org.eclipse.jdt.core/debug/compiler=true

# Turn on debugging for the org.eclipse.core.resources plugin.
org.eclipse.core.resources/debug=true

# Reports the start and end of all builder invocations
org.eclipse.core.resources/build/invoking=true

# Reports the start and end of build delta calculations
org.eclipse.core.resources/build/delta=true

# For incremental builds, displays which builder is being run and 
because of changes in which project.
org.eclipse.core.resources/build/needbuild=true

# Prints a stack trace every time an operation finishes that requires a 
build
org.eclipse.core.resources/build/needbuildstack=true

该文件与 eclipse.ini 在同一文件夹中。

当我打开关于对话框时,我可以在 eclipse.commands 变量中看到选项 -debug

...
-product
org.eclipse.epp.package.jee.product
-console
-consoleLog
-debug
$HOME/tools/eclipse/kepler-SR2
-data
$HOME/workspace
-vm
$HOME/tools/java/jdk1.8.0_25/bin/java
...

(出于隐私原因,我将主文件夹替换为 $HOME)。

但是我在启动 Eclipse 的控制台中没有看到任何跟踪输出。我可以看到 m2e 的输出:

2015-01-19 17:04:46,892 [Worker-12] INFO  o.e.m.c.i.embedder.EclipseLogger - Using 'UTF-8' encoding to copy filtered resources.
2015-01-19 17:04:46,892 [Worker-12] INFO  o.e.m.c.i.embedder.EclipseLogger - Copying 1 resource

当我按下 Enter 时,我得到一个 OSGi 提示。

可是一丝痕迹输出也没有。我错过了什么?

使用 -debug 启动 Eclipse 时,您可以看到它在启动过程中加载了哪些配置文件。输出如下所示:

...
Install location:
    file:$HOME/tools/eclipse/kepler-SR2/
Configuration file:
    file:$HOME/tools/eclipse/kepler-SR2/configuration/config.ini loaded
Configuration location:
    file:$HOME/tools/eclipse/kepler-SR2/configuration/
Framework located:
    file:$HOME/tools/eclipse/kepler-SR2/plugins/org.eclipse.osgi_3.9.1.v20140110-1610.jar
Framework classpath:
    file:$HOME/tools/eclipse/kepler-SR2/plugins/org.eclipse.osgi_3.9.1.v20140110-1610.jar
Splash location:
    $HOME/tools/eclipse/kepler-SR2//plugins/org.eclipse.platform_4.3.2.v20140221-1700/splash.bmp
Debug options:
    file:$HOME/tools/eclipse/kepler-SR2/.options loaded
Time to load bundles: 5
...

注意给出调试选项的最后一个路径。在上面的例子中,这是:

Debug options:
    file:$HOME/tools/eclipse/kepler-SR2 loaded

这是一个文件夹...为什么 Eclipse 会这样做?因为有人这么说:

-debug
$HOME/tools/eclipse/kepler-SR2
-data

注意到 -debug-data 之间的路径了吗?摆脱它,它将起作用(或指定实际选项文件的路径)。