Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

phTimeList.h

Go to the documentation of this file.
00001 /* ---------------------------------------------------------------------------
00002     Phission : 
00003         Realtime Vision Processing System
00004 
00005     Copyright (C) 2003-2006 Philip D.S. Thoren (pthoren@cs.uml.edu)
00006     University of Massachusetts at Lowell,
00007     Laboratory for Artificial Intelligence and Robotics
00008 
00009     This file is part of Phission.
00010 
00011     Phission is free software; you can redistribute it and/or modify
00012     it under the terms of the GNU Lesser General Public License as published by
00013     the Free Software Foundation; either version 2 of the License, or
00014     (at your option) any later version.
00015 
00016     Phission is distributed in the hope that it will be useful,
00017     but WITHOUT ANY WARRANTY; without even the implied warranty of
00018     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00019     GNU Lesser General Public License for more details.
00020 
00021     You should have received a copy of the GNU Lesser General Public License
00022     along with Phission; if not, write to the Free Software
00023     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00024 
00025  ---------------------------------------------------------------------------*/
00026 #ifndef _PHTIMELIST_H
00027 #define _PHTIMELIST_H
00028 
00029 #include <phStandard.h>
00030 #include <phStdint.h>
00031 #include <phList.h>
00032 #include <phTime.h>
00033 #include <phTimeStamp.h>
00034 #include <phTimeInterval.h>
00035 
00036 /* ---------------------------------------------------------------------- */
00040 /* ---------------------------------------------------------------------- */
00046 PHAPI(class) phTimeList : public phMutex
00047 {
00048 private:
00049     FILE           *m_file;
00050 
00051     phList          m_list;
00052     phTimeInterval *m_list_end;
00053 
00054     phTimeStamp     m_elapsed;
00055     
00056     int             m_stopped;
00057     
00058     char           *m_label;
00059     uint32_t        m_length;
00060 
00061 public:
00062     phTimeList( char *label = NULL, FILE *file_desc = NULL );
00063     ~phTimeList();
00064 
00065     /* Allocates a new timestamp node and starts the counter */
00066     int start( char *label = NULL );
00067     int stop ();
00068 
00069     int empty();
00070     
00071     int setLabel( char *label );
00072 
00073     phTimeStamp elapsed();
00074     
00075     int report( int flag = phTIME_REPORT_SUM | phTIME_REPORT_ALL,
00076                 FILE *file_desc = NULL );
00077 };
00078 
00079 /* ---------------------------------------------------------------------- */
00080 /* from 'man gettimeofday' */
00081 /* Available macros, usually found in time.h 
00082  * 
00083  *  timerisset(tvp)
00084  *  timerclear(tvp)
00085  *  timercmp(a, b, CMP)     doesn't work for >= <=
00086  *  timeradd(a, b, result)
00087  *  timersub(a, b, result)
00088  */
00089 /* -------------------------------------------------------------------------
00090 # ifdef __USE_POSIX199309
00091 // Pause execution for a number of nanoseconds.  
00092 extern int nanosleep (__const struct timespec *__requested_time,
00093               struct timespec *__remaining) __THROW;
00094 
00095 
00096 // Get resolution of clock CLOCK_ID.  
00097 extern int clock_getres (clockid_t __clock_id, struct timespec *__res) __THROW;
00098 
00099 // Get current value of clock CLOCK_ID and store it in TP.  
00100 extern int clock_gettime (clockid_t __clock_id, struct timespec *__tp) __THROW;
00101 
00102 // Set clock CLOCK_ID to value TP.  
00103 extern int clock_settime (clockid_t __clock_id, __const struct timespec *__tp)
00104      __THROW;
00105 
00106 #  ifdef __USE_XOPEN2K
00107 // High-resolution sleep with the specified clock.  
00108 extern int clock_nanosleep (clockid_t __clock_id, int __flags,
00109                 __const struct timespec *__req,
00110                 struct timespec *__rem) __THROW;
00111 
00112 // Return clock ID for CPU-time clock.  
00113 extern int clock_getcpuclockid (pid_t __pid, clockid_t *__clock_id) __THROW;
00114 #  endif
00115  * ------------------------------------------------------------------------ */
00116 /* -----------------------------------------------------------------------
00117  *       char *asctime(const struct tm *tm);
00118        char *asctime_r(const struct tm *tm, char *buf);
00119 
00120        char *ctime(const time_t *timep);
00121        char *ctime_r(const time_t *timep, char *buf);
00122 
00123        struct tm *gmtime(const time_t *timep);
00124        struct tm *gmtime_r(const time_t *timep, struct tm *result);
00125 
00126        struct tm *localtime(const time_t *timep);
00127        struct tm *localtime_r(const time_t *timep, struct tm *result);
00128 
00129        time_t mktime(struct tm *tm);
00130 
00131       struct tm {
00132               int     tm_sec;         // seconds 
00133               int     tm_min;         // minutes 
00134               int     tm_hour;        // hours 
00135               int     tm_mday;        // day of the month 
00136               int     tm_mon;         // month 
00137               int     tm_year;        // year 
00138               int     tm_wday;        // day of the week 
00139               int     tm_yday;        // day in the year 
00140               int     tm_isdst;       // daylight saving time 
00141       };
00142 */
00143 
00144 #endif /* _PHTIMELIST_H */




Copyright (C) 2002 - 2007 Philip D.S. Thoren ( pthoren@users.sourceforge.net )
University Of Massachusetts at Lowell
Robotics Lab
SourceForge.net Logo

Generated on Sat Jun 16 02:44:02 2007 for phission by  doxygen 1.4.4