1 // Copyright (C) 2006-2021 CEA/DEN, EDF R&D, OPEN CASCADE
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 #include "utilities.h"
26 cntStruct* counters::_ctrs = 0;
27 int counters::_nbChrono = 0;
29 counters::counters(int nb)
31 MESSAGE("counters::counters(int nb)");
33 _ctrs = new cntStruct[_nbChrono];
35 for (int i = 0; i < _nbChrono; i++)
37 _ctrs[i]._ctrNames = 0;
38 _ctrs[i]._ctrLines = 0;
39 _ctrs[i]._ctrOccur = 0;
40 _ctrs[i]._ctrCumul = 0;
43 MESSAGE("counters::counters()");
51 void counters::stats()
53 MESSAGE("counters::stats()");
54 for (int i = 0; i < _nbChrono; i++)
55 if (_ctrs[i]._ctrOccur)
57 MESSAGE("Compteur[" << i << "]: "<< _ctrs[i]._ctrNames << "[" << _ctrs[i]._ctrLines << "]");
58 MESSAGE(" " << _ctrs[i]._ctrOccur);
59 MESSAGE(" " << _ctrs[i]._ctrCumul);
63 salome_chrono::salome_chrono(int i) :
66 //MESSAGE("chrono::chrono " << _ctr << " " << _run);
70 salome_chrono::~salome_chrono()
76 void salome_chrono::stop()
78 //MESSAGE("chrono::stop " << _ctr << " " << _run);
83 double elapse = double(_end - _start) / double(CLOCKS_PER_SEC);
84 counters::_ctrs[_ctr]._ctrOccur++;
85 counters::_ctrs[_ctr]._ctrCumul += elapse;