Question

What tools do you know, other than those in Visual Studio, to analyze performance bottlenecks in a Windows CE/Mobile application? I'm looking for something like AQTime for CE/Mobile, to profile C/C++ applications compiled to native code.

Was it helpful?

Solution

I haven't found any such tools for WindowsMobile for native development.

The closest I've found is the EnTrek toolset (CodeSnitch / ProcMan), but they aren't really profiling tools. http://www.entrek.com/products.htm

What we did do is build own own profiling support into our own products using the Vistual Studio "/callcap" switch for VC++. Using that switch you can build a profiling library that dumps out timings and counts, whatever you like. It mostly works out well for us, but sometimes the overhead of these hook functions can be too much and it can skew the timing results to areas of massive number of function calls.

From the MSDN Docs:

The /callcap option causes the compiler to insert calls to profiling hooks at the beginning and end of each function.

You must compile profiling hooks without the callcap switch. If you compile the profiling hook functions with the callcap switch, the functions will perform infinite recursive calls to themselves.

The following code example, Callcaphooks.c, shows a profiling hook function, _CAP_Enter_Function, for compilation without callcap.

// File: callcaphooks.c

#include <stdio.h>
int main();

void _CAP_Enter_Function(void *p) 
{
    if (p != main) 
        printf("Enter function   (at address %p) at %d\n", 
            p, GetTickCount());
        return;
}
void _CAP_Exit_Function(void *p) 
{
    if (p != main) 
        printf("Leaving function (at address %p) at %d\n", 
            p, GetTickCount());
    return;
}

OTHER TIPS

Windows CE supports the Remote Call Profiler (if the OEM added support for it) out of the box. WinMo images, I believe, typically have support already in the images for it. For CE, you need to the IMAGEPROFILER environment variable set (usnder the project properties).

What's not clear in MSDN is how to instrument an app that isn't built with Platform Builder, but it's actually pretty simple. You have to add the /callcap swith to the compiler command line and add cecap.lib to your linker settings.

Of course you'll need a tool to capture and display the profiler data. For that you can use the evaluation version of Platform Builder (5.0 or 6.0) (the eval is free) or eVC 4.0 (also free).

For more info on the profiler's usage, Sue Loh from the CE core team has blogged a bit about it.

I have written a Call Graph profiler for Windows Mobile. It is currently (as of Jan 2010) in the Beta phase, and can be downloaded for free.

http://www.codeprophet.co.cc

HTH

-Zak

If you're doing .NET CF development, check out the Power Toys for .NET CF 3.5 for utilities that can help you pinpoint bottlenecks, especially memory-related ones.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top