| 1. | Introduction to C++ |
| 2. | Variables, branching, and loops |
| 3. | Functions and recursions |
| 4. | Pointers |
| 5. | Linked lists |
| 6. | Stacks |
| 7. | Sequences |
| 8. | Pointers practice |
| 9. | References |
| 10. | Sorting |
| 11. | Object oriented programming |
| 12. | Trees in C++ |
| 13. | Balanced trees |
| 14. | Sets and maps: simplified |
| 15. | Sets and maps: standard |
| 16. | Dynamic programming |
| 17. | Vectors |
| 18. | Multi core programming and threads |
| 19. | Representation of integers in computers |
| 20. | Floating point representation |
| 21. | Templates |
| 22. | Inheritance |
| 23. | Pointers to functions |
Back to: 18. Multi Core Programming and Threads
Class SimpleTimer
The following code should be placed in a file SimpleTimer.cpp. The file should be in the same folder as the source file containing main function. The class SimpleTimer can be used if the directive #include "SimpleTimer.cpp" is placed in the source just below #include<iostream>.
This is how the class can be used to test the speed of a function or a block of code:
SimpleTimer tm; tm.begin(); //Block of code //whose speed we want to test tm.end(); std::cout << "The time it took to execute the block is: "; std::cout << tm.getTime() << "\n";