Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "Timer.h"
- #include <iostream>
- #include <thread>
- #include <time.h>
- using namespace std;
- /*
- Iterations: 10000000
- Debug:
- 0.325603
- 1.27219
- 0.306712
- 1.12284
- 0.362648
- 1.14376
- Average:
- 0.994963
- 3.53879
- Subtracted function time:
- 2.543827
- Time per this_thread::get_id() call: 0.0000002543827
- Release:
- 0.0280782
- 0.149169
- 0.0310837
- 0.152756
- 0.0286644
- 0.151138
- Average:
- 0.0878263
- 0.453063
- Subtracted function time:
- 0.3652367
- Time per this_thread::get_id() call: 0.00000003652367
- */
- void doAThing()
- {
- }
- void doAThing2()
- {
- thread::id thing = this_thread::get_id();
- }
- void main()
- {
- long long ticksPerSec = Timer.GetTicksPerSecond();
- long long start = Timer.GetPreciseUTCTime();
- for (int i = 0; i < 10000000; ++i)
- {
- doAThing();
- }
- long long end = Timer.GetPreciseUTCTime();
- long long start2 = Timer.GetPreciseUTCTime();
- for (int i = 0; i < 10000000; ++i)
- {
- doAThing2();
- }
- long long end2 = Timer.GetPreciseUTCTime();
- cout << (double)(end - start) / (double)ticksPerSec << "\n" << (double)(end2 - start2) / (double)ticksPerSec;
- cout << "\n\n";
- system("pause");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement