X-Git-Url: https://www.fleuret.org/cgi-bin/gitweb/gitweb.cgi?p=mtp.git;a=blobdiff_plain;f=mtp.cc;h=61dcc21692df4a0e69b9e315e8abc66998697683;hp=c982fae396df3d2f75074fa2c4033c969d6aebd7;hb=c752952df0dd1d781ec80f25c4b9418bddac1b9e;hpb=50cd066267d0041956d7bf9238665e5dc006c524 diff --git a/mtp.cc b/mtp.cc index c982fae..61dcc21 100644 --- a/mtp.cc +++ b/mtp.cc @@ -24,12 +24,20 @@ #include #include +#include using namespace std; #include "mtp_tracker.h" +scalar_t diff_in_second(struct timeval *start, struct timeval *end) { + return + scalar_t(end->tv_sec - start->tv_sec) + + scalar_t(end->tv_usec - start->tv_usec)/1000000; +} + int main(int argc, char **argv) { + timeval start_time, end_time; if(argc < 2) { cerr << argv[0] << " " << endl; @@ -42,13 +50,20 @@ int main(int argc, char **argv) { MTPTracker *tracker = new MTPTracker(); + cout << "Reading " << argv[1] << "." << endl; tracker->read(in_tracker); - cout << "Read " << argv[1] << endl; + cout << "Building the graph ... "; cout.flush(); + gettimeofday(&start_time, 0); tracker->build_graph(); - cout << "Starting to track ... "; cout.flush(); + gettimeofday(&end_time, 0); + cout << "done (" << diff_in_second(&start_time, &end_time) << "s)." << endl; + + cout << "Tracking ... "; cout.flush(); + gettimeofday(&start_time, 0); tracker->track(); - cout << "done." << endl; + gettimeofday(&end_time, 0); + cout << "done (" << diff_in_second(&start_time, &end_time) << "s)." << endl; ofstream out_traj("result.trj"); tracker->write_trajectories(&out_traj);