Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- DWORD start = ::GetTickCount(); // start counter
- // all the things your program does
- DWORD end = ::GetTickCount(); // stop counter
- DWORD duration = end - start;
- std::cout << "Duration: " << duration << " ms" << std::endl;
- #include <QDebug>
- #include <QElapsedTimer>
- #define CONCAT_(x,y) x##y
- #define CONCAT(x,y) CONCAT_(x,y)
- #define CHECKTIME(x)
- QElapsedTimer CONCAT(sb_, __LINE__);
- CONCAT(sb_, __LINE__).start();
- x
- qDebug() << __FUNCTION__ << ":" << __LINE__ << " Elapsed time: " << CONCAT(sb_, __LINE__).elapsed() << " ms.";
- CHECKTIME(
- // any code
- for (int i=0; i<1000; i++)
- {
- timeConsumingFunc();
- }
- )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement