Main Page   Packages   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Search  

C:/temp/src/j2k/Net/TFTP/TimerTest.cpp

Go to the documentation of this file.
00001 #ifndef __J2K__TimerTest_CPP__
00002 #define __J2K__TimerTest_CPP__
00003 
00004 #include <j2k/Net/TFTP/Timer.cpp>
00005 #include <j2k/Fred/Error/JError.cpp>
00006 
00007 // 200 ms
00008 #define WAITING  200000000
00009 
00010 class TimerTest : public Timer {
00011 public:
00012 
00013  TimerTest( ULONG clk )
00014   : Timer( clk ), loop( 0 ), avg( 0 ) { }
00015 
00016  virtual void timedRun( int signo )
00017  {
00018     if (avg < 1 ) {
00019       avg = loop;
00020     } else {
00021       avg = ( avg + loop ) / 2;
00022     }
00023 
00024     printf( "Enter handler with signal %d/%d [%d/%d].\n", \
00025              signo, TimerSignal, loop, avg );
00026 
00027     loop = 0;
00028     printf( "End signal handler.\n" );
00029  }
00030 
00031   size_t loop;
00032   size_t avg;
00033 };
00034 
00035 int main() {
00036   TimerTest t( WAITING );
00037   t.start();
00038 
00039   for(;;) {  // Infinite loop
00040     t.loop++;
00041   }
00042 
00043   return 0;
00044 }
00045 
00046 #endif

Generated on Sun Oct 14 18:46:26 2001 for Standard J2K Library by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001