Skip to content

Instantly share code, notes, and snippets.

@ebetica
Created March 2, 2017 18:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ebetica/198a74aa13d5117d2eb3f00544da0802 to your computer and use it in GitHub Desktop.
Save ebetica/198a74aa13d5117d2eb3f00544da0802 to your computer and use it in GitHub Desktop.
#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