Windows XP Service Pack 2 5.1 Build 2600 Windows directory: C:\\WINDOWS; System directory: C:\\WINDOWS\\SYSTEM32 Current user: Administrator Number of processors: 2 Processor: Intel(R) Pentium(R) D CPU 3.00GHz, Frequency: ~2992 MHz. Memory in use: 42% Total Physical Memory: 2,145,427,456 bytes; Available Physical Memory: 1,238,437,888 bytes; Total Virtual Memory: 2,147,352,576 bytes; Available Virtual Memory: 1,806,143,488 bytes; Virtual Memory In Use: 341,209,088 bytes Microsoft .NET Framework version: v2.0.50727 - Process create ID: 5592, Thread ID: 4216, Base address: 0x00400000 Run Mode: Normal Host Application: Parameters: Work Directory: 4216 15:18:31:000 Module loaded: D:\\Test\\LuboView\\Debug\\LuboView.exe; Base address: 0x00400000 Size: 3039232 Version: 1.0.0.1 ?????.. 4216 15:18:31:000 从以上事件信息中可以看到AQTIME在RUN之后,首先会获取如下一些信息: a).当前AQTIME的版本信息:
Product:Aqtime;Version:4.92.669.0 b).系统工作环境:
Host name:SOHU-ZGDM
OS:Microsoft Windows XP Service Pack 2 5.1 Build 2600 Windows directory: C:\\Windows
System directory:C:\\Windows\\SYSTEM32 Current user:Administrator Number of Processor:2
Processor:Inter? Pentinum? CPU 3.00GHz,Frequency:~2992MHz. Memory in use:42% Total Physical Memory:2,145,427,456 bytes; Available Physical Memory:1,238,437,888 bytes; Total Virtual Memory:2,147,352,576 bytes; Available Virtual Memory:1,806,143,488 bytes; Virtual Memory in Use: 341,209,088 bytes =2GB =1.15GB =2GB =1.68GB =325.4MB Microsoft.NET Framework version:v2.0.50727 c).运行参数。
因为没有在RUN->parameters下设置相关内容,所以此处为空。但这里有何作用还有待于将来继续实践。
d).创建进程,进程ID号为5592,线程ID号为4216,基址为0x00400000 e).加载程序:
D:\\Test\\LuboView\\Debug\\LuboView.exe; 基址:0x00400000 大小:3039232 版本:1.0.0.1 f).加载动态链接库:
C:\\Windows\\system32\\ntdll.dll 基址:0x7C920000 大小:591360
版本:5.1.2600.2180
??..加载其他动态链接库,如kernel32.dll,user32.dll,gdi32.dll
6).Monitor面板提示:
当前的profiler不支持Monitor面板;Disassembler面板和Editor面板中会显示汇编代码和VC源代码,前提配置了源代码文件的搜索路径。Details面板,Call Graph面板,Call Tree面板 没有内容。 7).LuboView软件加载曲线。
8).结束LuboView进程,查看AQtime的统计结果:
a).资源文件报告:点击侧边栏Last Results中Classes项
从以上分析结果可以看出,一共建立了图标类67个,而有57个没有释放;注册表类创建了376个,有29个没有释放;DC设备类有400个创建,14个没有释放;位图BitMap创建了236个,9个没有释放;PEN类创建了181个,全部释放?等等。并且在侧边栏的Last Results中有Errors相关的报告,报告内容主要是句柄无效。这可能与之前杀LuboView进程所造成的资源没有释放有关。
b).点击侧边栏中Objects项,如图:
从上可以看出,Report栏里是具体每个资源文件的信息,并且在下边的Details中可以看到函数调用的顺序。 c).切换到Summary显示方式:
从上图可以看到AQtime为程序测试结果总结了摘要信息: 共发生了375次错误,有138处资源文件的内存泄漏。
3.Performance Profiler测试
1).用Visual Studio 2005编写一个测试程序:
#include \
void ShowHello(); void ShowBye();
int _tmain(int argc, _TCHAR* argv[]) {
printf( \
for ( int i = 0 ; i < 1000; i++ ) {
ShowHello(); }
ShowBye();
return 0; }
void ShowHello() {
printf( \}
void ShowBye() {
printf( \}
2).设置编译版本为Release,编译程序。
3).打开AQtime,创建工程并加载编译好的Win32_Perfor_Test.exe程序.(如果Relase目录下的*.pdb不存在的话,无法进行测试。如果Relase目录不在源代码目录下,可能需要在Editor中设置路径。)
4).设置测试范围:在Areas下添加测试域“main”,并且设置测试级别为Line。 5).设置Profile的起始时间:在Trigger中添加当执行到Main函数时启动Profiler。
测试结果截图:
从截图中可以看到,ShowHello执行了1000次,所花费的时间为70867.67微秒,平均每次执行时间为70.87微秒。