perform profiling on windows ce
2010-07-01 20:07
225 查看
Profiling is an effective way of finding out bottlenecks in an application. On windows ce platform, profiling can also be done easily.
To perform profiling for native code, we can use the /callcap compiler option to enable callcap profiling. After it's enabled, the compiler will inject method invocation to _CAP_Enter_Function and _CAP_Exit_Function upon entering and returnning from a function respectively. We can print or log current time in these method to achieve profiling.
It's notable that while compiling the source file contains _CAP_Enter_Function and _CAP_Exit_Function's definition, we must disable /callcap option, otherwise, these function will call themself recursively. In most cases, it's a wise idea to create a library project to implement these profiling hook fuction and trun /callcap off for the project. Then link the library to other applications to be profiled.
For demonstration, here is a visual studio project shows how to do profiling:
http://code.google.com/p/rxwen-blog-stuff/source/browse/trunk/wince/ce_profiling/
After we run the application, we get below output:
Enter function (at address 00011068) at 73875892
Enter function (at address 00011030) at 73875897
Enter function (at address 00011000) at 73875902
bar
Leaving function (at address 00011000) at 73876907
foo
Leaving function (at address 00011030) at 73879912
Leaving function (at address 00011068) at 73879916
As you can see, it's a very rough sample that only prints the address of function being called. Not convenient to analyse. We may improve it by mapping and translating the address to function name, because we, as the application developer, possess the private symbol file. This task doesn't need to be done on the windows ce box, it's much easier to save the log file then parse and analyse it on a pc.
References:
Remote call profiler
A tour of windows ce performance tools
To perform profiling for native code, we can use the /callcap compiler option to enable callcap profiling. After it's enabled, the compiler will inject method invocation to _CAP_Enter_Function and _CAP_Exit_Function upon entering and returnning from a function respectively. We can print or log current time in these method to achieve profiling.
It's notable that while compiling the source file contains _CAP_Enter_Function and _CAP_Exit_Function's definition, we must disable /callcap option, otherwise, these function will call themself recursively. In most cases, it's a wise idea to create a library project to implement these profiling hook fuction and trun /callcap off for the project. Then link the library to other applications to be profiled.
For demonstration, here is a visual studio project shows how to do profiling:
http://code.google.com/p/rxwen-blog-stuff/source/browse/trunk/wince/ce_profiling/
After we run the application, we get below output:
Enter function (at address 00011068) at 73875892
Enter function (at address 00011030) at 73875897
Enter function (at address 00011000) at 73875902
bar
Leaving function (at address 00011000) at 73876907
foo
Leaving function (at address 00011030) at 73879912
Leaving function (at address 00011068) at 73879916
As you can see, it's a very rough sample that only prints the address of function being called. Not convenient to analyse. We may improve it by mapping and translating the address to function name, because we, as the application developer, possess the private symbol file. This task doesn't need to be done on the windows ce box, it's much easier to save the log file then parse and analyse it on a pc.
References:
Remote call profiler
A tour of windows ce performance tools
相关文章推荐
- windows安装rabbitmq报错Error: unable to perform an operation on node ''. Please see diagnostics...
- windows安装rabbitmq报错Error: unable to perform an operation on node ''. Please see diagnostics...
- use googletest on windows ce
- How to use ActiveSync Remote Display on Windows Embedded CE 6
- DumpMem and Monster - Virtual Memory Explorers on Windows Mobile/CE
- windows安装rabbitmq报错Error: unable to perform an operation on node ''. Please see diagnostics...
- windows安装rabbitmq报错Error: unable to perform an operation on node ''. Please see diagnostics...
- windows安装rabbitmq报错Error: unable to perform an operation on node ''. Please see diagnostics...
- capture network traffic on windows ce
- Windows下RabbitMQ报错:Error: unable to perform an operation on node
- windows安装rabbitmq报错Error: unable to perform an operation on node ''. Please see diagnostics...
- use googletest on windows ce
- windows安装rabbitmq报错Error: unable to perform an operation on node ''. Please see diagnostics...
- Windows下安装RabbitMQ报错:unable to perform an operation on node时的解决方案
- capture network traffic on windows ce
- use googletest on windows ce
- Implement the OEM Power Management on Windows CE
- Get all running services on Windows CE
- Turn on/turn off BlueTooth Radio mode in Windows CE(如何在wince中设置蓝牙的无线模式,以使其可被查找到)
- Loading USB Composite Functional Device on Windows CE USB Composite Function Driver