qtime

How to measure function running time in Qt?

笑着哭i 提交于 2019-12-22 01:32:21
问题 I am calling argon2 - memory intensive hashing function in Qt and measuring its running time: ... QTime start = QTime::currentTime(); // call hashing function QTime finish = QTime::currentTime(); time = start.msecsTo(finish) / 1000.0; ... In argon2 library's test case, time is measured in another way: ... clock_t start = clock(); // call hashing function clock_t finish = clock(); time = ((double)finish - start) / CLOCKS_PER_SEC; ... I am calling the function exactly as they call in their test

How to measure function running time in Qt?

纵然是瞬间 提交于 2019-12-04 19:26:28
I am calling argon2 - memory intensive hashing function in Qt and measuring its running time: ... QTime start = QTime::currentTime(); // call hashing function QTime finish = QTime::currentTime(); time = start.msecsTo(finish) / 1000.0; ... In argon2 library's test case, time is measured in another way: ... clock_t start = clock(); // call hashing function clock_t finish = clock(); time = ((double)finish - start) / CLOCKS_PER_SEC; ... I am calling the function exactly as they call in their test case. But I am getting a twice bigger number (twice slower). Why? How to measure function running time