C:/Documents and Settings/Alessandro/Documenti/Programmazione/CodeBlocks/AudioDrome/include/AudioDrome/Timer.h

00001 /***************************************************/
00011 /***************************************************/
00012 
00013 #ifndef TIMER_H
00014 #define TIMER_H
00015 
00016 #include "AudioDrome.h"
00017 
00018 #if defined(_WIN32)
00019 #include <time.h>
00020 #else
00021 #include <sys/time.h>
00022 #include <sys/times.h>
00023 #endif
00024 
00025 #ifdef _SC_CLK_TCK
00026 static const long CLK_X_TCK = sysconf(_SC_CLK_TCK);
00027 #else
00028 #define CLK_X_TCK CLOCKS_PER_SEC
00029 #endif
00030 
00031 #if defined(_WIN32)
00032 
00033 inline unsigned long clocktick()
00034 {
00035     return (unsigned long) clock();
00036 }
00037 #else
00038 inline unsigned long clocktick()
00039 {
00040     static struct tms buf;
00041     return (unsigned long) times(&buf);
00042 }
00043 #endif
00044 
00045 
00046 class Timer : public AudioDrome
00047 {
00048 public:
00049     Timer (const float &sr=44100);
00050     virtual ~Timer ();
00051     unsigned long printTime ();
00052     void startTimer ();
00053     void resetTimer ();
00054     double elapsedTime ();
00055 
00056 protected:
00057     unsigned int _seconds;
00058     unsigned int _counter;
00059     unsigned long  time1, time2;
00060 };
00061 
00062 #endif

Generato il Tue Dec 26 14:42:31 2006 per AudioDrome da  doxygen 1.4.7