Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Code profiling / performance analysis tools for Windows CE/Mobile

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.

like image 631
Fabio Ceconello Avatar asked Nov 02 '08 00:11

Fabio Ceconello


2 Answers

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.

like image 148
ctacke Avatar answered Sep 16 '22 22:09

ctacke


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;
}
like image 44
Shane Powell Avatar answered Sep 17 '22 22:09

Shane Powell