Hi Bernd! 

Thanks much for the helpful feedback. I almost have this approach working. At 
the moment I cloned a fair bit of the logic in TargetNodeComponent.java to 
manage the trace lifetime. I basically wrote code that created a trace project 
on demand, put the UST traces (the raw traces) into that project, and then when 
the launch terminates it imports the created traces. I will post again once I 
have it all working, but it does seem viable. 

Like you said, it is a bit of a bummer to have me copy and pasting logic 
though. I may look into what driving the view might buy me as well. There were 
other places I needed to copy and paste code as well, e.g. the logic necessary 
to create a new trace project that is private in the import wizard right now. 
It might be nice to pull that into some sort of factory that can be used in 
various places. 

regards, 
Aaron 

----- Original Message -----

> Hi Aaron

> First of all, I think it's a good idea to re-use the code that was done for
> the ControlView. It gives you the API to issue LTTng commands remotely as
> well as provides the parsing of the command result. I think it's thoroughly
> tested using JUnit tests (see plug-in
> org.eclipse.linuxtools.lttng.ui.tests), so that it should be pretty stable.
> However, even if the API is exported by the plug-in the API is marked as
> internal. We marked it internal because the LTTng-Tools (remote site)
> changes quickly and we want to have the freedom to change the API to adapt
> to these changes. This allows us to release newer versions of the Control
> feature outside the simultaneous release of Eclipse.

> To your other question, if it possible to use the control feature (and in
> particular LTTngControlServiceFactory and the LTTngControlService classes)
> outside the org.eclipse.linuxtools.lttng.ui and org.eclipse.linuxtools.lttng
> plug-ins. Yes, it is possible. You just get warnings in Eclipse because you
> use internal API's. I actually did that in the test plug-in where the
> control feature is tested (see plug-in
> org.eclipse.linuxtools.lttng.ui.tests).

> Looking at your example script, it should work. I've done similar things in
> the JUnit-tests (see
> org.eclipse.linuxtools.lttng2.ui.tests.control.service.LTTngControlServiceTest).
> The ControlView will only show these new session once you connect to the
> remote node or press the refresh button in case you are already connected.

> You could also drive the ControlView programatically. See JUnit-tests
> org.eclipse.linuxtools.lttng2.ui.tests.control.model.component.TraceControlCreateSessionTests
> how you could do that. The advantage is that you would see the sessions
> right away in the view.

> BTW, a feature for the ControlView that I have in mind but I haven't had time
> to implement is to be able to store a set of commands and re-run these set
> of commands. It's like having a trace profile which can be re-run. What you
> want to do seems to be in the same direction.

> If you have any questions please don't hesitate to contact me.

> Best Regards
> Bernd

> On Tue, Apr 16, 2013 at 6:37 PM, Aaron Spear < asp...@vmware.com > wrote:

> > Hi all,
> 

> > I have a custom "tracing" Java launch type that is a wrapper around a JDT
> > local Java launch. At the start of this launch I want to do the equivalent
> > of the following:
> 

> > lttng create -o /path/to/session/dir mySession123
> 
> > lttng enable-event -a -u --session mySession123
> 
> > lttng start mySession123
> 

> > then let the launch of the app run to termination (and it has a tracer that
> > leverages UST to log a subset of Java function entry/exits). Then I:
> 

> > lttng stop mySession123
> 
> > lttng destroy mySession123
> 

> > I started rolling up my sleeves and using ProcessBuilder to spawn this, but
> > then realized that was probably a bad idea since then it would not work for
> > remote Java app tracing (which I would like to enable eventually)
> 

> > Then I actually looked through the ControlView code that Bernd Huffman
> > wrote,
> > and it would appear that a better approach would be to use the
> > LTTngControlServiceFactory class to create an instance of
> > ILttngControlService since you guys already thought this through? I guess
> > given that I use RSE already (which we do) it would look something like
> > this
> > (omitting some details ...):
> 

> > void startMySession( IHost host ) {
> 
> > IRemoteSystemProxy proxy = new RemoteSystemProxy(host);
> 
> > proxy.connect(...) // ??
> 
> > ILttngControlService controlService =
> > LTTngControlServiceFactory.getInstance().getLttngControlService(
> > proxy.createCommandShell() );
> 

> > // then after this I can create a session:
> 
> > ISessionInfo sessionInfo =
> > controlService.createSession("mySession123","/path/to/session/dir",monitor);
> 

> > //enable all events
> 
> > controlService.enableEvents("mySession123",null, new
> > ArrayList<String>(),false,null,monitor);
> 

> > //start the session
> 
> > controlService.startSession("mySession123",monitor);
> 
> > }
> 

> > void stopMySesstion() {
> 
> > controlService.stopSession("mySession123",monitor);
> 
> > controlService.destroySession("mySession123");
> 
> > }
> 

> > Can I do this from some other plugin? Is it more sensible to open and then
> > actually programmatically drive the ControlView? (I guess then it would
> > actually have entries for my tracing, which might be useful. Maybe.)
> 

> > any comments/better ideas are most welcome.
> 

> > Aaron Spear
> 
> > _______________________________________________
> 
> > linuxtools-dev mailing list
> 
> > linuxtools-dev@eclipse.org
> 
> > https://dev.eclipse.org/mailman/listinfo/linuxtools-dev
> 

> _______________________________________________
> linuxtools-dev mailing list
> linuxtools-dev@eclipse.org
> https://dev.eclipse.org/mailman/listinfo/linuxtools-dev
_______________________________________________
linuxtools-dev mailing list
linuxtools-dev@eclipse.org
https://dev.eclipse.org/mailman/listinfo/linuxtools-dev

Reply via email to