perform profiling on windows ce
来源:互联网 发布:穆雅斓淘宝店 编辑:程序博客网 时间:2024/05/06 04:38
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:
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
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
- perform profiling on windows ce
- Windows CE 6 On Mini2440
- use googletest on windows ce
- use googletest on windows ce
- Windows CE 5.0 Device Emulator on Windows2003
- capture network traffic on windows ce
- Enabling ClearType on Windows CE 6.0
- PERFORM ... ON COMMIT.
- Resolving Symbols Manually on Windows CE (ADDRESS --> SYMBOL)
- Windows CE 6.0 post-build on WIN7 64 bits machine
- Windows CE
- Windows CE
- windows CE
- windows ce
- windows ce
- Windows CE
- Windows CE
- Soot 学习笔记 8:More on profiling
- SqlServer2005还原SqlServer2000的数据库
- 3067 Japan 树状数组
- vim使用之程序调试-Vimgdb
- 先写一篇试试
- performance impact of printf
- perform profiling on windows ce
- 关于IE8 window.open问题
- 第一篇
- spring+struts的集成(第二种集成方案,用得最多的方案)
- View,布局
- 两台笔记本电脑,通过无线网络共享上网
- 激发个人创新的六种方法
- 再谈最终一致
- Row Chaining and Row Migration