15,471
社区成员
发帖
与我相关
我的任务
分享
#include <windows.h>
#define __RUNTIME__ 100u /* second */
void main() {
DWORD bgn, start, i;
__int64 cnt = 0;
start = GetTickCount();
bgn = start;
do {
for (i = 0; i < 10000; ++i) {
#if 1
delete (new int()); /* run up to about 3,000,000 times per second */
#else
__asm nop; /* run up to about 1,500,000,000 times per second */
#endif
}
cnt += 10000;
if (GetTickCount() - bgn > 1000) {
cout << cnt << endl;
cnt = 0;
bgn = GetTickCount();
}
} while (GetTickCount() - start < __RUNTIME__ * 1000);
return;
}
#include <windows.h>
#define __RUNTIME__ 100u /* second */
void main() {
DWORD bgn, start;
DWORD cnt = 0;
start = GetTickCount();
bgn = start;
do {
#if 1
delete (new int()); /* run up to about 2,500,000 times per second */
#else
__asm nop; /* run up to about 45,000,000 times per second */
#endif
cnt += 1;
if (GetTickCount() - bgn > 1000) {
cout << cnt << endl;
cnt = 0;
bgn = GetTickCount();
}
} while (GetTickCount() - start < __RUNTIME__ * 1000);
return;
}