IT-개발/C및C++
동작 시간 계산 방법 (1)
갱우덩
2018. 12. 28. 09:53
반응형
특정 Code 구간 동작 시간 계산하는 Code
#include <string>
#include <vector>
#include <iostream>
#include <ctime>
int main()
{
std::clock_t b, e;
std::vector<std::string*> v;
std::string s = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
b = std::clock();
for(size_t i = 0; i < 10000000; ++i)
v.push_back(&s);
e = std::clock();
std::cout << "Time: " << (double(e - b)/CLOCKS_PER_SEC) << '\n';
}