Back to Top page.

EGMeasure.h

Go to the documentation of this file.
00001 /****************************************************************************
00002 
00003 $Id: EGMeasure.h,v 1.2 2002/11/08 03:47:38 motegi Exp $
00004 Copyright (C) 2002 Higuchi Lab. All rights reserved.
00005 
00006 *****************************************************************************/
00007 #ifndef INCLUDE__EGMEASURE_H__FILE
00008 #define INCLUDE__EGMEASURE_H__FILE
00009 
00010 #include <sys/times.h> // for gettimeofday(), timeval : system time
00011 #include <time.h>      // for times(), tms : system time
00012 #include <sys/time.h>  // for gettimeofday(), timeval : elapsed time
00013 #include <iosfwd>      // for ostream
00014 
00018 class EGMeasure {
00019 public:
00020   EGMeasure();
00021 
00022   void Start(std::ostream&);
00023   void Lap(std::ostream&);
00024   void Stop(std::ostream&);
00025 
00026 private:
00027   const long clocks_per_second;    // Clocks per second
00028   const unsigned output_precision; // Precision
00029 
00030   // For system time
00031   struct tms tms_start, tms_stop, tms_prev;
00032   // For elapsed time
00033   struct timeval timeval_start, timeval_stop, timeval_prev;
00034   struct timezone tzone;
00035 
00036   void DisplayDiff(std::ostream&, tms, tms, timeval, timeval);
00037   void DisplayS(std::ostream&, double);
00038 };
00039 
00040 #endif //INCLUDE__EGMEASURE_H__FILE
00041