1
0
Fork 0
You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
684 B
C++

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

#include "Utilities.h"
#include <iostream>
using namespace std;
MemoryMonitor mm, mm2;
int main()
{
// 测试时间
Timer timer;
timer.start();
//start以后运行需要运行的代码
for (int i = 0; i < 100000000; i++) {}
timer.stop();
// stop后停止计时
cout << timer.diff_in_ms() << endl; //输出所用ms
// 测试内存需要在debug模式下进行
// 开始前重置
mm.reset();
// 运行一些访问内存的代码
LPVOID p, q, r, s;
p = malloc(200);
cout << mm.save() << endl;
free(p);
q = malloc(150);
r = malloc(150);
free(q);
s = malloc(100);
free(r);
free(s);
// 显然应该输出300
cout << mm.save() << endl;
return 0;
}