热度 12
2013-1-15 19:16
1485 次阅读|
0 个评论
In a recent debate, one that reflects so many similar discussions over the decades, a couple of smart developers vehemently objected to using an RTOS in most systems. Their complaint is valid; an RTOS brings in plenty of chances for unexpected system behaviour. Scheduling isn't deterministic (using the most common approaches) and locks and priority problems can cause system hangs. But any abstraction has its own headaches. The use of an RTOS requires a new level of developer competence and use of different tools. I find that an operating system, despite the potential problems, can greatly improve a lot of systems. The RTOS is particularly problematic as it's really tough to see what is going on. But most vendors have visualisation tools. Examples include TraceX from Express Logic andµC/Probe from Micriµm. In this, the second decade of the 21st century, I think it would be foolish to develop an RTOS-based system without using a tool like these. Percepio has come out with an OS visualisation tool they call the Tracealyzer. It has a bit of recorder code that links into the firmware. Every event recorded on a kernel-call granularity (soon to be available down to the function-call level) stuffs four bytes of data into a buffer, which is passed to the Tracealyzer application on a PC. They claim a "typical" (whatever that means) application will generated about 10 KB/sec of data, and that the recorder's overhead will eat 1 to 3% CPU overhead on most processors. Over 22 views are offered, and the best way to describe this is by showing some of the screens. This screen shows kernel calls over time. I like the following screen, which shows where the CPU cycles are going: You can click on one of the peaks to get more detailed data. The next screen shows how the tool can display the value of a counting semaphore or size of a queue: Want to know the real-time relationship of various entities in your code? That's available as well: A huge number of filters make it easy to get more detailed views. The Tracealyzer needs to know quite a bit about the RTOS. Currently versions are available for FreeRTOS, OpenRTOS, SafeRTOS, RTXC Quadros, and On Time RTOS-32. Prices range from $2k for the most capable version to free for a stripped down product useable with FreeRTOS. Our applications are getting more complex all of the time, but tools like these make it easier to peer inside the code's behaviour.