projects
/
mtp.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Moved the heap-related methods in the Vertex class, made them inline.
[mtp.git]
/
mtp.cc
diff --git
a/mtp.cc
b/mtp.cc
index
16f0526
..
61dcc21
100644
(file)
--- a/
mtp.cc
+++ b/
mtp.cc
@@
-22,16
+22,22
@@
*
*/
*
*/
-// Multi-Tracked Path
-
#include <iostream>
#include <fstream>
#include <iostream>
#include <fstream>
+#include <sys/time.h>
using namespace std;
using namespace std;
-#include "tracker.h"
+#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) {
int main(int argc, char **argv) {
+ timeval start_time, end_time;
if(argc < 2) {
cerr << argv[0] << " <tracker file>" << endl;
if(argc < 2) {
cerr << argv[0] << " <tracker file>" << endl;
@@
-42,13
+48,22
@@
int main(int argc, char **argv) {
if(in_tracker->good()) {
if(in_tracker->good()) {
-
Tracker *tracker = new
Tracker();
+
MTPTracker *tracker = new MTP
Tracker();
+ cout << "Reading " << argv[1] << "." << endl;
tracker->read(in_tracker);
tracker->read(in_tracker);
- cout << "Read " << argv[1] << endl;
+ cout << "Building the graph ... "; cout.flush();
+ gettimeofday(&start_time, 0);
tracker->build_graph();
tracker->build_graph();
+ 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();
tracker->track();
+ 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);
ofstream out_traj("result.trj");
tracker->write_trajectories(&out_traj);