Column: Embedded design
Figure 1: Tracealyzer windows: top, “Selection Details” view, and, bottom, “Actor Instances” graph
Actor Instance graph to Execution Time, we see that, on average, the execution time is about 3.3ms; see Figure 2. Now, let’s remove the printk call and see
what Tracealyzer shows. If we focus on the Actor Instance graph, with View set to Execution Time, we see Figure 3. The maximum execution time is now 14 microseconds, compared to the average time of 3.3 milliseconds with printk. This demonstrates the substantial overhead of a call to printk, which is expected, since it must handle many different cases to
support printing to the kernel log. Nonetheless, we should be careful when using printk or any of its derivatives liberally in an IRQ handler, since we don’t want to hinder its performance. Another interesting observation
we can make from Figure 3 is that execution time is pretty erratic. While the differences are in the microseconds, it’s useful to understand why there is such a large disparity. To determine what may be causing it, let’s shiſt back to Periodicity – From Ready; see Figure 4.
Here we can clearly see that something
is really wrong. During the middle portion of the capture, the IRQ handler is being called every 80ms as expected, although there are moments during the beginning and end of the capture when called much more often. We can also see that near the end of the capture, one instance of the execution happened after 325ms. This is because we never instructed the device in the IRQ handler to stop firing the interrupt. Since the interrupt is always present, the
www.electronicsworld.co.uk March 2021 09
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