286. Profiler Implementation


Up: Examples Next: MPI Library Implementation Previous: Examples

Suppose that the profiler wishes to accumulate the total amount of data sent by the MPI_SEND function, along with the total elapsed time spent in the function. This could trivially be achieved thus


static int totalBytes; 
static double totalTime; 
 
int MPI_SEND(void * buffer, const int count, MPI_Datatype datatype, 
             int dest, int tag, MPI_comm comm) 
{ 
   double tstart = MPI_Wtime();       /* Pass on all the arguments */ 
   int extent; 
   int result    = PMPI_Send(buffer,count,datatype,dest,tag,comm);    
 
   MPI_Type_size(datatype, &extent);  /* Compute size */ 
   totalBytes += count*extent; 
 
   totalTime  += MPI_Wtime() - tstart;         /* and time          */ 
 
   return result;                        
} 



Up: Examples Next: MPI Library Implementation Previous: Examples


Return to MPI-2.1 Standard Index
Return to MPI Forum Home Page

MPI-2.0 of July 1, 2008
HTML Generated on July 6, 2008