Column: Embedded design
launching an LTTng session on the target, capturing and downloading the resulting trace data, we can open the trace data in Tracealyzer. If we set the filter to only show events from our application (“demo2- sleep”) and zoom in on the Trace View, we can see our familiar trace event; see Figure 4. Now we’ll measure the execution time of
the usleep function calls, which in this case can be defined as the time between pairs of Start and Stop events. Te best way to do this in Tracealyzer is to create Intervals for our custom User Events. To do this, select Intervals and State Machines in the Views menu. In the window that opens, click Custom Intervals to arrive at the Custom Intervals configuration window where we can define a new dataset consisting of intervals between selected events. Tis will allow us to extract timing information of key points in our application.
Define your custom interval A Tracealyzer Interval is defined by two events, Start and Stop, so we are going to create one interval that starts at the event that contains the string “Start” and ends at the event that contains the string “Stop”. To do this, we’re going to enter the following information in this window (see Figure 5):
• Interval Name: Sleep Trace Time Measurement
• Interval Start: Start • Interval End: Stop
Te Actor Filter fields allow us to specify a certain thread, which is not necessary in this case. A final click on the Test button will tell us that Tracealyzer can find some intervals in the trace data that matches the specified conditions. Aſter saving the Custom Intervals
definition, we can see that it appears in the Intervals and State Machines window, and that Tracealyzer has highlighted it in the Trace View. Now we can graph this interval timing, like we graphed the execution time of actors in the Actor Instance graph in a previous article. To do this, go to the Views menu and select Interval Plot – Select Set; see Figure 6. In the resulting window, highlight the
Figure 7: The graph
name of our custom interval and click OK, and a new graph appears which shows the duration of our intervals. We can improve that graph quite a bit, to make it easier to read and interpret; see Figure 7.
1. In that view, select the View menu and then Line Style – change it to No Lines.
2. Highlight the portion of the graph that contains the resulting dots.
3. Right-click and select Zoom to Selection.
Not surprisingly, all interval executions seem to have lasted about 25ms. Finally, clicking on one of these
datapoints reveals valuable timing information about our interval in the Selection Details view; see Figure 8. Te first box shows statistics on the length
of each interval, which would correspond to the execution time of the function of interest – unless the thread is pre-empted by a context switch, but that would be visible in the trace view. Te second box shows statistics on the time between executions of our function of interest; in our example, this would correspond to the time between a Stop event and the next Start event. Te third box shows how oſten each interval occurs – the time from a Start to the next Start. Te Interval Plot may be used to
identify any anomalous timing of the function of interest, and the information
Figure 8: Timing information view
in the Selection Details view can be used to gather high-level timing statistics. In summary, the majority of embedded-
soſtware developers will be developing userspace applications on their Linux- based embedded system. Tracealyzer, in conjunction with LTTng tracepoints, can be an invaluable tool to determine how well an application is performing, identify any anomalous behaviour and provide high-level timing statistics. Tracealyzer can then be used to further troubleshoot any timing issues and improve the performance of the application.
www.electronicsworld.co.uk May 2021 13
Page 1 |
Page 2 |
Page 3 |
Page 4 |
Page 5 |
Page 6 |
Page 7 |
Page 8 |
Page 9 |
Page 10 |
Page 11 |
Page 12 |
Page 13 |
Page 14 |
Page 15 |
Page 16 |
Page 17 |
Page 18 |
Page 19 |
Page 20 |
Page 21 |
Page 22 |
Page 23 |
Page 24 |
Page 25 |
Page 26 |
Page 27 |
Page 28 |
Page 29 |
Page 30 |
Page 31 |
Page 32 |
Page 33 |
Page 34 |
Page 35 |
Page 36 |
Page 37 |
Page 38 |
Page 39 |
Page 40 |
Page 41 |
Page 42 |
Page 43 |
Page 44