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
Column: Embedded design


Measure performance In the User Event Signal Plot, shown in Figure 3, we notice that there appear to be only two datapoints, even though we have called tracef 25 times. Zooming in reveals that there are multiple dots, and zooming in even further we can see all 25 invocations of the tracef function. Note that the value (Y axis) increases aſter 10 invocations, as the string length increases by one character! Also, clicking a dot causes Tracealyzer to highlight the corresponding invocation in the Trace View (leſt in Figure 3). Now, let’s try to use Tracealyzer to


Figure 5: Tracealyzer Interval view


measure the performance of a userspace application. In this specific example, we’re going to mimic a function that takes a certain amount of time with the Linux usleep function. We’re going to add a tracepoint before the function invocation, and another one aſter, to measure the time it takes for the function to complete:


#include <stdlib.h> #include <unistd.h> #include <lttng/tracef.h>


int main(void) {


int i;


for (i = 0; i < 25; i++) {


tracef(“Start: %d”, i); usleep(25000); tracef(“Stop: %d”, i); }


return 0; } Figure 6: The Views menu


value as a string, the Cast to Type column allows for parsing the string as an integer. Tis way, we can use the integer value in Tracealyzer views, such as the User Event Signal Plot. Casting, however, requires a purely numerical string, so it cannot be used in this case. We leave the mapping as is, and let Tracealyzer plot the message length to demonstrate the capability. Tere are better ways to log numerical values with LTTng-UST, as we show at a later date.


12 May 2021 www.electronicsworld.co.uk If we leave the columns as they are,


and click Next, then Next again in the following window, and Finish in the final window, we return to the main Event Interpretation window where we can can click Apply and Reload Trace. Once Tracealyzer has reloaded the trace, it’s time to go to work. Open the User Event Signal Plot view by clicking the User Events button in the leſt icon list.


In a real-world scenario, we would identify places in our application where execution time needs to be measured, and add the tracef invocations there. For example, a function may have multiple implementation candidates, and we want to evaluate the execution timing to find the fastest algorithm. Or, a function may be complex and we want to characterise its execution. Aſter compiling the above application,


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