X-Git-Url: https://fleuret.org/cgi-bin/gitweb/gitweb.cgi?p=folded-ctf.git;a=blobdiff_plain;f=chrono.cc;fp=chrono.cc;h=0000000000000000000000000000000000000000;hp=3ee78b0aae07d4bf3a141571527653ab6ad8205d;hb=a44d56305517dddd36027c2a84693f2785fd019a;hpb=346c6fdc3c36ca10142234cce291031064fa2b48
diff --git a/chrono.cc b/chrono.cc
deleted file mode 100644
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 . //
-// //
-// Written by Francois Fleuret //
-// (C) Idiap Research Institute //
-// //
-// Contact for comments & bug reports //
-///////////////////////////////////////////////////////////////////////////
-
-#include
-
-#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); }