Column: Embedded design
a substantial performance difference between them, more tangible performance metrics are needed. As discussed in previous articles, this can be achieved by going to Views and clicking on Intervals and State Machines. Clicking on Custom Intervals will create the following custom interval; see Figure 2. Te strings “Start” and “Stop” mark the
entry and exit of our candidate functions, so we’ll use them to mark the start and stop of our custom interval, too. Clicking on Save, the Trace View updates with a new red bar (to the right in Figure 3), which identifies our custom interval. Open the Interval Plot by clicking
on Views and then Interval Plot – Select Set. Adjust the view in the resulting graph so it shows no lines. You’ll immediately notice a 20x difference in performance between the recursive algorithm (which was executed first) and the iterative algorithm; see Figure 4. Tis shows that recursion is inherently
slow in Python! If we go back to our Python
implementation, we ran only ten iterations of each algorithm. Without Tracealyzer, we would need to run many more to gain some meaningful insight. Tis approach is problematic for two reasons: First, if you run the recursive algorithm with 1000 (or even 100) iterations, Python will simply sit there (try it!). Tis should be concerning to us as developers, since we don’t know whether the tremendous slowdown is due to a bug in implementation or something else entirely. Tis becomes even more relevant with the algorithm or implementation’s growing complexity, as more substantive logging will be required to understand where the bottleneck is. Second, if there are multiple other
applications running on our deployed embedded system, they could be disrupting our own application and increasing the time for our algorithm or function to complete execution. Without a trace, we would can’t tell if this was the case. Instead, the combination of LTTng in Python and Tracealyzer allowes us to discover a fundamental characteristic of the Python language that will be invaluable in developing more complex algorithms. Since tracepoints add minimal overhead, we can keep them in our application as we test it on our target embedded system. Tis allows
Figure 1: Events showing in the Trace View
Figure 2: Custom intervals
www.electronicsworld.co.uk July/August 2021 21
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 |
Page 45 |
Page 46 |
Page 47 |
Page 48 |
Page 49 |
Page 50 |
Page 51 |
Page 52 |
Page 53 |
Page 54 |
Page 55 |
Page 56 |
Page 57 |
Page 58