posted on Friday, August 26, 2005 2:06 PM
by
jritmeijer
Performance monitoring PocketPC applications
Even though I am not officially a developer anymore, every once in a
while I like to get my hands dirty and develop something that solves a
problem that the developers in my company are struggling with. Today
the problem is performance monitoring a PocketPC / Windows mobile 1st
& 2nd edition / Windows CE (etc. etc.) device.
Sure there are some utilities that allow you to ‘trace’ what is
going on in your .net CF application or show you the current status of
your battery, but few, if any, allow a combination of statistics to be
logged and analysed across all running applications in real time.
To solve this problem I developed a new product aptly, or badly, named Perfy,
which is a universal framework that allows you to quickly expose
anything as a standard windows performance counter by writing a simple
plug-in. The first plug-in I wrote exposes a number of key Windows CE
statistics such as available memory, remaining battery life, remaining
backup battery life etc without needing to install anything on the
PocketPC device, which minimises the Uncertainty Principle ;-)
At the time I wrote this application the development team was
struggling with 2 problems; evaluating the battery life of a number of
hardware platforms under different circumstances (WiFi, Bluetooth,
backlight etc) and tracking down a memory leak in our popular GolfMate application.
The first task was now easy, just run Perfy, start the Windows Performance monitor, add a counter for Windows CE Counters / % Remaining battery life
and either visually inspect the results over time or log it all to a
CSV file for Graphing in Excel. The outcome was very interesting, some
manufacturers who shall remain nameless quoted us with a battery life
of 27 hours while in the real world it was less than 6, imagine that on
the 17th hole, bye bye scores.

After some experimenting, after all Perfy makes this task easy, we
were able to select a suitable hardware platform (17 hours of
battery!!) and move on to the next task.
The second task, tracking down a small memory and performance leak,
was a bit more difficult as the GolfMate continuously runs 2 Compact
Framework applications as well as a C++ application that hosts the
Flash based user interface in the Macromedia Flash 6 ActiveX control.
Pfew, quite a mouth full…

Again, using Perfy and the Windows CE Counters / Available Physical Memory
performance counter we were able to track down using a process of
elimination, AKA the Art of Deduction, which component was leaking. For
those who are interested one of the threads dealing with the Bluetooth
based GPS device was restarted at an interval even when the previous
thread had not finished due to a blocking Bluetooth connection. This
all added up over time and caused a resource leak.
I will publish some information in the future about how to write a
plug-in for Perfy to expose your own counters. The next set of counters
I plan to add are the ones for my multi meter that can expose interesting data such as a unit’s temperature and charging voltage to the PC over RS232.