1 #LyX 1.5.5 created this file. For more info see http://www.lyx.org/
10 \font_typewriter default
11 \font_default_family default
17 \paperfontsize default
25 \paperorientation portrait
28 \paragraph_separation skip
30 \quotes_language english
33 \paperpagestyle default
34 \tracking_changes false
43 A Set of APIs for a Third-Generation Trace Viewer
48 Pierre-Marc Fournier, Michel Dagenais, Mathieu Desnoyers
53 <pierre-marc.fournier _at_ polymtl.ca>
62 École Polytechnique de Montréal
73 \begin_layout Standard
74 This document proposes some APIs for a trace viewing and analysis infrastructure.
77 \begin_layout Standard
78 Design choices were made based on the experience acquired by the design,
79 development and use of two previous generations of trace viewers, respectively
80 the Trace Visualizer from the Linux Trace Toolkit and its successor, the
81 LTTV from the LTTng tracing toolkit.
89 Provide an infrastructure for fast, interactive visualization and analysis
90 of huge traces (>10 GB) on standard workstations
94 \begin_layout Standard
95 Efficiency is of great importance.
96 It is tempting to think that as computers get faster, it will be possible
97 to run more complex analyses on traces in a shorter time.
98 In fact, the size of the traces grows as computers get more powerful, because
99 they do more operations than before in the same amount of time and therefore
100 generate more events.
101 The current tendency to parallelize systems is another factor that results
110 \begin_layout Itemize
111 Support live trace processing
114 \begin_layout Itemize
115 Allow merging of traces of different formats
118 \begin_layout Standard
119 \begin_inset Note Note
122 \begin_layout Itemize
123 Design the viewer in such a way that it can run in parallel on multi-core
125 \begin_inset Note Greyedout
128 \begin_layout Standard
129 (Is it worth it? Beware of complex locking issues)
142 \begin_layout Itemize
143 Design with both command line utilities (C language) and graphical interfaces
144 (Java and others) in mind, sharing code and standardizing interfaces as
149 \begin_layout Standard
150 Both command-line interfaces and graphical interfaces have an important
151 role to play in trace analysis.
152 While graphical interfaces allow for complex views, command-line utilities
153 can be used quickly in more environments; they can also be more convenient
154 in some circumstances.
155 A good design should be such that they can share code and APIs.
159 \begin_layout Section
163 \begin_layout Itemize
164 All data structures must be accessed through API methods, in order to allow
165 for internal change without breaking compatibility.
168 \begin_layout Section
169 Controlling the tracing of a system
172 \begin_layout Subsection
176 \begin_layout Standard
177 The goal of this API is to provide a portable way of controlling tracing
178 of heterogenous systems.
181 \begin_layout Standard
182 It should enable to do the following actions.
185 \begin_layout Itemize
186 Set the parameters of a trace (channels, buffering, destination of data
187 (file, network, process)...)
190 \begin_layout Itemize
191 Control the recording of events (start, stop, pause the trace)
194 \begin_layout Itemize
195 Create tracepoints (on dynamic tracers) and control which tracepoints are
196 activated (some may be at trace level, others might only permit system
200 \begin_layout Subsection
204 \begin_layout Itemize
205 List the static tracepoints available on a system
209 \begin_layout Standard
210 These may be static tracepoints (active or inactive) or dynamic tracepoints
211 (active or proposed).
215 \begin_layout Itemize
216 Add a new dynamic tracepoint
219 \begin_layout Itemize
220 Activate a tracepoint
223 \begin_layout Itemize
224 Deactivate a tracepoint
227 \begin_layout Itemize
228 List available probes
231 \begin_layout Itemize
232 Connect a probe to a tracepoint
235 \begin_layout Itemize
239 \begin_layout Itemize
243 \begin_layout Itemize
244 \begin_inset Note Greyedout
247 \begin_layout Standard
256 \begin_layout Section
260 \begin_layout Subsection
264 \begin_layout Subsubsection
268 \begin_layout Standard
269 Timestamps, at the framework level, should be in an architecture-independent
271 One possibility would be to have them stored in seconds (with decimals).
272 Offsetting, if necessary, could be handled by the traceset (trace merging)
274 An uncertainty value should accompany the timestamp.
275 Timestamps in cycles should be available if they are provided by the tracer.
278 \begin_layout Subsection
279 Low-level trace reading API
282 \begin_layout Standard
283 The goal of this API is to provide a uniform way for the framework to access
284 the events recorded in a trace, in an encoding-independant way.
287 \begin_layout Subsubsection
291 \begin_layout Itemize
292 void get_supported_formats(void)
296 \begin_layout Standard
300 \begin_layout Standard
304 \begin_layout Itemize
305 a list of supported formats
309 \begin_layout Itemize
314 \begin_layout Standard
318 \begin_layout Itemize
323 \begin_layout Itemize
327 \begin_layout Itemize
328 other special url to establish a network connection
331 \begin_layout Itemize
336 \begin_layout Itemize
337 trace format (optional, for cases where auto detection would not work or
341 \begin_layout Standard
345 \begin_layout Itemize
350 \begin_layout Subsubsection
354 \begin_layout Itemize
355 bool close(struct trace *tr)
358 \begin_layout Itemize
359 struct event *current_event(struct trace *)
363 \begin_layout Standard
367 \begin_layout Standard
371 \begin_layout Itemize
372 the event currently pointed by the position pointer
376 \begin_layout Itemize
377 bool advance(struct trace *tr)
381 \begin_layout Standard
382 Advance the position pointer to the next event in the trace.
385 \begin_layout Standard
389 \begin_layout Standard
393 \begin_layout Itemize
398 \begin_layout Itemize
402 \begin_layout Itemize
403 Final end of trace (end of a non-live trace or of a completed live trace)
406 \begin_layout Itemize
407 No more events for now (end of a still running live trace)
412 \begin_layout Itemize
413 bool seek_time(struct trace *tr, struct trace_cursor *cur)
417 \begin_layout Standard
421 \begin_layout Itemize
425 \begin_layout Standard
430 \begin_layout Itemize
431 struct trace_cursor *trace_new_cursor_beginning(struct trace *tr)
435 \begin_layout Standard
436 Return a new cursor associated to the trace, positioned at its beginning
440 \begin_layout Itemize
441 struct trace_cursor *trace_cursor_copy(struct trace_cursor *cur)
444 \begin_layout Itemize
445 void trace_cursor_destroy(struct trace_cursor_destroy *)
448 \begin_layout Itemize
449 struct trace_time get_time_start(struct trace *tr)
453 \begin_layout Standard
457 \begin_layout Standard
461 \begin_layout Itemize
462 the timestamp of the first event in the trace
466 \begin_layout Itemize
467 struct trace_time get_time_end(struct trace *tr)
471 \begin_layout Standard
475 \begin_layout Standard
479 \begin_layout Itemize
480 the timestamp of the last event in the trace
484 \begin_layout Itemize
485 register_callback_new_event(struct trace *tr, struct trace_time after, void
490 \begin_layout Standard
491 Register a callback that is called when a new event becomes available in
493 It is also called when the live trace ends.
496 \begin_layout Standard
500 \begin_layout Itemize
501 after (timestamp) : call only if the event occurent later than
506 \begin_layout Itemize
507 cb: the callback function
508 \begin_inset Note Note
511 \begin_layout Standard
512 specify its args and return val
520 \begin_layout Standard
524 \begin_layout Itemize
525 Result (success or failure)
529 \begin_layout Subsection
530 High-level trace reading API
533 \begin_layout Standard
534 The goal of this API is to provide a uniform way for analyses and views
535 to obtain trace events from a traceset (merge of many traces or a single
536 trace), regardless of the system they were recorded on and of the tracer
540 \begin_layout Itemize
541 Request a range of events
545 \begin_layout Standard
549 \begin_layout Itemize
550 (implicitly) the traceset
553 \begin_layout Itemize
557 \begin_layout Itemize
558 stop timestamp (special value for infinity, for live traces)
561 \begin_layout Itemize
562 list of event types and callbacks
565 \begin_layout Itemize
566 filter with complex expressions
569 \begin_layout Itemize
570 private pointer to be passed to the callbacks
573 \begin_layout Standard
577 \begin_layout Itemize
578 handle to the request for cancelling it
582 \begin_layout Itemize
587 \begin_layout Standard
591 \begin_layout Itemize
592 the handle to the request
596 \begin_layout Subsection
600 \begin_layout Subsubsection
604 \begin_layout Itemize
605 Request the values of a given set of state variables at a point in time
609 \begin_layout Standard
613 \begin_layout Itemize
614 the list of state variables
617 \begin_layout Itemize
622 \begin_layout Itemize
623 Request all the states changes of a given set of state variables between
628 \begin_layout Standard
632 \begin_layout Itemize
633 the list of state variables
636 \begin_layout Itemize
640 \begin_layout Itemize
645 \begin_layout Subsubsection
649 \begin_layout Section
650 Describing event types
653 \begin_layout Subsection
657 \begin_layout Standard
658 Because tracepoints may be created dynamically, information about the descriptio
659 n of events is just as dynamic.
660 In this context, one simple way to communicate the event description informatio
661 n to upper layers would be to send them as events, as it is done in recent
663 The core events used to describe other events are the only ones whose descripti
664 on is hardcoded in the framework.
667 \begin_layout Standard
668 These event-type-describing events could then be received and interpreted
669 by a module, the Event Description Service, which would be a client to
670 the high-level tracing API at the same level as normal views and analyses.
671 It would store the information and allow the other views and analyses to
672 access it via this API.
675 \begin_layout Subsection
676 Events-describing events
679 \begin_layout Itemize
680 Event type declaration event
684 \begin_layout Standard
685 Announce the existence of an event type
688 \begin_layout Itemize
693 \begin_layout Itemize
694 Argument declaration event
698 \begin_layout Standard
699 Announce the existence of an event argument
702 \begin_layout Itemize
706 \begin_layout Itemize
710 \begin_layout Itemize
715 \begin_layout Itemize
720 \begin_layout Standard
721 Announce that an event type ceased to exist
724 \begin_layout Itemize
729 \begin_layout Subsection
730 Event type description API
733 \begin_layout Itemize
734 Get the list of all the event types
737 \begin_layout Itemize
738 Find an event type by name
741 \begin_layout Itemize
742 Get the number of arguments of an event
745 \begin_layout Itemize
746 Get the list of arguments of an event
749 \begin_layout Itemize
750 Find an argument by name
753 \begin_layout Itemize
754 Get the type of an argument of an event type
757 \begin_layout Itemize
758 Get a string representation of an argument of any type, given an event that
759 contains it an instance of it
762 \begin_layout Itemize
763 Get an integer representation of an integer argument, a floating-point represent
764 ation of a floating-point argument
767 \begin_layout Itemize
768 Functions for accessing other types
771 \begin_layout Section
775 \begin_layout Subsection
779 \begin_layout Standard
780 Events contain the following information.
783 \begin_layout Itemize
787 \begin_layout Itemize
788 Event type identifier
792 \begin_layout Standard
796 \begin_layout Itemize
797 an event id (integer)
800 \begin_layout Itemize
801 an event name (string)
805 \begin_layout Itemize
806 The name of the machine it occured on
809 \begin_layout Subsection
813 \begin_layout Itemize
814 get the event type identifier
817 \begin_layout Itemize
821 \begin_layout Itemize
822 get the name of the machine on which the event occured
825 \begin_layout Itemize
826 get information on the type of tracing technology that was used
829 \begin_layout Itemize
830 get the corresponding tracepoint (machine/tracing technology/name/location
831 in code(if available))