summaryrefslogtreecommitdiff
path: root/src/CDF/CDF_Timer.cxx
blob: 04d87bf3c292107258fc0d9090622e99bd09e005 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// File:	CDF_Timer.cxx
// Created:	Fri Jul 17 08:08:27 1998
// Author:	Jean-Louis Frenkel
//		<rmi@frilox.paris1.matra-dtv.fr>


#include <CDF_Timer.ixx>
#include <stdlib.h>

CDF_Timer::CDF_Timer() {
  myTimer.Start();
}


void CDF_Timer::ShowAndRestart(const Standard_CString aMessage) {
  if(MustShow()) {
    Show(aMessage);
    myTimer.Reset();
    myTimer.Start();
  }
}
  
void CDF_Timer::ShowAndStop(const Standard_CString aMessage) {
  if(MustShow()) {
    Show(aMessage);
    myTimer.Stop();
  }
}
 
void CDF_Timer::Show(const Standard_CString aMessage) {
  Standard_Integer minutes,hours; Standard_Real seconds,CPUtime;
  myTimer.Show(seconds,minutes,hours,CPUtime);
  cout << aMessage << hours << "h " << minutes << "' " << seconds << "'' (cpu: " << CPUtime << ")" << endl;
}
Standard_Boolean CDF_Timer::MustShow() {
  static Standard_Boolean theMustShow=getenv("STORETIMER") != NULL;
  return theMustShow;
}