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

C:/temp/src/j2k/Deprecated/old_18mar_diff/nto/TimerPulseTest.cpp

Go to the documentation of this file.
00001 #ifndef __J2K__TimerPulseTest_CPP__
00002 #define __J2K__TimerPulseTest_CPP__
00003 
00004 #include <j2k/nto/TimerPulse.hpp>
00005 
00006 // 200 ms
00007 #define WAITING  200000000
00008 
00009 class TimerPulseTest : public TimerPulse {
00010 public:
00011 
00012  TimerPulseTest( ULONG clk = WAITING )
00013   : TimerPulse( clk ), loop( 0 ), avg( 0 ) { }
00014 
00015  virtual void tick( int signo )
00016  {
00017     if (avg < 1 ) {
00018       avg = loop;
00019     } else {
00020       avg = ( avg + loop ) / 2;
00021     }
00022 
00023     printf( "Enter handler with signal %d/%d [%d/%d].\n", \
00024              signo, TimerSignalEvent, loop, avg );
00025 
00026     loop = 0;
00027     printf( "End signal handler.\n" );
00028    fflush( stdout );
00029  }
00030 
00031  virtual void start() 
00032  {
00033    printf( "Timer started.\n" );
00034    fflush( stdout );
00035 
00036    TimerPulse::start();
00037  }
00038 
00039   size_t loop;
00040   size_t avg;
00041 };
00042 
00043 TimerPulseTest t( WAITING );
00044 
00045 int main() {
00046   t.start();
00047 
00048   for(;;) {  // Infinite loop
00049     t.loop++;
00050   }
00051 
00052   return 0;
00053 }
00054 
00055 #endif

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