Created
March 2, 2017 18:36
-
-
Save ebetica/198a74aa13d5117d2eb3f00544da0802 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
#include <ctime> | |
#include <iostream> | |
#include "replayer.h" | |
using namespace std; | |
using namespace torchcraft::replayer; | |
int main() { | |
std::clock_t start; | |
double duration; | |
fstream repFile("/tmp/TL_PvP_GG10646.rep"); | |
//fstream repFile("/tmp/TL_ZvZ_TL359.rep"); | |
ofstream nextFile("/tmp/test_diff.rep"); | |
Replayer r; | |
start = clock(); | |
repFile >> r; | |
duration = ( std::clock() - start ) / (double) CLOCKS_PER_SEC; | |
cout<<"time to read: "<< duration <<'\n'; | |
r.setKeyFrame(-1); | |
start = clock(); | |
nextFile << r; | |
nextFile.close(); | |
duration = ( std::clock() - start ) / (double) CLOCKS_PER_SEC; | |
cout<<"time to write "<< duration <<'\n'; | |
ifstream redoFile("/tmp/test_diff.rep"); | |
Replayer r2; | |
start = clock(); | |
redoFile >> r2; | |
duration = ( std::clock() - start ) / (double) CLOCKS_PER_SEC; | |
cout<<"time to reread "<< duration <<'\n'; | |
for (size_t i=0; i<r.size(); i++) { | |
if (!detail::frameEq(r.getFrame(i), r2.getFrame(i))) { | |
cout << "Frame " << i << " is bad!" << endl; | |
} | |
} | |
r2.setKeyFrame(0); | |
ofstream checkFile("/tmp/test_undiff.rep"); | |
start = clock(); | |
checkFile << r2; | |
duration = ( std::clock() - start ) / (double) CLOCKS_PER_SEC; | |
cout<<"time to rewrite "<< duration <<'\n'; | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment