c++ Builder 测试代码执行的时间,精确到毫秒

unsigned long T1 = GetTickCount();//测试开始

doSomeThing...

unsigned long T2 = GetTickCount();//测试结果

sstr += IntToStr(T2-T1) = ",";  //测试结果,逗号分隔              

char dir[MAX_PATH];
char *tfile = "/test.ini";//ini路径
//将程序现在目录所在输入此字符数组
::GetCurrentDirectory(MAX_PATH,dir);
//将现在目录加上指定文件名
strcat(dir,tfile);
TIniFile *ini = new TIniFile(dir);
try
{
    ini->WriteString("test","time",sstr);//保存测试结果到INI
}
catch(...)
{
    Application->MessageBoxA("写入配置文件test.ini失败!",NULL,MB_OK+16);
    delete ini;
    exit(-1);
}
delete ini;


黑色头发:http://heisetoufa.iteye.com/

你可能感兴趣的:(C++,c,C#,C++Builder)