Created
December 12, 2018 19:00
-
-
Save onsah/c34cbb68ad29d78618db40ff72302a49 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int main() | |
{ | |
std::chrono::time_point< std::chrono::system_clock > startTime; | |
std::chrono::duration< double, std::milli > elapsedTime; | |
for (int i = 0; i < MAX_VALUE; i += 10000000) { | |
startTime = std::chrono::system_clock::now(); | |
for (int j = 0; j < REPEAT; ++j) { | |
//call the function | |
int result = fib(i); | |
} | |
elapsedTime = std::chrono::system_clock::now() - startTime; | |
double avg = elapsedTime.count() / REPEAT; | |
std::cout << avg << '\n'; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int main() | |
{ | |
std::chrono::time_point< std::chrono::system_clock > startTime; | |
std::chrono::duration< double, std::milli > elapsedTime; | |
for (int i = 0; i < MAX_VALUE; ++i) { | |
startTime = std::chrono::system_clock::now(); | |
//call the function | |
int result = fib(i); | |
elapsedTime = std::chrono::system_clock::now() - startTime; | |
std::cout << elapsedTime.count() << '\n'; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment