automatic commit
authorFrancois Fleuret <fleuret@moose.fleuret.org>
Mon, 13 Oct 2008 09:20:23 +0000 (11:20 +0200)
committerFrancois Fleuret <fleuret@moose.fleuret.org>
Mon, 13 Oct 2008 09:20:23 +0000 (11:20 +0200)
Makefile
chrono.cc [deleted file]
chrono.h [deleted file]
error_rates.cc
tools.h

index c4d2907..9b6f5da 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -44,7 +44,7 @@ TAGS: *.cc *.h
        etags --members -l c++ *.cc *.h
 
 folding: misc.o interval.o gaussian.o fusion_sort.o global.o tools.o \
-        progress_bar.o chrono.o \
+        progress_bar.o \
          jpeg_misc.o rgb_image.o rgb_image_subpixel.o param_parser.o \
          shared.o \
          storable.o \
diff --git a/chrono.cc b/chrono.cc
deleted file mode 100644 (file)
index 3ee78b0..0000000
--- a/chrono.cc
+++ /dev/null
@@ -1,64 +0,0 @@
-
-///////////////////////////////////////////////////////////////////////////
-// This program is free software: you can redistribute it and/or modify  //
-// it under the terms of the version 3 of the GNU General Public License //
-// as published by the Free Software Foundation.                         //
-//                                                                       //
-// This program is distributed in the hope that it will be useful, but   //
-// WITHOUT ANY WARRANTY; without even the implied warranty of            //
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      //
-// General Public License for more details.                              //
-//                                                                       //
-// You should have received a copy of the GNU General Public License     //
-// along with this program. If not, see <http://www.gnu.org/licenses/>.  //
-//                                                                       //
-// Written by Francois Fleuret                                           //
-// (C) Idiap Research Institute                                          //
-//                                                                       //
-// Contact <francois.fleuret@idiap.ch> for comments & bug reports        //
-///////////////////////////////////////////////////////////////////////////
-
-#include <string.h>
-
-#include "chrono.h"
-
-Chrono::Chrono() : _nb_ticks_per_second(scalar_t(sysconf(_SC_CLK_TCK))),
-                   _nb(0), _current(-1) { }
-
-void Chrono::print(ostream *os) {
-  scalar_t total_durations = 0;
-  for(int n = 0; n < _nb; n++) total_durations += _durations[n];
-  for(int n = 0; n < _nb; n++)
-    (*os) << "INFO CHRONO_" << _labels[n]
-          << " " << scalar_t(_durations[n] * 100) / total_durations << "%"
-          << " " << _durations[n] << " seconds"
-          << endl;
-}
-
-void Chrono::start(const char *label) {
-  if(_current >= 0) {
-    struct tms tmp;
-    times(&tmp);
-    _durations[_current] += scalar_t(tmp.tms_stime - _last.tms_stime)/_nb_ticks_per_second;
-  }
-
-  if(label) {
-    _current = 0;
-    while(_current < _nb && strcmp(_labels[_current], label) != 0)
-      _current++;
-    if(_current == _nb) {
-      if(_nb < _nb_max) {
-        strncpy(_labels[_nb], label, buffer_size);
-        _durations[_nb] = 0;
-        _nb++;
-      } else {
-        cerr << "Too many timers." << endl;
-        exit(1);
-      }
-    }
-  } else _current = -1;
-
-  times(&_last);
-}
-
-void Chrono::stop() { start(0); }
diff --git a/chrono.h b/chrono.h
deleted file mode 100644 (file)
index ef11ce8..0000000
--- a/chrono.h
+++ /dev/null
@@ -1,41 +0,0 @@
-
-///////////////////////////////////////////////////////////////////////////
-// This program is free software: you can redistribute it and/or modify  //
-// it under the terms of the version 3 of the GNU General Public License //
-// as published by the Free Software Foundation.                         //
-//                                                                       //
-// This program is distributed in the hope that it will be useful, but   //
-// WITHOUT ANY WARRANTY; without even the implied warranty of            //
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      //
-// General Public License for more details.                              //
-//                                                                       //
-// You should have received a copy of the GNU General Public License     //
-// along with this program. If not, see <http://www.gnu.org/licenses/>.  //
-//                                                                       //
-// Written by Francois Fleuret                                           //
-// (C) Idiap Research Institute                                          //
-//                                                                       //
-// Contact <francois.fleuret@idiap.ch> for comments & bug reports        //
-///////////////////////////////////////////////////////////////////////////
-
-#ifndef CHRONO_H
-#define CHRONO_H
-
-#include <sys/times.h>
-#include "misc.h"
-
-class Chrono {
-  struct tms _last;
-  scalar_t _nb_ticks_per_second;
-  static const int _nb_max = 32;
-  int _nb, _current;
-  char _labels[_nb_max][buffer_size];
-  scalar_t _durations[_nb_max];
-public:
-  Chrono();
-  void print(ostream *os);
-  void start(const char *label);
-  void stop();
-};
-
-#endif
index ae59d7c..6d429e6 100644 (file)
@@ -23,7 +23,6 @@
 #include "pose_cell_hierarchy.h"
 #include "boosted_classifier.h"
 #include "parsing_pool.h"
-#include "chrono.h"
 #include "materials.h"
 
 void compute_errors_on_one_image(int level,
diff --git a/tools.h b/tools.h
index 99b1ade..902879a 100644 (file)
--- a/tools.h
+++ b/tools.h
@@ -24,6 +24,9 @@
 #include <iostream>
 #include "misc.h"
 
+// This function is not trivial because it has to handle numerical
+// pitfalls due to the very large number of samples.
+
 scalar_t robust_sampling(int nb, scalar_t *weights, int nb_to_sample, int *sampled);
 
 void print_roc_small_pos(ostream *out,