Global/TimeStamp.cpp

Go to the documentation of this file.
00001 
00002 // #######################################################################
00003 
00004 // SSAHA : Sequence Search and Alignment by Hashing Algorithm
00005 // Version 3.2, released 1st March 2004
00006 // Copyright (c) Genome Research 2002
00007 
00008 // SSAHA is free software; you can redistribute it and/or modify 
00009 // it under the terms of version 2 of the GNU General Public Licence
00010 // as published by the Free Software Foundation.
00011  
00012 // This program is distributed in the hope that it will be useful,
00013 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00014 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015 // GNU General Public Licence for more details.
00016  
00017 // You should have received a copy of the GNU General Public Licence
00018 // along with this program; if not, write to the Free Software
00019 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00020 // or see the on-line version at http://www.gnu.org/copyleft/gpl.txt
00021 
00022 // #######################################################################
00023 
00024 // Module Name  : TimeStamp
00025 // File Name    : TimeStamp.cpp
00026 // Language     : C++
00027 // Module Author: Anthony J. Cox (ac2@sanger.ac.uk)
00028 
00029 // Description:
00030 
00031 // Includes:
00032 
00033 // ### Function Definitions ###
00034 
00035 // Name:
00036 // Arguments:
00037 // TYPE  NAME  IN/OUT COMMENT
00038 // Returns: TYPE COMMENT
00039 
00040 #include <fstream>
00041 #include <string>
00042 #include <time.h>
00043 #include <stdlib.h>
00044 #include "TimeStamp.h"
00045 
00046 
00047 Timer::Timer( void ) 
00048 : numStamps( 0 ), firstStamp( clock() ), lastStamp( firstStamp )
00049 {
00050 }
00051 
00052 Timer::~Timer( void )
00053 {
00054 }
00055 
00056 
00057 ostream& Timer::timeStamp( ostream& os )
00058 {
00059 
00060   clock_t now = clock();
00061 
00062   os << " Time stamp: "  << ++numStamps
00063      << "\t Since Start: " << now - firstStamp
00064      << "\t Since Last: "  << now - lastStamp << endl;
00065 
00066   lastStamp = now;
00067   return os;
00068 }
00069 
00070 ostream& operator<<( ostream& os, Timer& timer )
00071 {
00072   return timer.timeStamp(os);
00073 }
00074 
00075 
00076 
00077 // End of file TimeStamp.cpp
00078 
00079 
00080 
00081 
00082 

Generated on Fri Dec 21 13:12:15 2007 for ssaha by  doxygen 1.5.2