search.noResults

search.searching

saml.title
dataCollection.invalidEmail
note.createNoteMessage

search.noResults

search.searching

orderForm.title

orderForm.productCode
orderForm.description
orderForm.quantity
orderForm.itemPrice
orderForm.price
orderForm.totalPrice
orderForm.deliveryDetails.billingAddress
orderForm.deliveryDetails.deliveryAddress
orderForm.noItems
EMBEDDED DEVICES


Instead, the combination of LTTng in Python and Tracealyzer highlights that it is the fundamental characteristic of the chosen algorithm that is the issue. This is invaluable when developing more complex algorithms. This example implementation serves as a reference on how the performance of future algorithm implementations can be evaluated. Implementing the core functions in separate Python modules is good programming practice in general, and this also simplifies the tracing of specific functions.


As the trace overhead is almost negligible, tracepoints can be kept in an application as it is tested on the target embedded system and even in production, allowing the Tracealyzer tool to generate performance metrics in the production codebase as well. This is tremendously useful for regular system testing and allows the same codebase to be used to ensure that the application is both functionally correct and performant, with only minimal changes.


Figure 2: Fib Interval Plot


Replacing the standard Python logger with one called “my-logger” allows Tracealyzer to show events in the tool’s Trace View. As Tracealyzer is not capturing any application data in this particular example, the software does not need to be configured to read data values. Instead, all that is needed is a Custom Interval that marks the entry and exit of both of these functions.


While a substantial performance difference can be seen in the Trace View above, Tracealyzer can also provide more tangible performance metrics. This can be done by going to Views and clicking on Intervals and State Machines and create a custom interval using the “Start” and “Stop” strings that were inserted with the logger.info() calls in the code and which mark the entry and exit of the candidate functions.


The Interval Plot shows that there is a 20x difference between the recursive algorithm (which was executed first) and the iterative


algorithm (which was executed second). In this example we only compute 10 Fibonacci numbers with each algorithm. Without Tracealyzer, many more iterations would probably be needed to gain some meaningful insight, but this is problematic for two reasons. First, when running the recursive Fibonacci algorithm up to 1000 (or even 100), Python will simply sit there. This would be concerning as it would not be clear whether this non-response is due to a bug in the implementation or something else. In this particular case, we can probably guess why this happens, but for more complex problems, substantial logging would be required to understand where the bottleneck is. Second, if there are multiple applications running on an embedded system, these other applications could be disrupting the target application, which would also increase the time for the algorithm or function to complete execution. Without a trace, there is no easy way to find out if this is the case.


Using Tracealyzer and LTTng to capture performance metrics in a Python application provides invaluable analysis of the implementation of an algorithm. The minimal overhead of this approach means the instrumentation of the code can be retained for use on a target embedded system. This enables more monitoring of the target application and boosts the analysis of interactions with other applications and the operating system as well. For example, there may be another process or thread that preempts the target application and impacts performance. The combination of Tracealyzer and LTTng can identify the causes of such anomalies, and this allows developers to refine the implementation to guard against further problems.


While the example implementation of the Fibonacci sequence is relatively innocuous, it highlights a key characteristic of the Python language that can inform the development of more complex implementations. This example also shows the value of using separate modules in the design. Using trace, developers can measure and validate the performance of the key core functions in these modules without significant overhead, before expanding into a full system implementation. This can help to demonstrate that an application is functionally correct and performant with minimal changes in the target environment.


Details on how to install the necessary software package can be found on LTTng’s website here: https://lttng.org/docs/v2.12/#doc- ubuntu.


MAB Labs www.mab-labs.com MARCH 2022 | ELECTRONICS TODAY 15


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