Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[linuxtools-dev] TMF/LTTng: best way to control LTTng from other Eclipse plugins ?

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


Back to the top