Fix NLS-related Javadoc warnings
[deliverable/tracecompass.git] / org.eclipse.linuxtools.tmf.help / doc / User-Guide.mediawiki
CommitLineData
067490ab
AM
1
2= Introduction =
3
4The purpose of the '''Tracing Monitoring Framework (TMF)''' is to facilitate the integration of tracing and monitoring tools into Eclipse, to provide out-of-the-box generic functionalities/views and provide extension mechanisms of the base functionalities for application specific purposes.
5
6= TMF UML2 Sequence Diagram Framework =
7
8The purpose of the UML2 Sequence Diagram Framework of TMF is to provide a framework for generation of UML2 sequence diagrams. It provides
9*UML2 Sequence diagram drawing capabilities (i.e. lifelines, messages, activations, object creation and deletion)
10*a generic, re-usable Sequence Diagram View
11*Eclipse Extension Point for the creation of sequence diagrams
12*callback hooks for searching and filtering within the Sequence Diagram View
13*scalability<br>
14The following chapters describe the Sequence Diagram Framework as well as a reference implementation and its usage.
15
16== TMF UML2 Sequence Diagram Extensions ==
17
18In the UML2 Sequence Diagram Framework an Eclipse extension point is defined so that other plug-ins can contribute code to create sequence diagram.
19
20'''Identifier''': org.eclipse.linuxtools.tmf.ui.uml2SDLoader<br>
21'''Since''': Since 0.3.2 (based on UML2SD of org.eclipse.tptp.common.ui)<br>
22'''Description''': This extension point aims to list and connect any UML2 Sequence Diagram loader.<br>
23'''Configuration Markup''':<br>
24
25<pre>
26<!ELEMENT extension (uml2SDLoader)+>
27<!ATTLIST extension
28point CDATA #REQUIRED
29id CDATA #IMPLIED
30name CDATA #IMPLIED
31>
32</pre>
33
34*point - A fully qualified identifier of the target extension point.
35*id - An optional identifier of the extension instance.
36*name - An optional name of the extension instance.
37
38<pre>
39<!ELEMENT uml2SDLoader EMPTY>
40<!ATTLIST uml2SDLoader
41id CDATA #REQUIRED
42name CDATA #REQUIRED
43class CDATA #REQUIRED
44view CDATA #REQUIRED
45default (true | false)
46</pre>
47
48*id - A unique identifier for this uml2SDLoader. This is not mandatory as long as the id attribute cannot be retrieved by the provider plug-in. The class attribute is the one on which the underlying algorythm relies.
49*name - An name of the extension instance.
50*class - The implementation of this UML2 SD viewer loader. The class must implement org.eclipse.linuxtools.tmf.ui.views.uml2sd.load.IUml2SDLoader.
51*view - The view ID of the view that this loader aims to populate. Either org.eclipse.linuxtools.tmf.ui.views.uml2sd.SDView itself or a extension of org.eclipse.linuxtools.tmf.ui.views.uml2sd.SDView.
52*default - Set to true to make this loader the default one for the view; in case of several default loaders, first one coming from extensions list is taken.
53
54
55== Management of the Extension Point ==
56
57The TMF UI plug-in is responsible for evaluating each contribution to the extension point.
58<br>
59<br>
60With this extension point, a loader class is associated with a Sequence Diagram View. Multiple loaders can be associated to a single Sequence Diagram View. However, additional means have to be implemented to specify which loader should be used when opening the view. For example, an eclipse action or command could be used for that. This additional code is not necessary if there is only one loader for a given Sequence Diagram View associated and this loader has the attribute "default" set to "true". (see also [[#Using one Sequence Diagram View with Multiple Loaders | Using one Sequence Diagram View with Multiple Loaders]])
61
62== Sequence Diagram View ==
63
64For this extension point a Sequence Diagram View has to be defined as well. The Sequence Diagram View class implementation is provided by the plug-in ''org.eclipse.linuxtools.tmf.ui'' (''org.eclipse.linuxtools.tmf.ui.views.uml2sd.SDView'') and can be used as is or can also be sub-classed. For that, a view extension has to be added to the ''plugin.xml''.
65
66=== Supported Widgets ===
67
68The loader class provides a frame containing all the UML2 widgets to be displayed. The following widgets exist:
69
70*Lifeline
71*Activation
72*Synchronous Message
73*Asynchronous Message
74*Synchronous Message Return
75*Asynchronous Message Return
76*Stop
77
78For a lifeline, a category can be defined. The lifeline category defines icons, which are displayed in the lifeline header.
79
80=== Zooming ===
81
82The Sequence Diagram View allows the user to zoom in, zoom out and reset the zoom factor.
83
84=== Printing ===
85
86It is possible to print the whole sequence diagram as well as part of it.
87
88=== Key Bindings ===
89
90*SHIFT+ALT+ARROW-DOWN - to scroll down within sequence diagram one view page at a time
91*SHIFT+ALT+ARROW-UP - to scroll up within sequence diagram one view page at a time
92*SHIFT+ALT+ARROW-RIGHT - to scroll right within sequence diagram one view page at a time
93*SHIFT+ALT+ARROW-LEFT - to scroll left within sequence diagram one view page at a time
94*SHIFT+ALT+ARROW-HOME - to jump to the beginning of the selected message if not already visible in page
95*SHIFT+ALT+ARROW-END - to jump to the end of the selected message if not already visible in page
96*CTRL+F - to open find dialog if either the basic or extended find provider is defined (see [[#Using the Find Provider Interface | Using the Find Provider Interface]])
97*CTRL+P - to open print dialog
98
99=== Preferences ===
100
101The UML2 Sequence Diagram Framework provides preferences to customize the appearance of the Sequence Diagram View. The color of all widgets and text as well as the fonts of the text of all widget can be adjust. Amongst others the default lifeline width can be alternated. To change preferences select '''Windows->Preferences->Tracing->UML2 Sequence Diagrams'''. The following preference page will show:<br>
102[[Image:images/SeqDiagramPref.png]] <br>
103After changing the preferences select '''OK'''.
104
105=== Callback hooks ===
106
107The Sequence Diagram View provides several callback hooks so that extension can provide application specific functionality. The following interfaces can be provided:
108* Basic find provider or extended find Provider<br> For finding within the sequence diagram
109* Basic filter provider and extended Filter Provider<br> For filtering within the sequnce diagram.
110* Basic paging provider or advanced paging provider<br> For scalability reasons, used to limit number of displayed messages
111* Properies provider<br> To provide properties of selected elements
112* Collapse provider <br> To collapse areas of the sequence diagram
113
114== Tutorial ==
115
116This tutorial describes how to create a UML2 Sequence Diagram Loader extension and use this loader in the in Eclipse.
117
118=== Prerequisites ===
119
120The tutorial is based on Eclipse 3.7 (Eclipse Indigo) and TMF 0.3.2.
121
122=== Creating an Eclipse UI Plug-in ===
123
124To create a new project with name org.eclipse.linuxtools.tmf.sample.ui select '''File -> New -> Project -> Plug-in Development -> Plug-in Project'''. <br>
125[[Image:images/Screenshot-NewPlug-inProject1.png]]<br>
126
127[[Image:images/Screenshot-NewPlug-inProject2.png]]<br>
128
129[[Image:Screenshot-NewPlug-inProject3.png]]<br>
130
131=== Creating a Sequence Diagram View ===
132
133To open the plug-in manifest, double-click on the MANIFEST.MF file. <br>
134[[Image:images/SelectManifest.png]]<br>
135
136Change to the Dependencies tab and select '''Add...''' of the ''Required Plug-ins'' section. A new dialog box will open. Next find plug-in ''org.eclipse.linuxtools.tmf.ui'' and press '''OK'''<br>
137[[Image:images/AddDependencyTmfUi.png]]<br>
138
139Change to the Extensions tab and select '''Add...''' of the ''All Extension'' section. A new dialog box will open. Find the view extension ''org.eclipse.ui.views'' and press '''Finish'''.<br>
140[[Image:images/AddViewExtension1.png]]<br>
141
142To create a Sequence Diagram View, click the right mouse button. Then select '''New -> view'''<br>
143[[Image:images/AddViewExtension2.png]]<br>
144
145A new view entry has been created. Fill in the fields ''id'', ''name'' and ''class''. Note that for ''class'' the SD view implementation (''org.eclipse.linuxtools.tmf.ui.views.SDView'') of the TMF UI plug-in is used.<br>
146[[Image:images/FillSampleSeqDiagram.png]]<br>
147
148The view is prepared. Run the Example. To launch the an Eclipse Application select the ''Overview'' tab and click on '''Launch an Eclipse Application'''<br>
149[[Image:images/RunEclipseApplication.png]]<br>
150
151A new Eclipse application window will show. In the new window go to '''Windows -> Show View -> Other... -> Other -> Sample Sequence Diagram'''.<br>
152[[Image:images/ShowViewOther.png]]<br>
153
154The Sequence Diagram View will open with an blank page.<br>
155[[Image:images/BlankSampleSeqDiagram.png]]<br>
156
157Close the Example Application.
158
159=== Defining the uml2SDLoader Extension ===
160
161After defining the Sequence Diagram View it's time to create the ''uml2SDLoader'' Extension. <br>
162
163Before doing that add a dependency to TMF. For that select '''Add...''' of the ''Required Plug-ins'' section. A new dialog box will open. Next find plug-in ''org.eclipse.linuxtools.tmf'' and press '''OK'''<br>
164[[Image:images/AddDependencyTmf.png]]<br>
165
166To create the loader extension, change to the Extensions tab and select '''Add...''' of the ''All Extension'' section. A new dialog box will open. Find the extension ''org.eclipse.linuxtools.tmf.ui.uml2SDLoader'' and press '''Finish'''.<br>
167[[Image:images/AddTmfUml2SDLoader.png]]<br>
168
169A new 'uml2SDLoader'' extension has been created. Fill in fields ''id'', ''name'', ''class'', ''view'' and ''default''. Use ''default'' equal true for this example. For the view add the id of the Sequence Diagram View of chapter [[#Creating a Sequence Diagram View | Creating a Sequence Diagram View]]. <br>
170[[Image:images/FillSampleLoader.png]]<br>
171
172Then click on ''class'' (see above) to open the new class dialog box. Fill in the relevant fields and select '''Finish'''. <br>
173[[Image:images/NewSampleLoaderClass.png]]<br>
174
175A new Java class will be created which implements the interface ''org.eclipse.linuxtools.tmf.ui.views.uml2sd.load.IUml2SDLoader''.<br>
176
177<pre>
178package org.eclipse.linuxtools.tmf.sample.ui;
179
180import org.eclipse.linuxtools.tmf.ui.views.uml2sd.SDView;
181import org.eclipse.linuxtools.tmf.ui.views.uml2sd.load.IUml2SDLoader;
182
183public class SampleLoader implements IUml2SDLoader {
184
185 public SampleLoader() {
186 // TODO Auto-generated constructor stub
187 }
188
189 @Override
190 public void dispose() {
191 // TODO Auto-generated method stub
192
193 }
194
195 @Override
196 public String getTitleString() {
197 // TODO Auto-generated method stub
198 return null;
199 }
200
201 @Override
202 public void setViewer(SDView arg0) {
203 // TODO Auto-generated method stub
204
205 }
206</pre>
207
208=== Implementing the Loader Class ===
209
210Next is to implement the methods of the IUml2SDLoader interface method. The following code snippet shows how to create the major sequence diagram elements. Please note that no time information is stored.<br>
211
212<pre>
213package org.eclipse.linuxtools.tmf.sample.ui;
214
215import org.eclipse.linuxtools.tmf.ui.views.uml2sd.SDView;
216import org.eclipse.linuxtools.tmf.ui.views.uml2sd.core.AsyncMessage;
217import org.eclipse.linuxtools.tmf.ui.views.uml2sd.core.AsyncMessageReturn;
218import org.eclipse.linuxtools.tmf.ui.views.uml2sd.core.ExecutionOccurrence;
219import org.eclipse.linuxtools.tmf.ui.views.uml2sd.core.Frame;
220import org.eclipse.linuxtools.tmf.ui.views.uml2sd.core.Lifeline;
221import org.eclipse.linuxtools.tmf.ui.views.uml2sd.core.Stop;
222import org.eclipse.linuxtools.tmf.ui.views.uml2sd.core.SyncMessage;
223import org.eclipse.linuxtools.tmf.ui.views.uml2sd.core.SyncMessageReturn;
224import org.eclipse.linuxtools.tmf.ui.views.uml2sd.load.IUml2SDLoader;
225
226public class SampleLoader implements IUml2SDLoader {
227
228 private SDView fSdView;
229
230 public SampleLoader() {
231 }
232
233 @Override
234 public void dispose() {
235 }
236
237 @Override
238 public String getTitleString() {
239 return "Sample Diagram";
240 }
241
242 @Override
243 public void setViewer(SDView arg0) {
244 fSdView = arg0;
245 createFrame();
246 }
247
248 private void createFrame() {
249
250 Frame testFrame = new Frame();
251 testFrame.setName("Sample Frame");
252
253 /*
254 * Create lifelines
255 */
256
257 Lifeline lifeLine1 = new Lifeline();
258 lifeLine1.setName("Object1");
259 testFrame.addLifeLine(lifeLine1);
260
261 Lifeline lifeLine2 = new Lifeline();
262 lifeLine2.setName("Object2");
263 testFrame.addLifeLine(lifeLine2);
264
265
266 /*
267 * Create Sync Message
268 */
269 // Get new occurrence on lifelines
270 lifeLine1.getNewEventOccurrence();
271
272 // Get Sync message instances
273 SyncMessage start = new SyncMessage();
274 start.setName("Start");
275 start.setEndLifeline(lifeLine1);
276 testFrame.addMessage(start);
277
278 /*
279 * Create Sync Message
280 */
281 // Get new occurrence on lifelines
282 lifeLine1.getNewEventOccurrence();
283 lifeLine2.getNewEventOccurrence();
284
285 // Get Sync message instances
286 SyncMessage syn1 = new SyncMessage();
287 syn1.setName("Sync Message 1");
288 syn1.setStartLifeline(lifeLine1);
289 syn1.setEndLifeline(lifeLine2);
290 testFrame.addMessage(syn1);
291
292 /*
293 * Create corresponding Sync Message Return
294 */
295
296 // Get new occurrence on lifelines
297 lifeLine1.getNewEventOccurrence();
298 lifeLine2.getNewEventOccurrence();
299
300 SyncMessageReturn synReturn1 = new SyncMessageReturn();
301 synReturn1.setName("Sync Message Return 1");
302 synReturn1.setStartLifeline(lifeLine2);
303 synReturn1.setEndLifeline(lifeLine1);
304 synReturn1.setMessage(syn1);
305 testFrame.addMessage(synReturn1);
306
307 /*
308 * Create Activations (Execution Occurrence)
309 */
310 ExecutionOccurrence occ1 = new ExecutionOccurrence();
311 occ1.setStartOccurrence(start.getEventOccurrence());
312 occ1.setEndOccurrence(synReturn1.getEventOccurrence());
313 lifeLine1.addExecution(occ1);
314 occ1.setName("Activation 1");
315
316 ExecutionOccurrence occ2 = new ExecutionOccurrence();
317 occ2.setStartOccurrence(syn1.getEventOccurrence());
318 occ2.setEndOccurrence(synReturn1.getEventOccurrence());
319 lifeLine2.addExecution(occ2);
320 occ2.setName("Activation 2");
321
322 /*
323 * Create Sync Message
324 */
325 // Get new occurrence on lifelines
326 lifeLine1.getNewEventOccurrence();
327 lifeLine2.getNewEventOccurrence();
328
329 // Get Sync message instances
330 AsyncMessage asyn1 = new AsyncMessage();
331 asyn1.setName("Async Message 1");
332 asyn1.setStartLifeline(lifeLine1);
333 asyn1.setEndLifeline(lifeLine2);
334 testFrame.addMessage(asyn1);
335
336 /*
337 * Create corresponding Sync Message Return
338 */
339
340 // Get new occurrence on lifelines
341 lifeLine1.getNewEventOccurrence();
342 lifeLine2.getNewEventOccurrence();
343
344 AsyncMessageReturn asynReturn1 = new AsyncMessageReturn();
345 asynReturn1.setName("Async Message Return 1");
346 asynReturn1.setStartLifeline(lifeLine2);
347 asynReturn1.setEndLifeline(lifeLine1);
348 asynReturn1.setMessage(asyn1);
349 testFrame.addMessage(asynReturn1);
350
351 /*
352 * Create a note
353 */
354
355 // Get new occurrence on lifelines
356 lifeLine1.getNewEventOccurrence();
357
358 EllipsisisMessage info = new EllipsisisMessage();
359 info.setName("Object deletion");
360 info.setStartLifeline(lifeLine2);
361 testFrame.addNode(info);
362
363 /*
364 * Create a Stop
365 */
366 Stop stop = new Stop();
367 stop.setLifeline(lifeLine2);
368 stop.setEventOccurrence(lifeLine2.getNewEventOccurrence());
369 lifeLine2.addNode(stop);
370
371 fSdView.setFrame(testFrame);
372 }
373}
374</pre>
375
376Now it's time to run the example application. To launch the Example Application select the ''Overview'' tab and click on '''Launch an Eclipse Application'''<br>
377[[Image:images/SampleDiagram1.png]] <br>
378
379=== Adding time information ===
380
381To add time information in sequence diagram the timestamp has to be set for each message. The sequence diagram framework uses the ''TmfTimestamp'' class of plug-in ''org.eclipse.linuxtools.tmf''. Use ''setTime()'' on each message ''SyncMessage'' since start and end time are the same. For each ''AsyncMessage'' set start and end time separately by using methods ''setStartTime'' and ''setEndTime''. For example: <br>
382
383<pre>
384 private void createFrame() {
385 //...
386 start.setTime(new TmfTimestamp(1000, (byte) -3));
387 syn1.setTime(new TmfTimestamp(1005, (byte) -3));
388 synReturn1.setTime(new TmfTimestamp(1050, (byte) -3));
389 asyn1.setStartTime(new TmfTimestamp(1060, (byte) -3));
390 asyn1.setEndTime(new TmfTimestamp(1070, (byte) -3));
391 asynReturn1.setStartTime(new TmfTimestamp(1060, (byte) -3));
392 asynReturn1.setEndTime(new TmfTimestamp(1070, (byte) -3));
393 //...
394 }
395</pre>
396
397When running the example application, a time compression bar on the left appears which indicates the time elapsed between consecutive events. The time compression scale shows where the time falls between the minimum and maximum delta times. The intensity of the color is used to indicate the length of time, namely, the deeper the intensity, the higher the delta time. The minimum and maximum delta times are configurable through the collbar menu ''Configure Min Max''. The time compression bar and scale may provide an indication about which events consumes the most time. By hovering over the time compression bar a tooltip appears containing more information. <br>
398
399[[Image:images/SampleDiagramTimeComp.png]] <br>
400
401By hovering over a message it will show the time information in the appearing tooltip. For each ''SyncMessage'' it shows its time occurrence and for each ''AsyncMessage'' it shows the start and end time.
402
403[[Image:images/SampleDiagramSyncMessage.png]] <br>
404[[Image:images/SampleDiagramAsyncMessage.png]] <br>
405
406To see the time elapsed between 2 messages, select one message and hover over a second message. A tooltip will show with the delta in time. Note if the second message is before the first then a negative delta is displayed. Note that for ''AsynMessage'' the end time is used for the delta calculation.<br>
407[[Image:images/SampleDiagramMessageDelta.png]] <br>
408
409=== Default Coolbar and Menu Items ===
410
411The Sequence Diagram View comes with default coolbar and menu items. By default, each sequence diagram shows the following actions:
412* Zoom in
413* Zoom out
414* Reset Zoom Factor
415* Selection
416* Configure Min Max (drop-down menu only)
417* Navigation -> Show the node end (drop-down menu only)
418* Navigation -> Show the node start (drop-down menu only)
419
420[[Image:images/DefaultCoolbarMenu.png]]<br>
421
422=== Implementing Optional Callbacks ===
423
424The following chapters describe how to use all supported provider interfaces.
425
426==== Using the Paging Provider Interface ====
427
428For scalability reasons, the paging provider interfaces exists to limit the number of messages displayed in the Sequence Diagram View at a time. For that, two interfaces exist, the basic paging provider and the advanced paging provider. When using the basic paging interface, actions for traversing page by page through the sequence diagram of a trace will be provided.
429<br>
430To use the basic paging provider, first the interface methods of the ''ISDPagingProvider'' have to be implemented by a class. (i.e. ''hasNextPage()'', ''hasPrevPage()'', ''nextPage()'', ''prevPage()'', ''firstPage()'' and ''endPage()''. Typically, this is implemented in the loader class. Secondly, the provider has to be set in the Sequence Diagram View. This will be done in the ''setViewer()'' method of the loader class. Lastly, the paging provider has to be removed from the view, when the ''dispose()'' method of the loader class is called.
431
432<pre>
433public class SampleLoader implements IUml2SDLoader, ISDPagingProvider {
434 //...
435 private page = 0;
436
437 @Override
438 public void dispose() {
439 if (fSdView != null) {
440 fSdView.resetProviders();
441 }
442 }
443
444 @Override
445 public void setViewer(SDView arg0) {
446 fSdView = arg0;
447 fSdView.setSDPagingProvider(this);
448 createFrame();
449 }
450
451 private void createSecondFrame() {
452 Frame testFrame = new Frame();
453 testFrame.setName("SecondFrame");
454 Lifeline lifeline = new Lifeline();
455 lifeline.setName("LifeLine 0");
456 testFrame.addLifeLine(lifeline);
457 lifeline = new Lifeline();
458 lifeline.setName("LifeLine 1");
459 testFrame.addLifeLine(lifeline);
460 for (int i = 1; i < 5; i++) {
461 SyncMessage message = new SyncMessage();
462 message.autoSetStartLifeline(testFrame.getLifeline(0));
463 message.autoSetEndLifeline(testFrame.getLifeline(0));
464 message.setName((new StringBuilder("Message ")).append(i).toString());
465 testFrame.addMessage(message);
466
467 SyncMessageReturn messageReturn = new SyncMessageReturn();
468 messageReturn.autoSetStartLifeline(testFrame.getLifeline(0));
469 messageReturn.autoSetEndLifeline(testFrame.getLifeline(0));
470
471 testFrame.addMessage(messageReturn);
472 messageReturn.setName((new StringBuilder("Message return ")).append(i).toString());
473 ExecutionOccurrence occ = new ExecutionOccurrence();
474 occ.setStartOccurrence(testFrame.getSyncMessage(i - 1).getEventOccurrence());
475 occ.setEndOccurrence(testFrame.getSyncMessageReturn(i - 1).getEventOccurrence());
476 testFrame.getLifeline(0).addExecution(occ);
477 }
478 fSdView.setFrame(testFrame);
479 }
480
481 /*
482 * (non-Javadoc)
483 * @see org.eclipse.linuxtools.tmf.ui.views.uml2sd.handlers.provider.ISDPagingProvider#hasNextPage()
484 */
485 @Override
486 public boolean hasNextPage() {
487 return page == 0;
488 }
489
490 /*
491 * (non-Javadoc)
492 * @see org.eclipse.linuxtools.tmf.ui.views.uml2sd.handlers.provider.ISDPagingProvider#hasPrevPage()
493 */
494 @Override
495 public boolean hasPrevPage() {
496 return page == 1;
497 }
498
499 /*
500 * (non-Javadoc)
501 * @see org.eclipse.linuxtools.tmf.ui.views.uml2sd.handlers.provider.ISDPagingProvider#nextPage()
502 */
503 @Override
504 public void nextPage() {
505 page = 1;
506 createSecondFrame();
507 }
508
509 /*
510 * (non-Javadoc)
511 * @see org.eclipse.linuxtools.tmf.ui.views.uml2sd.handlers.provider.ISDPagingProvider#prevPage()
512 */
513 @Override
514 public void prevPage() {
515 page = 0;
516 createFrame();
517 }
518
519 /*
520 * (non-Javadoc)
521 * @see org.eclipse.linuxtools.tmf.ui.views.uml2sd.handlers.provider.ISDPagingProvider#firstPage()
522 */
523 @Override
524 public void firstPage() {
525 page = 0;
526 createFrame();
527 }
528
529 /*
530 * (non-Javadoc)
531 * @see org.eclipse.linuxtools.tmf.ui.views.uml2sd.handlers.provider.ISDPagingProvider#lastPage()
532 */
533 @Override
534 public void lastPage() {
535 page = 1;
536 createSecondFrame();
537 }
538 //...
539}
540
541</pre>
542
543When running the example application, new actions will be shown in the coolbar and the coolbar menu. <br>
544
545[[Image:images/PageProviderAdded.png]]
546
547<br><br>
548To use the advanced paging provider, the interface ''ISDAdvancePagingProvider'' has to be implemented. It extends the basic paging provider. The methods ''currentPage()'', ''pagesCount()'' and ''pageNumberChanged()'' have to be added.
549<br>
550
551==== Using the Find Provider Interface ====
552
553For finding nodes in a sequence diagram two interfaces exists. One for basic finding and one for extended finding. The basic find comes with a dialog box for entering find criterias as regular expressions. This find criteria can be used to execute the find. Find criterias a persisted in the Eclipse workspace.
554<br>
555For the extended find provider interface a ''org.eclipse.jface.action.Action'' class has to be provided. The actual find handling has to be implemented and triggered by the action.
556<br>
557Only on at a time can be active. If the extended find provder is defined it obsoletes the basic find provider.
558<br>
559To use the basic find provider, first the interface methods of the ''ISDFindProvider'' have to be implemented by a class. Typically, this is implemented in the loader class. Add the ISDFindProvider to the list of implemented interfaces, implement the methods ''find()'' and ''cancel()'' and set the provider in the ''setViewer()'' method as well as remove the provider in the ''dispose()'' method of the loader class. Please note that the ''ISDFindProvider'' extends the interface ''ISDGraphNodeSupporter'' which methods (''isNodeSupported()'' and ''getNodeName()'') have to be implemented, too. The following shows an example implementation. Please note that only search for lifelines and SynchMessage are supported. The find itself will always find only the first occurrence the pattern to match.
560
561<pre>
562public class SampleLoader implements IUml2SDLoader, ISDPagingProvider, ISDFindProvider {
563
564 //...
565 @Override
566 public void dispose() {
567 if (fSdView != null) {
568 fSdView.resetProviders();
569 }
570 }
571
572 @Override
573 public void setViewer(SDView arg0) {
574 fSdView = arg0;
575 fSdView.setSDPagingProvider(this);
576 fSdView.setSDFindProvider(this);
577 createFrame();
578 }
579 /*
580 * (non-Javadoc)
581 * @see org.eclipse.linuxtools.tmf.ui.views.uml2sd.handlers.provider.ISDGraphNodeSupporter#isNodeSupported(int)
582 */
583 @Override
584 public boolean isNodeSupported(int nodeType) {
585 switch (nodeType) {
586 case ISDGraphNodeSupporter.LIFELINE:
587 case ISDGraphNodeSupporter.SYNCMESSAGE:
588 return true;
589
590 default:
591 break;
592 }
593 return false;
594 }
595
596 /*
597 * (non-Javadoc)
598 * @see org.eclipse.linuxtools.tmf.ui.views.uml2sd.handlers.provider.ISDGraphNodeSupporter#getNodeName(int, java.lang.String)
599 */
600 @Override
601 public String getNodeName(int nodeType, String loaderClassName) {
602 switch (nodeType) {
603 case ISDGraphNodeSupporter.LIFELINE:
604 return "Lifeline";
605 case ISDGraphNodeSupporter.SYNCMESSAGE:
606 return "Sync Message";
607 }
608 return "";
609 }
610
611 /*
612 * (non-Javadoc)
613 * @see org.eclipse.linuxtools.tmf.ui.views.uml2sd.handlers.provider.ISDFindProvider#find(org.eclipse.linuxtools.tmf.ui.views.uml2sd.handlers.widgets.Criteria)
614 */
615 @Override
616 public boolean find(Criteria criteria) {
617 Frame frame = fSdView.getFrame();
618 if (criteria.isLifeLineSelected()) {
619 for (int i = 0; i < frame.lifeLinesCount(); i++) {
620 if (criteria.matches(frame.getLifeline(i).getName())) {
621 fSdView.getSDWidget().moveTo(frame.getLifeline(i));
622 return true;
623 }
624 }
625 }
626 if (criteria.isSyncMessageSelected()) {
627 for (int i = 0; i < frame.syncMessageCount(); i++) {
628 if (criteria.matches(frame.getSyncMessage(i).getName())) {
629 fSdView.getSDWidget().moveTo(frame.getSyncMessage(i));
630 return true;
631 }
632 }
633 }
634 return false;
635 }
636
637 /*
638 * (non-Javadoc)
639 * @see org.eclipse.linuxtools.tmf.ui.views.uml2sd.handlers.provider.ISDFindProvider#cancel()
640 */
641 @Override
642 public void cancel() {
643 // reset find parameters
644 }
645 //...
646}
647</pre>
648
649When running the example application, the find action will be shown in the coolbar and the coolbar menu. <br>
650[[Image:images/FindProviderAdded.png]]
651
652To find a sequence diagram node press on the find button of the coolbar (see above). A new dialog box will open. Enter a regular expression in the ''Matching String'' text box, select the node types (e.g. Sync Message) and press '''Find'''. If found the corresponding node will be selected. If not found the dialog box will indicate not found. <br>
653[[Image:images/FindDialog.png]]<br>
654
655Note that the find dialog will be opened by typing the key shortcut CRTL+F.
656
657==== Using the Filter Provider Interface ====
658
659For filtering of sequence diagram elements two interfaces exists. One basic for filtering and one for extended filtering. The basic filtering comes with two dialog for entering filter criterias as regular expressions and one for selecting the filter to be used. Multiple filters can be active at a time. Filter criterias are persisted in the Eclipse workspace.
660<br>
661To use the basic filter provider, first the interface method of the ''ISDFilterProvider'' has to be implemented by a class. Typically, this is implemented in the loader class. Add the ''ISDFilterProvider'' to the list of implemented interfaces, implement the method ''filter()''and set the provider in the ''setViewer()'' method as well as remove the provider in the ''dispose()'' method of the loader class. Please note that the ''ISDFindProvider'' extends the interface ''ISDGraphNodeSupporter'' which methods (''isNodeSupported()'' and ''getNodeName()'') have to be implemented, too. <br>
662Note that no example implementation of ''filter()'' is provided.
663<br>
664
665<pre>
666public class SampleLoader implements IUml2SDLoader, ISDPagingProvider, ISDFindProvider, ISDFilterProvider {
667
668 //...
669 @Override
670 public void dispose() {
671 if (fSdView != null) {
672 fSdView.resetProviders();
673 }
674 }
675
676 @Override
677 public void setViewer(SDView arg0) {
678 fSdView = arg0;
679 fSdView.setSDPagingProvider(this);
680 fSdView.setSDFindProvider(this);
681 fSdView.setSDFilterProvider(this);
682 createFrame();
683 }
684
685 /*
686 * (non-Javadoc)
687 * @see org.eclipse.linuxtools.tmf.ui.views.uml2sd.handlers.provider.ISDFilterProvider#filter(java.util.List)
688 */
689 @Override
690 public boolean filter(List<?> list) {
691 return false;
692 }
693 //...
694}
695</pre>
696
697When running the example application, the filter action will be shown in the coolbar menu. <br>
698[[Image:images/HidePatternsMenuItem.png]]
699
700To filter select the '''Hide Patterns...''' of the coolbar menu. A new dialog box will open. <br>
701[[Image:images/DialogHidePatterns.png]]
702
703To Add a new filter press '''Add...'''. A new dialog box will open. Enter a regular expression in the ''Matching String'' text box, select the node types (e.g. Sync Message) and press '''Create''''. <br>
704[[Image:images/DialogHidePatterns.png]] <br>
705
706Now back at the Hide Pattern dialog. Select one or more filter and select '''OK'''.
707
708To use the extended filter provider, the interface ''ISDExtendedFilterProvider'' has to be implemented. It will provide a ''org.eclipse.jface.action.Action'' class containing the actual filter handling and filter algorithm.
709
710==== Using the Extended Action Bar Provider Interface ====
711
712The extended action bar provider can be used to add customized actions to the Sequence Diagram View.
713To use the extended action bar provider, first the interface method of the interface ''ISDExtendedActionBarProvider'' has to be implemented by a class. Typically, this is implemented in the loader class. Add the ''ISDExtendedActionBarProvider'' to the list of implemented interfaces, implement the method ''supplementCoolbarContent()'' and set the provider in the ''setViewer()'' method as well as remove the provider in the ''dispose()'' method of the loader class. <br>
714
715<pre>
716public class SampleLoader implements IUml2SDLoader, ISDPagingProvider, ISDFindProvider, ISDFilterProvider, ISDExtendedActionBarProvider {
717 //...
718
719 @Override
720 public void dispose() {
721 if (fSdView != null) {
722 fSdView.resetProviders();
723 }
724 }
725
726 @Override
727 public void setViewer(SDView arg0) {
728 fSdView = arg0;
729 fSdView.setSDPagingProvider(this);
730 fSdView.setSDFindProvider(this);
731 fSdView.setSDFilterProvider(this);
732 fSdView.setSDExtendedActionBarProvider(this);
733 createFrame();
734 }
735
736 /*
737 * (non-Javadoc)
738 * @see org.eclipse.linuxtools.tmf.ui.views.uml2sd.handlers.provider.ISDExtendedActionBarProvider#supplementCoolbarContent(org.eclipse.ui.IActionBars)
739 */
740 @Override
741 public void supplementCoolbarContent(IActionBars iactionbars) {
742 Action action = new Action("Refresh") {
743 @Override
744 public void run() {
745 System.out.println("Refreshing...");
746 }
747 };
748 iactionbars.getMenuManager().add(action);
749 iactionbars.getToolBarManager().add(action);
750 }
751 //...
752}
753</pre>
754
755When running the example application, all new actions will be added to the coolbar and coolbar menu according to the implementation of ''supplementCoolbarContent()''<br>.
756For the example above the coolbar and coolbar menu will look as follows.
757
758[[Image:images/SupplCoolbar.png]]
759
760==== Using the Properties Provider Interface====
761
762This interface can be used to provide property information. A property provider which returns an ''IPropertyPageSheet'' (see ''org.eclipse.ui.views'') has to be implemented and set in the Sequence Diagram View. <br>
763
764To use the property provider, first the interface method of the ''ISDPropertiesProvider'' has to be implemented by a class. Typically, this is implemented in the loader class. Add the ''ISDPropertiesProvider'' to the list of implemented interfaces, implement the method ''getPropertySheetEntry()'' and set the provider in the ''setViewer()'' method as well as remove the provider in the ''dispose()'' method of the loader class. Please note that no example is provided here.
765
766Please refer to the following Eclipse articles for more information about properties and tabed properties.
767*[http://www.eclipse.org/articles/Article-Properties-View/properties-view.html | Take control of your properties]
768*[http://www.eclipse.org/articles/Article-Tabbed-Properties/tabbed_properties_view.html | The Eclipse Tabbed Properties View]
769
770==== Using the Collapse Provider Interface ====
771
772This interface can be used to define a provider which responsibility is to collapse two selected lifelines. This can be used to hide a pair of lifelines.
773
774To use the collapse provider, first the interface method of the ''ISDCollapseProvider'' has to be implemented by a class. Typically, this is implemented in the loader class. Add the ISDCollapseProvider to the list of implemented interfaces, implement the method ''collapseTwoLifelines()'' and set the provider in the ''setViewer()'' method as well as remove the provider in the ''dispose()'' method of the loader class. Please note that no example is provided here.
775
776==== Using the Selection Provider Service ====
777
778The Sequence Diagram View comes with a build in selection provider service. To this service listeners can be added. To use the selection provider service, the interface ''ISelectionListener'' of plug-in ''org.eclipse.ui'' has to implemented. Typically this is implemented in loader class. Firstly, add the ''ISelectionListener'' interface to the list of implemented interfaces, implement the method ''selectionChanged()'' and set the listener in method ''setViewer()'' as well as remove the listener in the ''dispose()'' method of the loader class.
779
780<pre>
781public class SampleLoader implements IUml2SDLoader, ISDPagingProvider, ISDFindProvider, ISDFilterProvider, ISDExtendedActionBarProvider, ISelectionListener {
782
783 //...
784 @Override
785 public void dispose() {
786 if (fSdView != null) {
787 PlatformUI.getWorkbench().getActiveWorkbenchWindow().getSelectionService().removePostSelectionListener(this);
788 fSdView.resetProviders();
789 }
790 }
791
792 @Override
793 public String getTitleString() {
794 return "Sample Diagram";
795 }
796
797 @Override
798 public void setViewer(SDView arg0) {
799 fSdView = arg0;
800 PlatformUI.getWorkbench().getActiveWorkbenchWindow().getSelectionService().addPostSelectionListener(this);
801 fSdView.setSDPagingProvider(this);
802 fSdView.setSDFindProvider(this);
803 fSdView.setSDFilterProvider(this);
804 fSdView.setSDExtendedActionBarProvider(this);
805
806 createFrame();
807 }
808
809 /*
810 * (non-Javadoc)
811 * @see org.eclipse.ui.ISelectionListener#selectionChanged(org.eclipse.ui.IWorkbenchPart, org.eclipse.jface.viewers.ISelection)
812 */
813 @Override
814 public void selectionChanged(IWorkbenchPart part, ISelection selection) {
815 ISelection sel = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getSelectionService().getSelection();
816 if (sel != null && (sel instanceof StructuredSelection)) {
817 StructuredSelection stSel = (StructuredSelection) sel;
818 if (stSel.getFirstElement() instanceof BaseMessage) {
819 BaseMessage syncMsg = ((BaseMessage) stSel.getFirstElement());
820 System.out.println("Message '" + syncMsg.getName() + "' selected.");
821 }
822 }
823 }
824
825 //...
826}
827</pre>
828
829=== Printing a Sequence Diagram ===
830
831To print a the whole sequence diagram or only parts of it, select the Sequence Diagram View and select '''File -> Print...''' or type the key combination ''CTRL+P''. A new print dialog will open. <br>
832
833[[Image:images/PrintDialog.png]] <br>
834
835Fill in all the relevant information, select '''Printer...''' to choose the printer and the press '''OK'''.
836
837=== Using one Sequence Diagram View with Multiple Loaders ===
838
839A Sequence Diagram View definition can be used with multiple sequence diagram loaders. However, the active loader to be used when opening the view has to be set. For this define an Eclipse action or command and assign the current loader to the view. Here is a code snippet for that:
840
841<pre>
842public class OpenSDView extends AbstractHandler {
843 @Override
844 public Object execute(ExecutionEvent event) throws ExecutionException {
845 try {
846 IWorkbenchPage persp = TmfUiPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getActivePage();
847 SDView view = (SDView) persp.showView("org.eclipse.linuxtools.ust.examples.ui.componentinteraction");
848 LoadersManager.getLoadersManager().createLoader("org.eclipse.linuxtools.tmf.ui.views.uml2sd.impl.TmfUml2SDSyncLoader", view);
849 } catch (PartInitException e) {
850 throw new ExecutionException("PartInitException caught: ", e);
851 }
852 return null;
853 }
854}
855</pre>
856
857=== Downloading the Tutorial ===
858
859Use the following link to download the source code of the tutorial [[Media:SamplePlugin.zip | Plug-in of Tutorial]]
860
861== Integration of Tracing and Monitoring Framework with Sequence Diagram Framework ==
862
863In the previous sections the Sequence Diagram Framework has been described and a tutorial was provided. In the following sections the integration of the Sequence Diagram Framework with other features of TMF will be described. Together it is a powerful framework to analyze and visualize content of traces. The integration is explained using the reference implementation of a UML2 sequence diagram loader which part of the TMF UI delivery. The reference implementation can be used as is, can be sub-classed or simply be an example for other sequence diagram loaders to be implemented.
864
865=== Reference Implementation ===
866
867A Sequence Diagram View Extension is defined in the plug-in TMF UI as well as a uml2SDLoader Extension with the reference loader.
868
869[[Image:images/ReferenceExtensions.png]]
870
871=== Used Sequence Diagram Features ===
872
873Besides the default features of the Sequence Diagram Framework, the reference implementation uses the following additional features:
874*Advanced paging
875*Basic finding
876*Basic filtering
877*Selection Service
878
879==== Advanced paging ====
880
881The reference loader implements the interface ''ISDAdvancedPagingProvider'' interface. Please refer to section [[#Using the Paging Provider Interface | Using the Paging Provider Interface]] for more details about the advanced paging feature.
882
883==== Basic finding ====
884
885The reference loader implements the interface ''ISDFindProvider'' interface. The user can search for ''Lifelines'' and ''Interactions''. The find is done across pages. If the expression to match is not on the current page a new thread is started to search on other pages. If expression is found the corresponding page is shown as well as the searched item is displayed. If not found then a message is displayed in the ''Progress View'' of Eclipse. Please refer to section [[#Using the Find Provider Interface | Using the Find Provider Interface]] for more details about the basic find feature.
886
887==== Basic filtering ====
888
889The reference loader implements the interface ''ISDFilterProvider'' interface. The user can filter on ''Lifelines'' and ''Interactions''. Please refer to section [[#Using the Filter Provider Interface | Using the Filter Provider Interface]] for more details about the basic filter feature.
890
891==== Selection Service ====
892
893The reference loader implements the interface ''ISelectionListener'' interface. When an interaction is selected a ''TmfTimeSynchSignal'' is broadcast (see [[#TMF Signal Framework | TMF Signal Framework]]). Please also refer to section [[#Using the Selection Provider Service | Using the Selection Provider Service]] for more details about the selection service and .
894
895=== Used TMF Features ===
896
897The reference implementation uses the following features of TMF:
898*TMF Experiment and Trace for accessing traces
899*Event Request Framework to request TMF events from the experiment and respective traces
900*Signal Framework for broadcasting and receiving TMF signals for synchronization purposes
901
902==== TMF Experiment and Trace for accessing traces ====
903
904The reference loader uses TMF Experiments to access traces and to request data from the traces.
905
906==== TMF Event Request Framework ====
907
908The reference loader use the TMF Event Request Framework to request events from the experiment and its traces.
909
910When opening a traces (which is triggered by signal ''TmfExperimentSelected'') or when opening the Sequence Diagram View after a trace had been opened previously, a TMF background request is initiated to index the trace and to fill in the first page of the sequence diagram. The purpose of the indexing is to store time ranges for pages with 10000 messages per page. This allows quickly to move to certain pages in a trace without having to re-parse from the beginning. The request is called indexing request.
911
912When switching pages, the a TMF foreground event request is initiated to retrieve the corresponding events from the experiment. It uses the time range stored in the index for the respective page.
913
914A third type of event request is issued for finding specific data across pages.
915
916==== TMF Signal Framework ====
917
918The reference loader extends the class ''TmfComponent''. By doing that the loader is register as TMF signal handler for sending and receiving TMF signals. The loader implements signal handlers for the following TMF signals:
919*''TmfExperimentSelectedSignal''
920This signal indicates that a Experiment was selected. When receiving this signal the indexing request is initiated and the first page is displayed after receiving the relevant information.
921*''TmfExperimentDisposedSignal''
922This signal indicates that a Experiment was disposed. When receiving this signal the loader resets its data and a blank page is loaded in the Sequence Diagram View.
923*''TmfTimeSynchSignal''
924This signal indicates that a event with a certain time stamp is selected. When receiving this signal the corresponding message is selected in the Sequence Diagram View. If necessary, the page is changed.
925*''TmfRangeSynchSignal''
926This signal indicates that a new time range is in focus. When receiving this signal the loader loads the page which corresponds to the start time of the time range signal. The message with the start time will be in focus.
927
928Besides acting on receiving signals, the reference loader is also sending signals. A ''TmfTimeSynchSignal'' is broadcasted with the time stamp of the message which was selected in the Sequence Diagram View. ''TmfRangeSynchSignal'' is sent when a page is changed in the Sequence Diagram View. The start timestamp of the time range sent is the timestamp of the first message. The end timestamp sent is the timestamp of the first message plus the current time range window. The current time range window is the time window that was indicated in the last received ''TmfRangeSynchSignal''.
929
930=== Supported Traces ===
931
932The reference implementation is able to analyze traces from a single component that traces the interaction between other components. For example, a server node could have trace information about its interaction with client nodes. The server node could be traced and then analyzed using TMF and the Sequence Diagram Framework of TMF could used to visualize the interactions with the client nodes.<br>
933
934Note that combined traces of multiple components, that contain the trace information about the same interactions are not supported in the reference implementation!
935
936=== Trace Format ===
937
938The reference implementation in class ''TmfUml2SDSyncLoader'' in package ''org.eclipse.linuxtools.tmf.ui.views.uml2sd.impl'' analyzes events from type ''ITmfEvent'' and creates events type ''ITmfSyncSequenceDiagramEvent'' if the ''ITmfEvent'' contains all relevant information information. The parsing algorithm looks like as follows:
939
940<pre>
941 /**
942 * @param tmfEvent Event to parse for sequence diagram event details
943 * @return sequence diagram event if details are available else null
944 */
945 protected ITmfSyncSequenceDiagramEvent getSequnceDiagramEvent(TmfEvent tmfEvent){
946 //type = .*RECEIVE.* or .*SEND.*
947 //content = sender:<sender name>:receiver:<receiver name>,signal:<signal name>
948 String eventType = tmfEvent.getType().toString();
949 if (eventType.contains(Messages.TmfUml2SDSyncCloader_EventTypeSend) || eventType.contains(Messages.TmfUml2SDSyncCloader_EventTypeReceive)) {
950 Object sender = tmfEvent.getContent().getField(Messages.TmfUml2SDSyncCloader_FieldSender);
951 Object receiver = tmfEvent.getContent().getField(Messages.TmfUml2SDSyncCloader_FieldReceiver);
952 Object name = tmfEvent.getContent().getField(Messages.TmfUml2SDSyncCloader_FieldSignal);
953 if ((sender instanceof ITmfEventField) && (receiver instanceof ITmfEventField) && (name instanceof ITmfEventField)) {
954 ITmfSyncSequenceDiagramEvent sdEvent = new TmfSyncSequenceDiagramEvent(tmfEvent,
955 ((ITmfEventField) sender).getValue().toString(),
956 ((ITmfEventField) receiver).getValue().toString(),
957 ((ITmfEventField) name).getValue().toString());
958
959 return sdEvent;
960 }
961 }
962 return null;
963 }
964</pre>
965
966The analysis looks for event type Strings containing ''SEND'' and ''RECEIVE''. If event type matches these key words, the analyzer will look for strings ''sender'', ''receiver'' and ''signal'' in the event fields of type ''ITmfEventField''. If all the data is found a sequence diagram event from can be created. Note that Sync Messages are assumed, which means start and end time are the same.
967
968=== How to use the Reference Implementation ===
969
970An example trace visualizer is provided that uses a trace in binary format. It contains trace events with sequence diagram information. To parse the data using TMF a class is provided that implements ''ITmfTrace''. Additionally, a parser is provided that reads from the file and converts a trace event to ''TmfEvent''. This parser implements the interface ''ITmfEventParser''. To get the source code see [[#Downloading the Reference Plug-in | Download the Reference Plug-in]]
971<br>
972The plug-in structure will look like this:<br>
973[[Image:images/ReferencePlugin.png]]<br>
974
975To open the plug-in manifest, double-click on the MANIFEST.MF file. <br>
976[[Image:images/SelectManifestRef.png]]<br>
977
978Run the Reference Application. To launch the Eclipse Application select the ''Overview'' tab and click on '''Launch an Eclipse Application'''<br>
979[[Image:images/RunApplicationRef.png]]<br>
980
981To open the Reference Sequence Diagram View, select '''Windows -> Show View -> Other... -> TMF -> Sequence Diagram''' <br>
982[[Image:images/ShowTmfSDView.png]]<br>
983
984An blank Sequence Diagram View will open. Open also the TMF Events View by selecting '''Windows -> Show View -> Other... -> TMF -> Events''' <br>
985[[Image:images/ShowEventsView.png]]<br>
986
987Select the '''Select Experiment''' button of the toolbar to load the sequence diagram from the data provided in the trace file. What this does is open the file ''tracesets/sdEvents'', parse this file through TMF and analyze all events of type ''TmfEvent'' and generates the Sequence Digram out of it. <br>
988[[Image:images/ReferenceSeqDiagram.png]]<br>
989
990Now the reference application can be explored. To demonstrate the view features try the following things:
991*Select a message in the Sequence diagram. As result the corresponding event will be selected in the Events View.
992*Select an event in the Events View. As result the corresponding message in the Sequence Diagram View will be selected. If necessary, the page will be changed.
993*In the Events View, press key ''End''. As result, the Sequence Diagram view will jump to the last page.
994*In the Events View, press key ''Home''. As result, the Sequence Diagram view will jump to the first page.
995*In the Sequence Diagram View select the find button. Enter the expression '''REGISTER.*''', select '''Search for Interaction''' and press '''Find'''. As result the corresponding message will be selected in the Sequence Diagram and the corresponding event in the Events View will be selected. Select again '''Find''' the next occurrence of will be selected. Since the second occurrence is on a different page than the first, the corresponding page will be loaded.
996* In the Sequence Diagram View, select menu item '''Hide Patterns...'''. Add the filter '''BALL.*''' for '''Interaction''' only and select '''OK'''. As result all messages with name ''BALL_REQUEST'' and ''BALL_REPLY'' will be hidden. To remove the filter, select menu item '''Hide Patterns...''', deselect the corresponding filter and press '''OK'''. All the messages will be shown again.<br>
997
998To dispose the diagram, select the '''Dispose Experiment''' button of the toolbar. The current sequence diagram will be disposed and an empty diagram will be loaded.
999
1000=== Extending the Reference Loader ===
1001
1002In some case it might be necessary to change the implementation of the analysis of each ''TmfEvent'' for the generation of ''Sequence Diagram Events''. For that just extend the class ''TmfUml2SDSyncLoader'' and overwrite the method ''protected ITmfSyncSequenceDiagramEvent getSequnceDiagramEvent(TmfEvent tmfEvent)'' with your own implementation.
1003
1004=== Downloading the Reference Plug-in ===
1005To download the reference plug-in that demonstrates the reference loader, use the following link: [[Media:ReferencePlugin.zip | Reference Plug-in]]. Just extract the zip file and import the extracted Eclipse plug-in (plug-in name: ''org.eclipse.linuxtools.tmf.reference.ui'') to your Eclipse workspace. <br>
1006
1007=CTF Parser=
1008
1009== CTF Format ==
1010CTF is a format used to store traces. It is self defining, binary and made to be easy to write to.
1011Before going further, the full specification of the CTF file format can be found at http://www.efficios.com/ .
1012
1013For the purpose of the reader some basic description will be given. A CTF trace typically is made of several files all in the same folder.
1014
1015These files can be split into two types :
1016* Metadata
1017* Event streams
1018
1019=== Metadata ===
1020The metadata is either raw text or packetized text. It is tsdl encoded. it contains a description of the type of data in the event streams. It can grow over time if new events are added to a trace but it will never overwrite what is already there.
1021
1022=== Event Streams ===
1023The event streams are a file per stream per cpu. These streams are binary and packet based. The streams store events and event information (ie lost events) The event data is stored in headers and field payloads.
1024
1025So if you have two streams (channels) "channel1" and "channel2" and 4 cores, you will have the following files in your trace directory: "channel1_0" , "channel1_1" , "channel1_2" , "channel1_3" , "channel2_0" , "channel2_1" , "channel2_2" & "channel2_3"
1026
1027== Reading a trace ==
1028In order to read a CTF trace, two steps must be done.
1029* The metadata must be read to know how to read the events.
1030* the events must be read.
1031
1032The metadata is a written in a subset of the C language called TSDL. To read it, first it is depacketized (if it is not in plain text) then the raw text is parsed by an antlr grammer. The parsing is done in two phases. There is a lexer (CTFLexer.g) which separated the metatdata text into tokens. The tokens are then pattern matched using the parser (CTFParser.g) to form an AST. This AST is walked through using "IOStructGen.java" to populate streams and traces in trace parent object.
1033
1034When the metadata is loaded and read, the trace object will be populated with 3 items:
1035* the event definitions available per stream: a definition is a description of the datatype.
1036* the event declarations available per stream: this will save declaration creation on a per event basis. They will all be created in advance, just not populated.
1037* the beginning of a packet index.
1038
1039Now all the trace readers for the event streams have everything they need to read a trace. They will each point to one file, and read the file from packet to packet. Everytime the trace reader changes packet, the index is updated with the new packet's information. The readers are in a priority queue and sorted by timestamp. This ensures that the events are read in a sequential order. They are also sorted by file name so that in the eventuality that two events occur at the same time, they stay in the same order.
1040
1041== Seeking in a trace ==
1042The reason for maintaining an index is to speed up seeks. In the case that a user wishes to seek to a certain timestamp, they just have to find the index entry that contains the timestamp, and go there to iterate in that packet until the proper event is found. this will reduce the searches time by an order of 8000 for a 256k paket size (kernel default).
1043
1044== Interfacing to TMF ==
1045The trace can be read easily now but the data is still awkward to extract.
1046
1047=== CtfLocation ===
1048A location in a given trace, it is currently the timestamp of a trace.
1049
1050=== CtfTmfTrace ===
1051The CtfTmfTrace is a wrapper for the standard CTF trace that allows it to perform the following actions:
1052* '''InitTrace()''' create a trace
1053* '''ValidateTrace()''' is the trace a CTF trace?
1054* '''GeTLocationRatio()''' how far in the trace is my location?
1055* '''SeekEvent()''' sets the cursor to a certain point in a trace.
1056* '''ReadNextEvent()''' reads the next event and then advances the cursor
1057* '''GetEnvironmntVars()''' gets the 'env' structures of the metadata
1058
1059=== CtfIterator ===
1060The CtfIterator is a wrapper to the CTF file reader. It behaves like an iterator on a trace. However, it contains a file pointer and thus cannot be duplicated too often or the system will run out of file handles. To alleviate the situation, a pool of iterators is created at the very beginning and stored in the CtfTmfTrace. They can be retried by calling the GetIterator() method.
1061
1062=== CtfLightWeightContext ===
1063The CtfLightWeightContext wraps the tmfContext type. It has a CtfLocation and points to an iterator in the CtfTmfTrace iterator pool as well as the parent trace. it is made to be cloned easily and not affect system resources much. Contexts behave much like C File Pointers (FILE*) but they can be copied until one runs out of ram.
1064
1065=== CtfTmfTimestamp ===
1066The CtfTmfTimestamp take a CTF time (normally a long int) and outputs the time formats it as a TmfTimestamp, allowing it to be compared to other timestamps. The time is stored with the UTC offset already applied. It also features a simple toString() function that allows it to output the time in more Human readable ways: "yyyy/mm/dd/hh:mm:ss.nnnnnnnnn ns" for example. An additional feature is the getDelta() function that allows two timestamps to be substracted, showing the time difference between A and B.
1067
1068=== CtfTmfEvent ===
1069The CtfTmfEvent is an ITmfEvent that is used to wrap event declarations and event definitions from the CTF side into easier to read and parse chunks of information. It is a final class with final fields made to be newed very often without incurring performance costs. Most of the information is already available. It should be noted that one type of event can appear called "lost event" these are synthetic events that do not exist in the trace. They will not appear in other trace readers such as babeltrace.
1070
1071=== Other ===
1072There are other helper files that format given events for views, they are simpler and the architecture does not depend on them.
1073
1074=== Limitations ===
1075For the moment live trace reading is not supported, there are no sources of traces to test on.
1076
This page took 0.064395 seconds and 5 git commands to generate.