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/PCBuffer.cpp File Reference

#include <math.h>
#include <iostream.h>
#include "PCBuffer.hpp"
#include "Basic_PThread.cpp"
#include "Mutex.cpp"
#include "RWLock.cpp"
#include "Semaphore.cpp"
#include "BoundedBuffer.cpp"
#include "Timer.cpp"
#include "TimerPulse.cpp"

Go to the source code of this file.

Compounds

class  Timing

Defines

#define ADD   ( 0.500000000 )
#define WAITING   ( 500000000 )
#define BILLION   ( 1000000000 )
#define RANDOM   250
#define TSEC   0
#define TT   Timer

Functions

Timing timer ((500000000))
int main ()


Define Documentation

#define ADD   ( 0.500000000 )
 

Definition at line 16 of file PCBuffer.cpp.

#define BILLION   ( 1000000000 )
 

Definition at line 18 of file PCBuffer.cpp.

#define RANDOM   250
 

Definition at line 20 of file PCBuffer.cpp.

#define TSEC   0
 

Definition at line 21 of file PCBuffer.cpp.

#define TT   Timer
 

Definition at line 23 of file PCBuffer.cpp.

#define WAITING   ( 500000000 )
 

Definition at line 17 of file PCBuffer.cpp.


Function Documentation

int main void   
 

Definition at line 187 of file PCBuffer.cpp.

00187            {
00188    NoColor = 1;
00189 
00190    slot = new Semaphore*[ BBSIZE+1 ];
00191 
00192    for( int k = 0; k <= BBSIZE; k++ )
00193    {
00194      char buf[80]; 
00195      sprintf( buf, "slot%d", k );
00196 
00197      int c = (9+k)%15;
00198 
00199      if ( c < 8 ) c += 10; 
00200      slot[k] = new Semaphore( 1, buf, c );
00201    }
00202 
00203    fixprio( 10 );
00204 
00205    Producer p1( 1 );
00206    Consumer c1( 1 );
00207    Consumer c2( 2 );
00208 
00209    p1.start( 10 );
00210    c1.start( 10 );
00211    c2.start( 10 );
00212 
00213    timer.start();
00214    _uint64 prgStart = timer.getCycles();
00215 
00216    p1.join();
00217    c1.join();
00218    c2.join();
00219 
00220    fixprio( 6 );
00221    sched_yield();
00222 
00223    int i = 0;
00224    while( done < 3 )
00225    {
00226       if ( ++i > 10 ) exit( 0 );
00227       printf( "M " );
00228       sched_yield();
00229    }
00230 
00231    QBColor( 14 );
00232    printf( "Total program took %6.2f ms. Last time the timer was triggered %6.2f ms \n",
00233            (double)timer.getElapsed( prgStart ) * 1000, timer.getTime() * 1000 );
00234 
00235    QBColor(); 
00236    printf( "\n\nDone!\n");
00237 
00238    delete slot;
00239 
00240    exit( 0 );
00241    return 0;
00242 }

Timing timer (500000000)   
 


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