From eea57f81b8335a71e108019700027d9bf89d4436 Mon Sep 17 00:00:00 2001 From: curt Date: Wed, 14 Apr 2004 14:35:09 +0000 Subject: [PATCH] Add some end time estimation code to keep myself entertained while I wait for the program to finish. --- src/Prep/TGVPF/Makefile.am | 2 +- src/Prep/TGVPF/tgvpf.cxx | 16 ++++++++++++++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/Prep/TGVPF/Makefile.am b/src/Prep/TGVPF/Makefile.am index cfc3a09a..490d68e7 100644 --- a/src/Prep/TGVPF/Makefile.am +++ b/src/Prep/TGVPF/Makefile.am @@ -8,7 +8,7 @@ tgvpf_LDADD = \ $(top_builddir)/src/Lib/poly2tri/libpoly2tri.a \ $(top_builddir)/src/Lib/TriangleJRS/libTriangleJRS.a \ $(top_builddir)/src/Lib/vpf/libvpf.a \ - -lsgdebug -lsgbucket -lsgmisc -lsgmath -lsgio -lsgstructure -lsgxml \ + -lsgdebug -lsgbucket -lsgmisc -lsgmath -lsgio -lsgtiming -lsgstructure -lsgxml \ -lgenpolyclip -lz INCLUDES = -I$(top_srcdir)/src/Lib diff --git a/src/Prep/TGVPF/tgvpf.cxx b/src/Prep/TGVPF/tgvpf.cxx index 0a4092b7..a530ac56 100644 --- a/src/Prep/TGVPF/tgvpf.cxx +++ b/src/Prep/TGVPF/tgvpf.cxx @@ -32,6 +32,7 @@ #include #include #include +#include #include STL_IOSTREAM #include STL_STRING @@ -463,11 +464,22 @@ main (int argc, const char **argv) int type = feature.getTopologyType(); cerr << "Searching through " << nTopologies << " topologies" << endl; int nAttributes = attributes.size(); + SGTimeStamp start, now; + start.stamp(); + long start_sec = start.get_seconds(); TGPolygon mask; for (int i = 0; i < nTopologies; i++) { - if ((i % 10) == 0) - cerr << (double)i * 100.0 / (double)nTopologies << "% done ..." << endl; + if ((i % 50) == 0) { + now.stamp(); + long now_sec = now.get_seconds(); + double elapsed_min = (now_sec - start_sec) / 60.0; + double percent = (double)i / (double)nTopologies; + cerr << percent*100.0 << "% done ..."; + cerr << " total time = " << elapsed_min / percent; + cerr << " (min) finished in " << elapsed_min / percent - elapsed_min + << " minutes" << endl; + } if (feature.isTiled()) { VpfRectangle rect = feature.getTile(i).getBoundingRectangle(); if (!bounds.isOverlapping(vpf2tg(rect)))