Bug 437558 - Sleak not working with RCP e4
Summary: Sleak not working with RCP e4
Status: CLOSED DUPLICATE of bug 562952
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 4.3.2   Edit
Hardware: PC Windows 7
: P3 major (vote)
Target Milestone: 4.14 M1   Edit
Assignee: Lars Vogel CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-06-16 16:00 EDT by Gerald Meier CLA
Modified: 2022-02-15 04:09 EST (History)
8 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Gerald Meier CLA 2014-06-16 16:00:30 EDT

    
Comment 1 Gerald Meier CLA 2014-06-16 16:08:35 EDT
Hi,

so Sleak is not working, I tried everything that the internet had to offer on a search for the reasons.

I've installed it trought the update-site as discribed here:
http://www.eclipse.org/swt/tools.php
I launched eclipse according to the steps also mentoined on the site.

But all I get is:
"WARNING: Device is not tracking resource allocation"

So the phrase "The plug-in monitors all other plug-ins running in its Eclipse environment." did catch my Eye and I put org.eclipse.swt.tools in the required plugins. But nothing changed.
If it is somehow my fault, the thing that I can do needs to be documented because I am not an RCP beginner but I didn't find any solution.
Comment 2 Gerald Meier CLA 2014-06-16 16:12:48 EDT
To reproduce:

in eclipse:

new >> other >> Eclipse e4 >> eclipse e4 app project
Write any name >> next >> next >> check "create sample content" >> finish
configure run configs.

like so:
http://www.vogella.com/tutorials/EclipsePerformance/article.html#performance_sleak

start. And finaly open Sleakview and click any button.
Comment 3 Lakshmi P Shanmugam CLA 2014-06-17 08:34:34 EDT
(In reply to Gerald Meier from comment #1)
> Hi,
> 
> so Sleak is not working, I tried everything that the internet had to offer
> on a search for the reasons.
> 
> I've installed it trought the update-site as discribed here:
> http://www.eclipse.org/swt/tools.php
> I launched eclipse according to the steps also mentoined on the site.
> 
> But all I get is:
> "WARNING: Device is not tracking resource allocation"

I tried this the latest eclipse 4.4 build and Sleak works for me.

Which version of eclipse are you using? As mentioned in the above link, .options file has to be extracted, modified and placed in the eclipse folder. And eclipse has to be started with -debug option.
When launching eclipse from command line please make sure that you see a message saying eclipse\.options is loaded.
Comment 4 Gerald Meier CLA 2014-06-18 09:29:31 EDT
Hey,

I use version 4.3.2. I did the thing with the .options:
1. extracing it
2. added the lines(org.eclipse.ui/debug=true 
org.eclipse.ui/trace/graphics=true) at the end
3. added the -clean -debug"
4. launched eclipse

And sleak worked... but it only tracked eclipse ressources.

When I start my RCP-application(e4) no ressources form there are tracked.
And I checked the "debug" and "trace/graphics=true" in the run-config trace-tab.
And I even put in the swt.tools package in my plugin-dependencies.
Comment 5 Paul Roubekas CLA 2015-07-22 18:56:01 EDT
I got it to work and created this FAQ.
https://wiki.eclipse.org/Eclipse4/RCP/FAQ#How_to_use_Sleak_in_e4AP
Comment 6 Christian Mohr CLA 2015-07-28 10:53:20 EDT
Is there a way to do this with a "pure" e4-Application without org.eclipse.ui? I refactored the sleak ViewPart as E4-Part and added it to my application model. AFAICS i'm not able to add the tracing options in the launch configuration (no org.eclipse.ui available) and the .options file will be loaded, but changes nothing.
Comment 7 Brantlyn Decker CLA 2017-02-10 09:17:36 EST
(In reply to Christian Mohr from comment #6)
> Is there a way to do this with a "pure" e4-Application without
> org.eclipse.ui? I refactored the sleak ViewPart as E4-Part and added it to
> my application model. AFAICS i'm not able to add the tracing options in the
> launch configuration (no org.eclipse.ui available) and the .options file
> will be loaded, but changes nothing.

I was able to accomplish this by using reflection in my pure e4 application. When you can gain access to the Display object that eclipse creates (in my case a postContextCreate method) you can initialize parameters of the Display object to turn on debugging. The parameters are found in the super-class of Display (Device). Use reflection to set the field values for the instance of Display you have by calling set on the Field objects listed below.

debug = true;
tracking = true;
trackingLock = new Object()
errors = new Error[128]
objects = new Object[128]

this is the same initialization that takes place in org.eclipse.swt.graphics.Device.Device(DeviceData) but since Eclipse/e4 does not give us the option to create our own display objects or pass a DeviceData object to the display object creation (AFAIK) reflection is the only alternate
Comment 8 Eclipse Genie CLA 2019-09-25 03:20:40 EDT
New Gerrit change created: https://git.eclipse.org/r/150092
Comment 9 Eclipse Genie CLA 2019-09-25 03:43:09 EDT
New Gerrit change created: https://git.eclipse.org/r/150093
Comment 12 Eclipse Genie CLA 2019-10-04 11:03:16 EDT
New Gerrit change created: https://git.eclipse.org/r/150602
Comment 14 Lars Vogel CLA 2020-08-17 03:02:05 EDT
Reflection trick is still necessary, should be fixed by Bug 562952.

*** This bug has been marked as a duplicate of bug 562952 ***