327. Profiler Implementation Example

PreviousUpNext
Up: Profiling Interface Next: MPI Library Implementation Example Previous: Miscellaneous Control of Profiling

A profiler can accumulate the total amount of data sent by the MPI_SEND function, along with the total elapsed time spent in the function as the following example shows:


Example

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


PreviousUpNext
Up: Profiling Interface Next: MPI Library Implementation Example Previous: Miscellaneous Control of Profiling


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

(Unofficial) MPI-3.1 of June 4, 2015
HTML Generated on June 4, 2015