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

Producer Class Reference

#include <PCBuffer.hpp>

Inheritance diagram for Producer::

Basic_PThread List of all members.

Public Methods

 Producer (int n=1, int i=0)
virtual void run ()

Private Attributes

int item
int name
_uint64 started
double elapsed
double total

Constructor & Destructor Documentation

Producer::Producer int    n = 1,
int    i = 0
 

Definition at line 79 of file PCBuffer.cpp.

00080    : Basic_PThread(), item( i ), name( n ), 
00081      started( 0 ), elapsed( 0.0 ), total( 0.0 ) { }


Member Function Documentation

void Producer::run   [virtual]
 

Reimplemented from Basic_PThread.

Definition at line 83 of file PCBuffer.cpp.

00084    {
00085      QBColor();
00086      printf( "\nProducer %u started. ", name );
00087      fixprio( 8 );
00088      sched_yield();
00089 
00090      for(;;) 
00091      {
00092        if ( ++item > STEPS ) break;
00093 
00094        register size_t where = item % BBSIZE;
00095 
00096        slot[ where ]->P();  // Slot is free ?
00097        sender.P();          // Take write control
00098 
00099        started = timer.getCycles();
00100 
00101        boundedBuffer.enqueue( item );
00102 
00103        QBColor();
00104        printf( 
00105          "\nProducer %u produced component %2u in slot %2u. ",
00106          name, item, where
00107        );
00108 
00109        elapsed  = timer.getElapsed( started ); 
00110        total   += elapsed;
00111 
00112        elapsed *= 1000;
00113        printf( "\nProducer %u took %4.2f ms. ", name, elapsed );
00114        fflush( stdout );
00115 
00116        sender.V();    // Another sender can have control
00117        message.V();   // One message completed
00118 
00119      } // End of infinite loop
00120 
00121      QBColor( 12 );
00122      printf( "\nProducer %u terminates. Total time spent %6.2f ms. \n", name, total*1000 );
00123      QBColor();
00124      fflush( stdout );
00125      ++done;
00126    }


Member Data Documentation

double Producer::elapsed [private]
 

Definition at line 44 of file PCBuffer.hpp.

int Producer::item [private]
 

Definition at line 41 of file PCBuffer.hpp.

int Producer::name [private]
 

Definition at line 42 of file PCBuffer.hpp.

_uint64 Producer::started [private]
 

Definition at line 43 of file PCBuffer.hpp.

double Producer::total [private]
 

Definition at line 45 of file PCBuffer.hpp.


The documentation for this class was generated from the following files:
Generated on Sun Oct 14 18:49:31 2001 for Standard J2K Library by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001