I'm building a project that compares some methods for singleton in terms of speed.
What I'm trying to do is ask users to input how many times they want to run each method, loop through them, and count CPU tick.
Problem is CPU thick is all 0. What should I do?
Here's my code:
int numOfCalls;
cout << "How many calls do you want for each?";
cin >> numOfCalls;
clock_t beg, end;
beg = clock();
for (size_t i = 0; i != numOfCalls; i++)
Object* p = GofFixed::instance_GofFixed();
end = clock();
cout << (beg-end) / CLOCKS_PER_SEC << endl;
beg = clock();
for (size_t i = 0; i != numOfCalls; i++)
Boost::instance_Boost();
end = clock();
cout << (beg - end) / CLOCKS_PER_SEC << endl;