smx v4.1 Tech Note: Precise Profiling
by Ralph Moore
smx Architect
Tick timing accuracy is not adequate for measuring most embedded system operations. Even low-end processors can perform 500,000 instructions during a typical 10 ms tick. Using ticks for profiling is like measuring a 100-meter race with a clock that shows only hours! A better solution is needed.
The recently released smx v4.1 solves this problem by using the clock input to the tick counter as the time base for task run-time profiles, as well as event timestamps, and time measurements. For many low-end processors, this gives one instruction accuracy. For other processors, it is typically in the range of 2 to 25 instructions — much, much better than 500,000 instructions, for a tick.
Task profiling can be a valuable diagnostic tool. smx v4.1 maintains a run-time counter (RTC) in each task control block (TCB). Whenever a task runs, the time that it just ran is added to its RTC. Since the resolution is so fine, accurate run times can be determined very quickly and seldom-running tasks will show up even in short runs. RTCs are also maintained for all ISRs together and all LSRs together. At the end of each profile period, all RTCs are loaded into one column of the RTC array, then cleared for the next period. The number of samples (i.e. columns) and the profile period are controlled by the user.
At the end of a run, the RTC array is uploaded to smxAware, which runs on a PC. smxAware provides both graphical and textual displays of the profiles. The user can step through individual samples to see how task loading varies with time. This is helpful for tracking down a number of operational bugs such as task starvation, excessive waits, excessive computation times, etc. This operation is typically called “system tuning” or “panic time.”
smxAware will also show a composite picture of all profile samples, together. Since the profile period can be set as large as hundreds of seconds and the number of samples in the RTC array is limited only by available memory, it is possible to see system behavior over periods as long as a day. This, coupled with capability of smxAware to scan through profile samples, can be a valuable tool for tracking down rarely occurring system anomalies.
See the smx Advanced Features white paper for more information on smx profiling, and see the smxAware datasheet for more information on smxAware v4.1.
Copyright © 2013 by Micro Digital, Inc. All rights reserved. The information on this page is proprietary to Micro Digital, Inc. and may not be copied, stored, or transmitted, without written permission.
3/20/13
back to White Papers page
|