summaryrefslogtreecommitdiffstats
path: root/pablo
diff options
context:
space:
mode:
authorDan Wells <dwells@cs.uiuc.edu>2002-04-22 18:14:00 (GMT)
committerDan Wells <dwells@cs.uiuc.edu>2002-04-22 18:14:00 (GMT)
commitb60521774f32a8ce04189e2176f162e7e9608f23 (patch)
tree4d396f2381c011674c4581053f9cf30bee46be4c /pablo
parente5fc40662c6520edc50c7e68c96e24eb766972f2 (diff)
downloadhdf5-b60521774f32a8ce04189e2176f162e7e9608f23.zip
hdf5-b60521774f32a8ce04189e2176f162e7e9608f23.tar.gz
hdf5-b60521774f32a8ce04189e2176f162e7e9608f23.tar.bz2
[svn-r5220]
Purpose: Bug Fix Description: Users could not trace MPI programs when library wasn't compiled for parallel execution Solution: Allow Pablo Trace library to set the processor number and generate the filenames for each processor. Platforms tested: Sun Workstation, HP VClass, Irix 64
Diffstat (limited to 'pablo')
-rw-r--r--pablo/Makefile.in2
-rw-r--r--pablo/PabloHDF.c40
-rw-r--r--pablo/PabloHDF_MPIO.c44
-rw-r--r--pablo/PabloHDF_RT.c367
-rw-r--r--pablo/PabloHDF_SDDF.c934
-rw-r--r--pablo/ProcTrace.h2
6 files changed, 671 insertions, 718 deletions
diff --git a/pablo/Makefile.in b/pablo/Makefile.in
index d4cc451..5b7c9ea 100644
--- a/pablo/Makefile.in
+++ b/pablo/Makefile.in
@@ -164,7 +164,7 @@ PABLO_CLEAN=HDFentryNames.h HDFidList.h ProcMasks.h HDFentries.txt \
HDFentries.txt: $(top_srcdir)/src/*.c
grep "FUNC_ENTER[_INIT ]*(" $(top_srcdir)/src/*.c | \
- sed "s/.*FUNC_ENTER[_INIT ]*(//;s/[,)].*//" | sort -u > $@
+ sed "s/.*FUNC_ENTER[_INIT ]*( *//;s/[,)].*//" | sort -u > $@
HDFentryNames.h: HDFentries.txt
sed "s/.*/\"&\",/" $? > $@
diff --git a/pablo/PabloHDF.c b/pablo/PabloHDF.c
index fd4f2b8..4c8357a 100644
--- a/pablo/PabloHDF.c
+++ b/pablo/PabloHDF.c
@@ -151,12 +151,12 @@ void endHDFtraceEvent (int , int , char *, int );
void hdfCaptureInit( const char* name, int captureType );
void hdfCaptureEnd( void );
#else
-void HDFinitTrace_RT ( const char *, int );
-void HDFinitTrace_SDDF ( const char *, int );
+void HDFinitTrace_RT ( const char * );
+void HDFinitTrace_SDDF ( const char * );
void hinittracex_ ( char [], int *, int[], int *,unsigned * );
void hdfendtrace_ ( void ) ;
-void HDFendTrace_RT (int);
-void HDFendTrace_SDDF(int);
+void HDFendTrace_RT (void );
+void HDFendTrace_SDDF( void );
void HDFfinalTimeStamp( void );
void HDFtraceEvent_RT ( int , HDFsetInfo *, unsigned );
void HDFtraceIOEvent( int , void *, unsigned );
@@ -246,13 +246,13 @@ hinittracex_( char *file,
if ( OUTPUT_SWITCH == RUNTIME_TRACE
|| OUTPUT_SWITCH == MPI_RUNTIME_TRACE )
{
- HDFinitTrace_SDDF( traceFileName, OUTPUT_SWITCH );
+ HDFinitTrace_SDDF( traceFileName );
IOtracingEnabled = 1;
}
else if ( OUTPUT_SWITCH == SUMMARY_TRACE
|| OUTPUT_SWITCH == MPI_SUMMARY_TRACE )
{
- HDFinitTrace_RT( traceFileName, OUTPUT_SWITCH );
+ HDFinitTrace_RT( traceFileName );
IOtracingEnabled = 1;
}
else if ( OUTPUT_SWITCH == NO_TRACE )
@@ -328,13 +328,13 @@ HDFinitTrace( const char *traceFileName, int id_flag, ... )
if ( OUTPUT_SWITCH == RUNTIME_TRACE
|| OUTPUT_SWITCH == MPI_RUNTIME_TRACE )
{
- HDFinitTrace_SDDF( traceFileName, OUTPUT_SWITCH );
+ HDFinitTrace_SDDF( traceFileName );
IOtracingEnabled = 1;
}
else if ( OUTPUT_SWITCH == SUMMARY_TRACE
|| OUTPUT_SWITCH == MPI_SUMMARY_TRACE )
{
- HDFinitTrace_RT( traceFileName, OUTPUT_SWITCH );
+ HDFinitTrace_RT( traceFileName );
IOtracingEnabled = 1;
}
else if ( OUTPUT_SWITCH == NO_TRACE )
@@ -370,14 +370,14 @@ void HDFendTrace(void)
hdfCaptureEnd();
#else
if ( OUTPUT_SWITCH == RUNTIME_TRACE
- || OUTPUT_SWITCH == MPI_RUNTIME_TRACE )
+ || OUTPUT_SWITCH == MPI_RUNTIME_TRACE )
{
- HDFendTrace_SDDF( OUTPUT_SWITCH );
+ HDFendTrace_SDDF( );
}
else if ( OUTPUT_SWITCH == SUMMARY_TRACE
- || OUTPUT_SWITCH == MPI_SUMMARY_TRACE )
+ || OUTPUT_SWITCH == MPI_SUMMARY_TRACE )
{
- HDFendTrace_RT( OUTPUT_SWITCH );
+ HDFendTrace_RT();
}
#endif /* PCF_BUILD */
}
@@ -773,7 +773,6 @@ HDFtraceREAD( int fd, void *buf, size_t nbyte )
#else
struct read_write_args readArgs;
int bytes;
- CLOCK t1, t2, incDur;
if ( IOtracingEnabled )
{
@@ -784,10 +783,7 @@ HDFtraceREAD( int fd, void *buf, size_t nbyte )
HDFtraceIOEvent( readBeginID, (void *) &readArgs, sizeof(readArgs) );
}
- t1 = getClock();
ret = read( fd, buf, nbyte );
- t2 = getClock();
- incDur = clockSubtract(t2,t1);
if ( IOtracingEnabled )
{
@@ -826,7 +822,6 @@ HDFtraceFREAD( void *ptr, size_t size, size_t nitems, FILE *stream )
struct read_write_args readArgs;
int nbytes;
int fd = fileno( stream );
- CLOCK t1, t2, incDur;
if ( IOtracingEnabled )
{
@@ -836,10 +831,7 @@ HDFtraceFREAD( void *ptr, size_t size, size_t nitems, FILE *stream )
HDFtraceIOEvent( freadBeginID, (void *) &readArgs, sizeof(readArgs) );
}
- t1 = getClock();
ret = fread( ptr, size, nitems, stream );
- t2 = getClock();
- incDur = clockSubtract(t2,t1);
if ( IOtracingEnabled )
{
@@ -1039,7 +1031,6 @@ HDFtraceWRITE( int fd, const void *buf, size_t nbyte )
#else
struct read_write_args writeArgs;
int bytes;
- CLOCK t1, t2, incDur;
if ( IOtracingEnabled )
{
@@ -1050,10 +1041,7 @@ HDFtraceWRITE( int fd, const void *buf, size_t nbyte )
HDFtraceIOEvent( writeBeginID, (void *) &writeArgs, sizeof(writeArgs) );
}
- t1 = getClock();
ret = write( fd, buf, nbyte );
- t2 = getClock();
- incDur = clockSubtract(t2,t1);
if ( IOtracingEnabled )
{
@@ -1092,7 +1080,6 @@ HDFtraceFWRITE(const void *ptr,size_t size,size_t nitems,FILE *stream )
struct read_write_args writeArgs;
int nbytes;
int fd = fileno( stream );
- CLOCK t1, t2, incDur;
if ( IOtracingEnabled )
{
@@ -1103,10 +1090,7 @@ HDFtraceFWRITE(const void *ptr,size_t size,size_t nitems,FILE *stream )
HDFtraceIOEvent(fwriteBeginID, (void *)&writeArgs, sizeof(writeArgs));
}
- t1 = getClock();
ret = fwrite( ptr, size, nitems, stream );
- t2 = getClock();
- incDur = clockSubtract(t2,t1);
if ( IOtracingEnabled )
{
diff --git a/pablo/PabloHDF_MPIO.c b/pablo/PabloHDF_MPIO.c
index 0eee178..13ed41a 100644
--- a/pablo/PabloHDF_MPIO.c
+++ b/pablo/PabloHDF_MPIO.c
@@ -821,10 +821,10 @@ PabloMPI_File_open( MPI_Comm comm,
struct mpiOpenBeginArgs mpiOpenBeginArguments;
struct mpiOpenEndArgs mpiOpenEndArguments;
-#ifdef DEBUG
+#ifdef PABLODEBUG
fprintf( debugFile, "PabloMPI_File_open\n" );
fflush( debugFile );
-#endif /* DEBUG */
+#endif /* PABLODEBUG */
MPI_Comm_rank( comm, &HDFlocalNode );
MPI_Comm_rank( MPI_COMM_WORLD, &HDFmyNode );
@@ -864,10 +864,10 @@ PabloMPI_File_close( MPI_File *fh )
struct mpiCloseBeginArgs mpiCloseBeginArguments;
struct mpiCloseEndArgs mpiCloseEndArguments;
-#ifdef DEBUG
+#ifdef PABLODEBUG
fprintf( debugFile, "MPI_File_close\n" );
fflush( debugFile );
-#endif /* DEBUG */
+#endif /* PABLODEBUG */
mpiCloseBeginArguments.localNode = HDFlocalNode;
mpiCloseBeginArguments.globalNode = HDFmyNode;
@@ -900,10 +900,10 @@ PabloMPI_File_set_size( MPI_File fh, MPI_Offset size )
struct mpiSetSizeBeginArgs mpiSetSizeBeginArguments;
struct mpiSetSizeEndArgs mpiSetSizeEndArguments;
-#ifdef DEBUG
+#ifdef PABLODEBUG
fprintf( debugFile, "MPI_File_set_size\n" );
fflush( debugFile );
-#endif /* DEBUG */
+#endif /* PABLODEBUG */
mpiSetSizeBeginArguments.localNode = HDFlocalNode;
mpiSetSizeBeginArguments.globalNode = HDFmyNode;
@@ -939,10 +939,10 @@ PabloMPI_File_get_size( MPI_File fh, MPI_Offset *size )
struct mpiGetSizeBeginArgs mpiGetSizeBeginArguments;
struct mpiGetSizeEndArgs mpiGetSizeEndArguments;
-#ifdef DEBUG
+#ifdef PABLODEBUG
fprintf( debugFile, "MPI_File_get_size\n" );
fflush( debugFile );
-#endif /* DEBUG */
+#endif /* PABLODEBUG */
mpiGetSizeBeginArguments.localNode = HDFlocalNode;
mpiGetSizeBeginArguments.globalNode = HDFmyNode;
@@ -984,10 +984,10 @@ PabloMPI_File_set_view( MPI_File fh,
struct mpiSetViewBeginArgs mpiSetViewBeginArguments;
struct mpiSetViewEndArgs mpiSetViewEndArguments;
-#ifdef DEBUG
+#ifdef PABLODEBUG
fprintf( debugFile, "MPI_File_set_view\n" );
fflush( debugFile );
-#endif /* DEBUG */
+#endif /* PABLODEBUG */
mpiSetViewBeginArguments.localNode = HDFlocalNode;
mpiSetViewBeginArguments.globalNode = HDFmyNode;
@@ -1036,10 +1036,10 @@ PabloMPI_File_get_view( MPI_File fh,
struct mpiGetViewBeginArgs mpiGetViewBeginArguments;
struct mpiGetViewEndArgs mpiGetViewEndArguments;
-#ifdef DEBUG
+#ifdef PABLODEBUG
fprintf( debugFile, "MPI_File_get_view\n" );
fflush( debugFile );
-#endif /* DEBUG */
+#endif /* PABLODEBUG */
mpiGetViewBeginArguments.localNode = HDFlocalNode;
mpiGetViewBeginArguments.globalNode = HDFmyNode;
@@ -1083,10 +1083,10 @@ PabloMPI_File_read_at( MPI_File fh,
struct mpiReadAtBeginArgs mpiReadAtBeginArguments;
struct mpiReadAtEndArgs mpiReadAtEndArguments;
-#ifdef DEBUG
+#ifdef PABLODEBUG
fprintf( debugFile, "MPI_File_read_at\n" );
fflush( debugFile );
-#endif /* DEBUG */
+#endif /* PABLODEBUG */
mpiReadAtBeginArguments.localNode = HDFlocalNode;
mpiReadAtBeginArguments.globalNode = HDFmyNode;
@@ -1143,10 +1143,10 @@ PabloMPI_File_read_at_all( MPI_File fh,
struct mpiReadAtAllBeginArgs mpiReadAtAllBeginArguments;
struct mpiReadAtAllEndArgs mpiReadAtAllEndArguments;
-#ifdef DEBUG
+#ifdef PABLODEBUG
fprintf( debugFile, "MPI_File_read_at_all\n" );
fflush( debugFile );
-#endif /* DEBUG */
+#endif /* PABLODEBUG */
mpiReadAtAllBeginArguments.localNode = HDFlocalNode;
mpiReadAtAllBeginArguments.globalNode = HDFmyNode;
@@ -1208,10 +1208,10 @@ PabloMPI_File_write_at( MPI_File fh,
struct mpiWriteAtBeginArgs mpiWriteAtBeginArguments;
struct mpiWriteAtEndArgs mpiWriteAtEndArguments;
-#ifdef DEBUG
+#ifdef PABLODEBUG
fprintf( debugFile, "MPI_File_write_at\n" );
fflush( debugFile );
-#endif /* DEBUG */
+#endif /* PABLODEBUG */
mpiWriteAtBeginArguments.localNode = HDFlocalNode;
mpiWriteAtBeginArguments.globalNode = HDFmyNode;
@@ -1266,10 +1266,10 @@ PabloMPI_File_write_at_all( MPI_File fh,
struct mpiWriteAtAllBeginArgs mpiWriteAtAllBeginArguments;
struct mpiWriteAtAllEndArgs mpiWriteAtAllEndArguments;
-#ifdef DEBUG
+#ifdef PABLODEBUG
fprintf( debugFile, "MPI_File_write_at\n" );
fflush( debugFile );
-#endif /* DEBUG */
+#endif /* PABLODEBUG */
mpiWriteAtAllBeginArguments.localNode = HDFlocalNode;
mpiWriteAtAllBeginArguments.globalNode = HDFmyNode;
@@ -1326,10 +1326,10 @@ PabloMPI_File_sync( MPI_File fh )
struct mpiSyncBeginArgs mpiSyncBeginArguments;
struct mpiSyncEndArgs mpiSyncEndArguments;
-#ifdef DEBUG
+#ifdef PABLODEBUG
fprintf( debugFile, "MPI_File_sync\n" );
fflush( debugFile );
-#endif /* DEBUG */
+#endif /* PABLODEBUG */
mpiSyncBeginArguments.localNode = HDFlocalNode;
mpiSyncBeginArguments.globalNode = HDFmyNode;
diff --git a/pablo/PabloHDF_RT.c b/pablo/PabloHDF_RT.c
index c1289a4..d15c47b 100644
--- a/pablo/PabloHDF_RT.c
+++ b/pablo/PabloHDF_RT.c
@@ -143,7 +143,7 @@
#include "HDFrecord_RT.h"
-#ifdef H5_HAVE_PARALLEL
+#ifdef H5_HAVE_MPIOTRACE
#include "mpi.h"
#include "MPIO_EventArgs.h"
#endif
@@ -184,7 +184,7 @@ fileRec_t *HDFfileList;
// Internal Function prototypes *
//======================================================================*/
void HDFinitTrace_RT( char *, int );
-void HDFendTrace_RT( int );
+void HDFendTrace_RT();
int initproctracert_( void );
int initHDFProcTrace_RT( void );
void HDFtraceEvent_RT( int , char *, unsigned ) ;
@@ -223,51 +223,32 @@ extern char HDFprocNames[][40];
// NAME *
// HDFinitTrace_RT-- initialize HDF real-time tracing *
// USAGE *
-// VOID HDFinitTrace_RT( fileName, OUTSW ) *
+// VOID HDFinitTrace_RT( fileName ) *
// *
// char *fileName; IN: name of output file *
-// int OUTSW ; IN: Type of tracing *
// RETURNS *
// None. *
//======================================================================*/
void HDFinitTrace_RT( char *fileName, int OUTSW )
{
-#ifdef H5_HAVE_PARALLEL
- int myNode;
-#endif
- int error;
- TRgetClock( &epoch );
- error = initHDFProcTrace_RT() ;
- if ( error != SUCCESS ) {
- fprintf (stderr,"Unable to Initialize properly. Exiting program\n");
- exit(-1);
- }
- FileName = ( char * ) malloc ( strlen( fileName ) + 10 );
-#ifdef H5_HAVE_PARALLEL
- /*==============================================================*
- // Here the library was built to linked with the MPI and MPIO *
- // libraries. However, the use may chose not to run with MPI. *
- // A check is made to see if MPI has been initialized. If so, *
- // a trace file is assigned to the current node with the number *
- // of the node as a suffix; if not, only one file is opened *
- // and it is not given a suffix. *
- //==============================================================*/
- if ( OUTSW == MPI_SUMMARY_TRACE ) {
- MPI_Comm_rank( MPI_COMM_WORLD, &myNode );
- setTraceProcessorNumber( myNode );
- sprintf(FileName,"%s.nd%d",fileName,myNode);
- } else {
- strcpy( FileName, fileName ) ;
- }
-#else
- /*==============================================================*
- case, set the trace file name and *
- // initialize the trace library. *
- //==============================================================*/
- strcpy( FileName, fileName ) ;
-#endif /* H5_HAVE_PARALLEL */
- setTraceFileName(FileName);
- basicLibraryInit( );
+ int error;
+ TRgetClock( &epoch );
+ error = initHDFProcTrace_RT() ;
+ if ( error != SUCCESS )
+ {
+ fprintf (stderr,"Unable to Initialize properly. Exiting program\n");
+ exit(-1);
+ }
+ FileName = ( char * ) malloc ( strlen( fileName ) + 10 );
+ /*===================================================================*
+ // Here the library was built to linked with the MPI and MPIO *
+ // libraries. However, the use may chose not to run with MPI. *
+ // A check is made to see if MPI has been initialized. If so, *
+ // a trace file is assigned to the current node with the number *
+ // of the node as a suffix; if not, only one file is opened *
+ // and it is not given a suffix. *
+ //===================================================================*/
+ IOtraceInit( fileName, OUTSW );
}
/*======================================================================*
// NAME *
@@ -277,37 +258,37 @@ void HDFinitTrace_RT( char *fileName, int OUTSW )
// RETURNS *
// None. *
//======================================================================*/
-void HDFendTrace_RT( int OUTSW )
+void HDFendTrace_RT( )
{
- int j, numSetIDs;
- HDFnode_t *P;
- char **Names;
+ int j, numSetIDs;
+ HDFnode_t *P;
+ char **Names;
- HDFfinalTimeStamp();
- /*==============================================================*
- // Assing pablo ids to named identifiers and tag records *
- //==============================================================*/
- HDFassignPabloIDs( &numSetIDs, &Names );
- /*==============================================================*
- // Create a file name for the File map file. *
- // Disable for now. *
- //==============================================================*/
+ HDFfinalTimeStamp();
+ /*===================================================================*
+ // Assing pablo ids to named identifiers and tag records *
+ //===================================================================*/
+ HDFassignPabloIDs( &numSetIDs, &Names );
+ /*===================================================================*
+ // Create a file name for the File map file. *
+ // Disable for now. *
+ //===================================================================*/
/* mapFile = (char *)malloc( strlen(FileName) + 4 );
- strcpy(mapFile,FileName);
- strcat(mapFile,".map"); */
- /*==============================================================*
- // print the file mappings. *
- //==============================================================*/
+ strcpy(mapFile,FileName);
+ strcat(mapFile,".map"); */
+ /*===================================================================*
+ // print the file mappings. *
+ //===================================================================*/
/* printFileMappingsRT( mapFile, Names, numSetIDs ); */
- /*==============================================================*
- // Print SDDF summary records *
- //==============================================================*/
- writeHDFRecDescrptrsRT();
- writeHDFNamePacketsRT( Names, numSetIDs );
+ /*===================================================================*
+ // Print SDDF summary records *
+ //===================================================================*/
+ writeHDFRecDescrptrsRT();
+ writeHDFNamePacketsRT( Names, numSetIDs );
for ( j = 0; j < NumHDFProcs; ++j ) {
- HDFSummarySDDF( HDFQueues[j], j );
- }
- endTracing();
+ HDFSummarySDDF( HDFQueues[j], j );
+ }
+ endTracing();
}
/*======================================================================*
// initHFDProcTrace_RT *
@@ -318,71 +299,80 @@ void HDFendTrace_RT( int OUTSW )
int initproctracert_( void )
{
- return initHDFProcTrace_RT();
+ return initHDFProcTrace_RT();
}
int initHDFProcTrace_RT( void )
-
{
- int i, j, size;
- int numProcs = NumHDFProcs;
+ int i;
+ int j;
+ int size;
+ int numProcs = NumHDFProcs;
- if ( traceProcessorNumber == -1 ) {
- traceProcessorNumber = TRgetDefaultProcessor();
- }
- /*==============================================================*
- // Initialize InitNode used for node initialization. *
- //==============================================================*/
- InitNode.ptr = NULL;
- InitNode.eventID = 0;
- InitNode.lastIOtime = zeroClock;
- InitNode.record.nCalls = 0;
- InitNode.record.lastCall = zeroClock;
- InitNode.record.incDur = zeroClock;
- InitNode.record.excDur = zeroClock;
- InitNode.record.hdfID = 0;
- InitNode.record.xRef = 0;
- for ( j = 0; j < nTallyFields; ++j ) {
+ if ( traceProcessorNumber == -1 )
+ {
+ traceProcessorNumber = TRgetDefaultProcessor();
+ }
+ /*===================================================================*
+ // Initialize InitNode used for node initialization. *
+ //===================================================================*/
+ InitNode.ptr = NULL;
+ InitNode.eventID = 0;
+ InitNode.lastIOtime = zeroClock;
+ InitNode.record.nCalls = 0;
+ InitNode.record.lastCall = zeroClock;
+ InitNode.record.incDur = zeroClock;
+ InitNode.record.excDur = zeroClock;
+ InitNode.record.hdfID = 0;
+ InitNode.record.xRef = 0;
+ for ( j = 0; j < nTallyFields; ++j )
+ {
InitNode.record.times[j] = zeroClock;
- }
- for ( j = 0; j < nTallyFields; ++j ) {
+ }
+ for ( j = 0; j < nTallyFields; ++j )
+ {
InitNode.record.counts[j] = 0;
- }
- for ( j = 0; j < nByteFields; ++j ) {
+ }
+ for ( j = 0; j < nByteFields; ++j )
+ {
InitNode.record.bytes[j] = 0;
- }
- for ( i = 0; i < nByteFields; ++i ) {
- for ( j = 0; j < nBkts; ++j ) {
- InitNode.record.Hists[i][j] = 0;
- }
- }
- /*==============================================================*
- // initialize linked list used to keep track of named hdf *
- // identifiers. *
- //==============================================================*/
- HDFfileList = NULL;
- /*==============================================================*
- // Allocate a one dimensional array of pointers to queues of *
- // HDFnodes. There is one queue for each thread and one for *
- // each HDF procedure. Each queue will be a list of summary *
- // records distinquished by file type and *
- //==============================================================*/
- size = (int)(numProcs*sizeof( HDFnode_t * ));
- HDFQueues = (HDFnode_t **)malloc( size );
- if ( HDFQueues == NULL ) {
- fprintf(stderr,"Failed to allocate HDFQueues in initHDFProcTrace\n");
- return FAILURE;
- }
- for ( j = 0; j < numProcs; ++j ) {
- HDFQueues[j] = NULL;
- }
- /*==============================================================*
- // Initialize call stack to a dummy node and TagQueue to NULL *
- //==============================================================*/
- CallStack = (HDFnode_t *)malloc( sizeof(HDFnode_t) );
- *CallStack = InitNode;
- TagQueue = NULL ;
- return SUCCESS;
+ }
+ for ( i = 0; i < nByteFields; ++i )
+ {
+ for ( j = 0; j < nBkts; ++j )
+ {
+ InitNode.record.Hists[i][j] = 0;
+ }
+ }
+ /*===================================================================*
+ // initialize linked list used to keep track of named hdf *
+ // identifiers. *
+ //===================================================================*/
+ HDFfileList = NULL;
+ /*===================================================================*
+ // Allocate a one dimensional array of pointers to queues of *
+ // HDFnodes. There is one queue for each thread and one for *
+ // each HDF procedure. Each queue will be a list of summary *
+ // records distinquished by file type and *
+ //===================================================================*/
+ size = (int)(numProcs*sizeof( HDFnode_t * ));
+ HDFQueues = (HDFnode_t **)malloc( size );
+ if ( HDFQueues == NULL )
+ {
+ fprintf(stderr,"Failed to allocate HDFQueues in initHDFProcTrace\n");
+ return FAILURE;
+ }
+ for ( j = 0; j < numProcs; ++j )
+ {
+ HDFQueues[j] = NULL;
+ }
+ /*===================================================================*
+ // Initialize call stack to a dummy node and TagQueue to NULL *
+ //===================================================================*/
+ CallStack = (HDFnode_t *)malloc( sizeof(HDFnode_t) );
+ *CallStack = InitNode;
+ TagQueue = NULL ;
+ return SUCCESS;
}
/*======================================================================*
// This is called from the HDF and I/O routines when real-time summary *
@@ -411,7 +401,7 @@ void HDFtraceEvent_RT( int eventType, char *dataPtr, unsigned dataLen )
else if ( isEndHDFEvent( eventType ) )
{
EndHDFEventRecord ( seconds, dataPtr );
-#ifdef H5_HAVE_PARALLEL
+#ifdef H5_HAVE_MPIOTRACE
}
else if ( isBeginMPIOEvent( eventType ) )
{
@@ -420,7 +410,7 @@ void HDFtraceEvent_RT( int eventType, char *dataPtr, unsigned dataLen )
else if ( isEndMPIOEvent( eventType ) )
{
EndMPIOEventRecord ( eventType, seconds, dataPtr, dataLen );
-#endif /* H5_HAVE_PARALLEL */
+#endif /* H5_HAVE_MPIOTRACE */
}
else
{
@@ -529,7 +519,7 @@ void EndIOEventRecord ( int eventType, CLOCK secs, void *dataPtr )
}
}
-#ifdef H5_HAVE_PARALLEL
+#ifdef H5_HAVE_MPIOTRACE
/*======================================================================*
// BeginMPIOEventRecord: *
// This routine simply records the time in the record on the top of *
@@ -542,18 +532,18 @@ void BeginMPIOEventRecord( int eventType,
{
HDFsetInfo *dataPtr;
dataPtr = (HDFsetInfo *)data;
- /*==============================================================*
- // save the time value temporarily in top of stack *
- // When the end record is received, the duration can be *
- // computed. *
- //==============================================================*/
+ /*===================================================================*
+ // save the time value temporarily in top of stack *
+ // When the end record is received, the duration can be *
+ // computed. *
+ //===================================================================*/
CallStack->lastIOtime = seconds;
- /*==============================================================*
- // get useful info from the structure pointed to by dataPtr. *
- cases, this is the file ID. For mpiOpen, it is the *
+ /*===================================================================*
+ // get useful info from the structure pointed to by dataPtr. *
+ // Form most cases, this is the file ID. For mpiOpen, it is the *
// name of the file. For mpiDelete, no information is of any *
// use. *
- //==============================================================*/
+ //===================================================================*/
if ( dataLen == 0 ) return;
CallStack->record.hdfID = dataPtr->setID;
switch ( eventType )
@@ -766,7 +756,7 @@ void EndMPIOEventRecord ( int eventType,
}
}
}
-#endif /* H5_HAVE_PARALLEL */
+#endif /* H5_HAVE_MPIOTRACE */
/*======================================================================*
// BeginHDFEventRecord: *
// This function puts a trace record on the stack corresponding to *
@@ -1087,17 +1077,18 @@ void HDFSummarySDDF( HDFnode_t *P, int procIndex )
char buff[1024];
char *Packet;
HDFnode_t *Q;
- struct {
- int packetLen,
- packetType,
- packetTag,
- eventID;
- double Seconds,
- IncDur,
- ExcDur;
- long HDFid,
- XREFid;
- } Header;
+ struct
+ {
+ int packetLen;
+ int packetType;
+ int packetTag;
+ int eventID;
+ double Seconds;
+ double IncDur;
+ double ExcDur;
+ long HDFid;
+ long XREFid;
+ } Header;
Header.packetLen = sizeof(Header)
+ sizeof(int) /* n Calls */
@@ -1109,8 +1100,7 @@ void HDFSummarySDDF( HDFnode_t *P, int procIndex )
+ nByteFields*sizeof(int) /* bytes array */
+ nHistFields*sizeof(int) /* array lens */
+ nHistFields*nBkts*sizeof(int) /* byte hist */
- + sizeof(int) /* nodeID */
- + sizeof(int) ; /* Name len */
+ + sizeof(int); /* nodeID */
Header.packetTag = HDF_SUMMARY_FAMILY +
( procIndex + 1 )*8 + RECORD_TRACE ;
Header.packetType = PKT_DATA;
@@ -1186,7 +1176,8 @@ void HDFSummarySDDF( HDFnode_t *P, int procIndex )
// copy length of historgram arrays and arrays to Packet. *
//===========================================================*/
arrayLen = nBkts;
- for ( i = 0; i < nByteFields; ++i ) {
+ for ( i = 0; i < nHistFields; ++i )
+ {
memcpy( Packet, &arrayLen, sizeof(int) );
Packet += sizeof(int);
memcpy( Packet, P->record.Hists[i], nBkts*sizeof(int) );
@@ -1194,9 +1185,9 @@ void HDFSummarySDDF( HDFnode_t *P, int procIndex )
}
memcpy( Packet, &nodeID, sizeof(int) );
Packet += sizeof(int);
- arrayLen = 0; /* name length */
- memcpy( Packet, &arrayLen, sizeof(int) );
- putBytes( buff, Header.packetLen );
+ arrayLen = Packet-buff;
+ memcpy(buff,&arrayLen,sizeof(int));
+ putBytes( buff, Packet-buff );
P = Q;
}
}
@@ -1205,7 +1196,7 @@ void HDFSummarySDDF( HDFnode_t *P, int procIndex )
//======================================================================*/
void HDFnodeInit ( HDFnode_t *S )
{
- *S = InitNode;
+ *S = InitNode;
}
/*======================================================================*
// Compute IO totals, exclusive durations of the input record T *
@@ -1213,27 +1204,34 @@ void HDFnodeInit ( HDFnode_t *S )
//======================================================================*/
void HDFrecordSum ( HDFrec_t *S, HDFrec_t *T )
{
- int i, j;
+ int i;
+ int j;
- S->nCalls += T->nCalls;
- if ( clockCompare ( S->lastCall, T->lastCall ) < 0 ) {
- S->lastCall = T->lastCall ;
- }
- S->incDur = clockAdd ( S->incDur, T->incDur );
- for ( j = 0; j < nTallyFields; ++j ) {
- S->times[j] = clockAdd( S->times[j] , T->times[j] ) ;
- }
- for ( j = 0; j < nTallyFields; ++j ) {
- S->counts[j] += T->counts[j] ;
- }
- for ( j = 0; j < nByteFields; ++j ) {
- S->bytes[j] += T->bytes[j] ;
- }
- for ( j = 0; j < nHistFields; ++j ) {
- for ( i = 0; i < nBkts; ++i ) {
- S->Hists[j][i] += T->Hists[j][i] ;
- }
- }
+ S->nCalls += T->nCalls;
+ if ( clockCompare ( S->lastCall, T->lastCall ) < 0 )
+ {
+ S->lastCall = T->lastCall ;
+ }
+ S->incDur = clockAdd ( S->incDur, T->incDur );
+ for ( j = 0; j < nTallyFields; ++j )
+ {
+ S->times[j] = clockAdd( S->times[j] , T->times[j] ) ;
+ }
+ for ( j = 0; j < nTallyFields; ++j )
+ {
+ S->counts[j] += T->counts[j] ;
+ }
+ for ( j = 0; j < nByteFields; ++j )
+ {
+ S->bytes[j] += T->bytes[j] ;
+ }
+ for ( j = 0; j < nHistFields; ++j )
+ {
+ for ( i = 0; i < nBkts; ++i )
+ {
+ S->Hists[j][i] += T->Hists[j][i] ;
+ }
+ }
}
/*======================================================================*
// Return the field index corresponding to an IO event ID. The fields *
@@ -1498,7 +1496,7 @@ void _hdfDescriptorRT( char *recordName, char *recordDescription,
/*==================================================================*
// The record field count *
//==================================================================*/
- sddfWriteInteger( &hdfRecordPointer, 17 );
+ sddfWriteInteger( &hdfRecordPointer, 16 );
WRITE_HDF_FIELD( "Event Identifier",
"Event ID",
"Corresponding Event",
@@ -1563,10 +1561,6 @@ void _hdfDescriptorRT( char *recordName, char *recordDescription,
"Node",
"Processor number",
INTEGER, 0 );
- WRITE_HDF_FIELD( "HDF Name",
- "HDF Name",
- "Name of File,Data Set or Dim accessed",
- CHARACTER, 1 );
/*===================================================================
// The entire record descriptor packet has been written. *
// Compute and update the record length. *
@@ -1586,17 +1580,6 @@ void _hdfDescriptorRT( char *recordName, char *recordDescription,
//======================================================================*/
void writeHDFRecDescrptrsRT( void )
{
-/*
- char HDFprocNames[][40] = {
- "noName",
- "noName",
- "noName",
- "noName",
- "noName",
-# include "HDFentryNames.h"
- "HDF_Last_Entry"
- };
-*/
int j, FAMILY;
char BUF1[256], BUF2[256] ;
_hdfNameDescriptor(); /* Descriptor for named identifiers */
@@ -1646,10 +1629,10 @@ void _hdfNameDescriptor( void )
static char recordBuffer[ 4096 ];
int recordLength;
-#ifdef DEBUG
+#ifdef PABLODEBUG
fprintf( debugFile, "_hdfExitTraceDescriptor entered\n" );
fflush( debugFile );
-#endif /* DEBUG */
+#endif /* PABLODEBUG */
hdfRecordPointer = recordBuffer;
/********************************************************************/
/* Allow space at the beginning of the record for the packet */
diff --git a/pablo/PabloHDF_SDDF.c b/pablo/PabloHDF_SDDF.c
index 4858086..c46878f 100644
--- a/pablo/PabloHDF_SDDF.c
+++ b/pablo/PabloHDF_SDDF.c
@@ -69,7 +69,7 @@
#include "TraceParam.h"
#include "Trace.h"
#include "HDFTrace.h"
-void HDFendTrace_SDDF(int);
+void HDFendTrace_SDDF(void);
void startHDFtraceEvent(int eventID);
void endHDFtraceEvent(int , int , char *, int );
int preInitHDFProcTrace( void );
@@ -113,7 +113,7 @@ extern char HDFprocNames[][40];
/*======================================================================*
// Prototypes of functions in this file. *
//======================================================================*/
-void HDFinitTrace_SDDF( char *, int );
+void HDFinitTrace_SDDF( char * );
/*======================================================================*
// Each procedure being traced has associated with it a distinct pair *
// of entry and exit event IDs. This code maintains a vector of such *
@@ -176,22 +176,24 @@ struct procTraceRecordData {
/*======================================================================*
// misc Record Data packets: *
//======================================================================*/
-struct miscTraceRecordData {
- int packetLength; /* bytes in packet */
- int packetType; /* == PKT_DATA */
- int packetTag; /* FAMILY_MISC | RECORD_TRACE */
- int eventID; /* ID of corresponding event */
- double seconds; /* floating-point timestamp */
- double duration; /* floating-point operation duration */
- unsigned long bytes; /* number of bytes requested */
- int nodeNumber; /* occurred on which node */
+struct miscTraceRecordData
+{
+ int packetLength; /* bytes in packet */
+ int packetType; /* == PKT_DATA */
+ int packetTag; /* FAMILY_MISC | RECORD_TRACE */
+ int eventID; /* ID of corresponding event */
+ double seconds; /* floating-point timestamp */
+ double duration; /* floating-point operation duration */
+ unsigned long bytes; /* number of bytes requested */
+ int nodeNumber; /* occurred on which node */
};
#define miscTraceLen 5*sizeof(int) + 2*sizeof(double) +sizeof(long)
/*======================================================================*
// The procEntries array specifies the event IDs of procedure entry *
// events. *
//======================================================================*/
-int procEntries[] = {
+int procEntries[] =
+{
0, 0, 0, 0, 0,
#include "HDFidList.h"
ID_HDF_Last_Entry
@@ -201,105 +203,46 @@ ID_HDF_Last_Entry
// was called. *
//======================================================================*/
int *procEntryCalled;
-/*======================================================================*
-// The HDFProcNames array holds the names of the HDF entries. *
-//======================================================================*/
-/*static char HDFprocNames[][40] = {
-"noName",
-"noName",
-"noName",
-"noName",
-"noName",
-#include "HDFentryNames.h"
-"HDF_LAST_ENTRY"
-};*/
/*=======================================================================
// NAME *
// HDFinitTrace_SDDF -- initalize HDF tracing with SDDF records *
// USAGE *
-// HDFinitTrace_SDDF( traceFileName, procTraceMask ) *
+// HDFinitTrace_SDDF( traceFileName ) *
// PARAMETERS *
// char *traceFileName -- name of trace file to hold output *
-// uint32 prcoTraceMask -- mask indicating classes of HDF procs to *
-// be traced *
// RETURNS *
// None *
//======================================================================*/
-void HDFinitTrace_SDDF( char *traceFileName, int OUTSW )
+void HDFinitTrace_SDDF( char *traceFileName )
{
- /*===============================================================
- // set traceFileName and set IO tracing switches. If MPIO *
- // tracing is available, MPIO tracing will also be initialized. *
- //==============================================================*/
-#ifdef H5_HAVE_PARALLEL
- /*===============================================================
- // The code is built to handle parallel processing using MPI. *
- // However, the code may or may not be run using MPI and there *
- // may or may not be support for MPIO tracing in the Pablo *
- // Trace libraries. The type of initialization performed *
- // depends on these factors. *
- //==============================================================*/
- int myNode;
- char *buff;
- /*===============================================================
- // Determine if MPI is running the program. *
- //==============================================================*/
- if ( OUTSW == MPI_RUNTIME_TRACE ) {
- /*============================================================
- // in the parallel case, initialize MPI-IO tracing. This *
- // will initialize the traceFileName and set the I/O tracing *
- // switches. *
- //===========================================================*/
- MPI_Comm_rank( MPI_COMM_WORLD, &myNode );
- setTraceProcessorNumber( myNode );
+ /*====================================================================
+ // set traceFileName and set IO tracing switches. If MPIO *
+ // tracing is available, MPIO tracing will also be initialized. *
+ //===================================================================*/
#ifdef H5_HAVE_MPIOTRACE
- /*============================================================
- // MPIO Tracing is supported in the Pablo Library. Let the *
- // MPIO initialization be performed and handle the naming of *
- // trace files. *
- //===========================================================*/
- initMPIOTrace( traceFileName, SUPPRESS_MPIO_TRACE );
+ int myNode;
+ char *buff;
+ /*====================================================================
+ // in the parallel case, initialize MPI-IO tracing. This *
+ // will initialize the traceFileName and set the I/O tracing *
+ // switches. *
+ //===================================================================*/
+ /*====================================================================
+ // MPIO Tracing is supported in the Pablo Library. Let the *
+ // MPIO initialization be performed and handle the naming of *
+ // trace files. *
+ //===================================================================*/
+ initMPIOTrace( traceFileName, SUPPRESS_MPIO_TRACE );
+ MPI_Comm_rank( MPI_COMM_WORLD, &myNode );
+ setTraceProcessorNumber( myNode );
#else
- /*============================================================
- // MPIO tracing is not supported. *
- // Set up the trace file names depending on the number of *
- // current node. *
- //===========================================================*/
- buff = (char *)malloc( strlen(traceFileName)+12);
- sprintf( buff, "%s.nd%.4d\0",traceFileName,myNode);
- setTraceFileName( buff );
- free( buff );
+ IOtraceInit( traceFileName, RUNTIME_TRACE );
#endif
- } else {
- /*============================================================
- // The HDF library was built to run with MPI, but the *
- // application is being run in serial mode. Initialization *
- // is done as in the serial case. *
- //===========================================================*/
- setTraceFileName(traceFileName);
- initIOTrace();
- enableIOdetail();
- disableLifetimeSummaries();
- disableTimeWindowSummaries();
- disableFileRegionSummaries();
- }
-#else
- /*===============================================================
- // in the non-parallel case, set the trace file name and the *
- // I/O tracing switches. *
- //==============================================================*/
- setTraceFileName(traceFileName);
- initIOTrace();
- enableIOdetail();
- disableLifetimeSummaries();
- disableTimeWindowSummaries();
- disableFileRegionSummaries();
-#endif /* H5_HAVE_PARALLEL */
- /*===============================================================
- // complete HDF initiailization. *
- //==============================================================*/
- preInitHDFProcTrace();
- initHDFProcTrace( sizeof(procEntries)/sizeof(int), procEntries );
+ /*====================================================================
+ // complete HDF initiailization. *
+ //===================================================================*/
+ preInitHDFProcTrace();
+ initHDFProcTrace( sizeof(procEntries)/sizeof(int), procEntries );
}
/*=======================================================================
// NAME *
@@ -309,23 +252,22 @@ void HDFinitTrace_SDDF( char *traceFileName, int OUTSW )
// RETURNS *
// None. *
//======================================================================*/
-void HDFendTrace_SDDF(int OUTSW)
+void HDFendTrace_SDDF()
{
- HDFfinalTimeStamp();
- if ( OUTSW == MPI_RUNTIME_TRACE ) {
- /*============================================================
- // termintate MPI-IO tracing in the parallel case. This *
- // will terminate the I/O tracing and close tracing as well. *
- //===========================================================*/
- endMPIOTrace();
- } else {
- /*============================================================
- // terminate tracing *
- //===========================================================*/
- endIOTrace();
- endTracing();
- exit(1);
- }
+ HDFfinalTimeStamp();
+#ifdef H5_HAVE_MPIORACE
+ /*====================================================================
+ // termintate MPI-IO tracing in the parallel case. This *
+ // will terminate the I/O tracing and close tracing as well. *
+ //===================================================================*/
+ endMPIOTrace();
+#else
+ /*====================================================================
+ // terminate tracing *
+ //===================================================================*/
+ endIOTrace();
+ endTracing();
+#endif
}
/*=======================================================================
// NAME *
@@ -347,57 +289,65 @@ void HDFendTrace_SDDF(int OUTSW)
//======================================================================*/
int initHDFProcTrace( int numProcs, int *procEntryID )
{
- int procIndex, IX, ID;
-
- if (( numProcs <= 0 ) || ( procEntryID == (int *) 0 ) )
- return FAILURE;
- /*===============================================================
- // Allocate space to store a copy of the procedure entry-exit *
- // event ID matchings and also the procedure entry stacks. *
- //==============================================================*/
- procEvents = (PROC_EVENTS *) TRgetBuffer(
- (numProcs+4)*sizeof(PROC_EVENTS) );
-
- if ( procEvents == (PROC_EVENTS *) 0 )
- TRfailure( "cannot allocate procedure events matching" );
-
- procEntryCalled = ( int *)malloc( numProcs*sizeof(int) );
- if ( procEvents == NULL )
- TRfailure( "cannot allocate procedure Called indicators" );
- /*===============================================================
- // Initialize the procedure events matching from the arguments *
- // passed. Configure the trace record-generating function for *
- // these events. Initialize the flags indicating whether or *
- // not the procedure was called. *
- //==============================================================*/
- for ( procIndex = 0; procIndex < numProcs; procIndex++ ) {
-
- IX = procEntryID[ procIndex ];
- ID = HDFIXtoEventID( IX );
- procEvents[ procIndex ].entryID = ID;
- procEvents[ procIndex ].exitID = -ID;
-
- setEventRecordFunction( ID, HDFprocEventRecord );
- setEventRecordFunction( -ID, HDFprocEventRecord );
- procEntryCalled[ procIndex ] = 0;
-
- }
-
- /*===============================================================
- // Initialize the procedure events for malloc. *
- // Configure the trace record-generating function for this *
- // event. *
- //==============================================================*/
- procEvents[ numProcs ].entryID = ID_malloc;
- procEvents[ numProcs ].exitID = -ID_malloc;
- setEventRecordFunction( ID_malloc, miscEventRecord );
- setEventRecordFunction( -ID_malloc, miscEventRecord );
- procEvents[ numProcs+1 ].entryID = ID_free;
- procEvents[ numProcs+1 ].exitID = -ID_free;
- setEventRecordFunction( ID_free, miscEventRecord );
- setEventRecordFunction( -ID_free, miscEventRecord );
-
- return SUCCESS;
+ int procIndex;
+ int IX;
+ int ID;
+
+ if (( numProcs <= 0 ) || ( procEntryID == (int *) 0 ) )
+ {
+ return FAILURE;
+ }
+ /*====================================================================
+ // Allocate space to store a copy of the procedure entry-exit *
+ // event ID matchings and also the procedure entry stacks. *
+ //===================================================================*/
+ procEvents = (PROC_EVENTS *)TRgetBuffer((numProcs+4)*sizeof(PROC_EVENTS));
+
+ if ( procEvents == (PROC_EVENTS *) 0 )
+ {
+ TRfailure( "cannot allocate procedure events matching" );
+ }
+
+ procEntryCalled = ( int *)malloc( numProcs*sizeof(int) );
+ if ( procEvents == NULL )
+ {
+ TRfailure( "cannot allocate procedure Called indicators" );
+ }
+ /*====================================================================
+ // Initialize the procedure events matching from the arguments *
+ // passed. Configure the trace record-generating function for *
+ // these events. Initialize the flags indicating whether or *
+ // not the procedure was called. *
+ //===================================================================*/
+ for ( procIndex = 0; procIndex < numProcs; procIndex++ )
+ {
+
+ IX = procEntryID[ procIndex ];
+ ID = HDFIXtoEventID( IX );
+ procEvents[ procIndex ].entryID = ID;
+ procEvents[ procIndex ].exitID = -ID;
+
+ setEventRecordFunction( ID, HDFprocEventRecord );
+ setEventRecordFunction( -ID, HDFprocEventRecord );
+ procEntryCalled[ procIndex ] = 0;
+
+ }
+
+ /*====================================================================
+ // Initialize the procedure events for malloc. *
+ // Configure the trace record-generating function for this *
+ // event. *
+ //===================================================================*/
+ procEvents[ numProcs ].entryID = ID_malloc;
+ procEvents[ numProcs ].exitID = -ID_malloc;
+ setEventRecordFunction( ID_malloc, miscEventRecord );
+ setEventRecordFunction( -ID_malloc, miscEventRecord );
+ procEvents[ numProcs+1 ].entryID = ID_free;
+ procEvents[ numProcs+1 ].exitID = -ID_free;
+ setEventRecordFunction( ID_free, miscEventRecord );
+ setEventRecordFunction( -ID_free, miscEventRecord );
+
+ return SUCCESS;
}
/*=======================================================================
// NAME *
@@ -414,19 +364,21 @@ int initHDFProcTrace( int numProcs, int *procEntryID )
/=======================================================================*/
int preInitHDFProcTrace( void )
{
- static int preInitDone = FALSE;
-
- if ( preInitDone == TRUE )
- return SUCCESS;
- /*===============================================================
- // Give the instrumentation library a pointer to the functions *
- // in which we output the specialized record descriptors for *
- // procedure entry/exit. *
- //==============================================================*/
- setRecordDescriptor( writeHDFProcRecordDescriptors );
-
- preInitDone = TRUE;
- return SUCCESS;
+ static int preInitDone = FALSE;
+
+ if ( preInitDone == TRUE )
+ {
+ return SUCCESS;
+ }
+ /*====================================================================
+ // Give the instrumentation library a pointer to the functions *
+ // in which we output the specialized record descriptors for *
+ // procedure entry/exit. *
+ //===================================================================*/
+ setRecordDescriptor( writeHDFProcRecordDescriptors );
+
+ preInitDone = TRUE;
+ return SUCCESS;
}
/*=======================================================================
// NAME *
@@ -443,18 +395,18 @@ int preInitHDFProcTrace( void )
/=======================================================================*/
int writeHDFProcRecordDescriptors( void )
{
-#ifdef DEBUG
- fprintf( debugFile, "writeHDFProcRecordDescriptors\n" );
- fflush( debugFile );
-#endif /* DEBUG */
-
- _hdfMiscDescriptor();
-
-#ifdef DEBUG
- fprintf( debugFile, "writeHDFProcRecordDescriptors done\n" );
- fflush( debugFile );
-#endif /* DEBUG */
- return SUCCESS;
+#ifdef PABLODEBUG
+ fprintf( debugFile, "writeHDFProcRecordDescriptors\n" );
+ fflush( debugFile );
+#endif /* PABLODEBUG */
+
+ _hdfMiscDescriptor();
+
+#ifdef PABLODEBUG
+ fprintf( debugFile, "writeHDFProcRecordDescriptors done\n" );
+ fflush( debugFile );
+#endif /* PABLODEBUG */
+ return SUCCESS;
}
/*=======================================================================
// NAME *
@@ -476,166 +428,182 @@ int writeHDFProcRecordDescriptors( void )
// pointer to trace record for this event *
//======================================================================*/
TR_RECORD *
-HDFprocEventRecord( int recordType, TR_EVENT *eventPointer, CLOCK timeStamp,
- HDFsetInfo *dataPointer, unsigned dataLength )
+HDFprocEventRecord( int recordType,
+ TR_EVENT *eventPointer,
+ CLOCK timeStamp,
+ HDFsetInfo *dataPointer,
+ unsigned dataLength )
{
- static TR_RECORD traceRecord;
- static void *recordBuffer = NULL;
- static int bufferLength = 0;
- struct procTraceRecordData *TraceRecordHeader;
- int procIndex;
- int recordFamily;
- char *namePtr;
+ static TR_RECORD traceRecord;
+ static void *recordBuffer = NULL;
+ static int bufferLength = 0;
+ struct procTraceRecordData *TraceRecordHeader;
+ int procIndex;
+ int recordFamily;
+ char *namePtr;
- #ifdef DEBUG
- fprintf( debugFile, "HDFprocEventRecord\n" );
- fflush( debugFile );
- #endif /* DEBUG */
-
- /*==============================================================*
- // Find the index in the tables for the procedure corresponding *
- // to this eventID. *
- //==============================================================*/
- procIndex = findHDFProcEvent( eventPointer->eventID );
- if ( procIndex < 0 ) {
- return nullRecordFunction( recordType, eventPointer,
+#ifdef PABLODEBUG
+ fprintf( debugFile, "HDFprocEventRecord\n" );
+ fflush( debugFile );
+#endif /* PABLODEBUG */
+
+ /*==============================================================*
+ // Find the index in the tables for the procedure corresponding *
+ // to this eventID. *
+ //==============================================================*/
+ procIndex = findHDFProcEvent( eventPointer->eventID );
+ if ( procIndex < 0 )
+ {
+ return nullRecordFunction( recordType, eventPointer,
timeStamp, (char *)dataPointer, dataLength );
- }
- /*==============================================================*
- // Produce a packet for the name of the procedure if one has *
- // not already been produced. *
- //==============================================================*/
- if ( procEntryCalled[procIndex] == 0 ) {
- createHDFTraceDescriptor( procIndex );
- procEntryCalled[procIndex] = 1;
- }
- /*==============================================================*
- // Determine whether this is a procedure entry or a procedure *
- // exit family event by lookup in the procedure event ID *
- // matching. *
- //==============================================================*/
- recordFamily = HDF_FAMILY + ( procIndex + 1)*8;
- /*==============================================================*
- // The time stamp stored in the event descriptor will be used *
- // unless one is specified in the timeStamp parameter. *
- //==============================================================*/
- if ( clockCompare( timeStamp, noSuchClock ) == 0 ) {
- timeStamp = eventPointer->eventLast;
- }
- /*==============================================================*
- // Determine how many bytes of storage will be needed for the *
- // contents of the trace record. *
- //==============================================================*/
- traceRecord.recordLength = sizeof *TraceRecordHeader;
- if ( dataPointer != NULL && dataPointer->setName != NULL ) {
- traceRecord.recordLength += strlen( dataPointer->setName );
- }
- /*==============================================================*
- // If there is a previously-allocated buffer and its size will *
- // hold this record, re-use the buffer. Otherwise, deallocate *
- // the buffer (if allocated) and allocate a bigger one. *
- //==============================================================*/
- if ( bufferLength < traceRecord.recordLength ) {
-
- if ( recordBuffer != NULL ) {
- TRfreeBuffer( recordBuffer );
- }
-
- recordBuffer = (char *)TRgetBuffer( traceRecord.recordLength );
-
- if ( recordBuffer == NULL ) {
- TRfailure( "cannot allocate storage for trace record" );
- }
- bufferLength = traceRecord.recordLength;
- }
-
- traceRecord.recordContents = recordBuffer;
- /*==============================================================*
- // Load the trace record fields into the allocated buffer *
- //==============================================================*/
- TraceRecordHeader = (struct procTraceRecordData *)recordBuffer;
- TraceRecordHeader->packetLength = traceRecord.recordLength;
- TraceRecordHeader->packetType = PKT_DATA;
- TraceRecordHeader->packetTag = recordFamily | recordType;
- TraceRecordHeader->seconds = clockToSeconds( timeStamp );
- TraceRecordHeader->eventID = eventPointer->eventID;
- TraceRecordHeader->nodeNumber = TRgetNode();
-
- if ( dataPointer != 0 ) {
- TraceRecordHeader->setID = dataPointer->setID;
- if (dataPointer->setName != NULL ) {
- TraceRecordHeader->nameLen = (int)strlen( dataPointer->setName );
- /*================================================*
- // copy name directly into the end of the buffer. *
- //================================================*/
- namePtr = (char *)TraceRecordHeader + procTraceRecLen;
- memcpy(namePtr, dataPointer->setName, TraceRecordHeader->nameLen);
- } else {
- TraceRecordHeader->nameLen = 0;
- }
- } else {
- TraceRecordHeader->setID = 0;
- TraceRecordHeader->nameLen = 0;
- }
-
-#ifdef DEBUG
- fprintf( debugFile, "HDFprocEventRecord done\n" );
- fflush( debugFile );
-#endif /* DEBUG */
- returnRecord(&traceRecord);
+ }
+ /*===================================================================*
+ // Produce a packet for the name of the procedure if one has *
+ // not already been produced. *
+ //===================================================================*/
+ if ( procEntryCalled[procIndex] == 0 ) {
+ createHDFTraceDescriptor( procIndex );
+ procEntryCalled[procIndex] = 1;
+ }
+ /*===================================================================*
+ // Determine whether this is a procedure entry or a procedure *
+ // exit family event by lookup in the procedure event ID *
+ // matching. *
+ //===================================================================*/
+ recordFamily = HDF_FAMILY + ( procIndex + 1)*8;
+ /*===================================================================*
+ // The time stamp stored in the event descriptor will be used *
+ // unless one is specified in the timeStamp parameter. *
+ //===================================================================*/
+ if ( clockCompare( timeStamp, noSuchClock ) == 0 ) {
+ timeStamp = eventPointer->eventLast;
+ }
+ /*===================================================================*
+ // Determine how many bytes of storage will be needed for the *
+ // contents of the trace record. *
+ //===================================================================*/
+ traceRecord.recordLength = sizeof *TraceRecordHeader;
+ if ( dataPointer != NULL && dataPointer->setName != NULL )
+ {
+ traceRecord.recordLength += strlen( dataPointer->setName );
+ }
+ /*===================================================================*
+ // If there is a previously-allocated buffer and its size will *
+ // hold this record, re-use the buffer. Otherwise, deallocate *
+ // the buffer (if allocated) and allocate a bigger one. *
+ //===================================================================*/
+ if ( bufferLength < traceRecord.recordLength )
+ {
+
+ if ( recordBuffer != NULL )
+ {
+ TRfreeBuffer( recordBuffer );
+ }
+
+ recordBuffer = (char *)TRgetBuffer( traceRecord.recordLength );
+
+ if ( recordBuffer == NULL )
+ {
+ TRfailure( "cannot allocate storage for trace record" );
+ }
+ bufferLength = traceRecord.recordLength;
+ }
+
+ traceRecord.recordContents = recordBuffer;
+ /*===================================================================*
+ // Load the trace record fields into the allocated buffer *
+ //===================================================================*/
+ TraceRecordHeader = (struct procTraceRecordData *)recordBuffer;
+ TraceRecordHeader->packetLength = traceRecord.recordLength;
+ TraceRecordHeader->packetType = PKT_DATA;
+ TraceRecordHeader->packetTag = recordFamily | recordType;
+ TraceRecordHeader->seconds = clockToSeconds( timeStamp );
+ TraceRecordHeader->eventID = eventPointer->eventID;
+ TraceRecordHeader->nodeNumber = TRgetNode();
+
+ if ( dataPointer != 0 )
+ {
+ TraceRecordHeader->setID = dataPointer->setID;
+ if (dataPointer->setName != NULL )
+ {
+ TraceRecordHeader->nameLen = (int)strlen( dataPointer->setName );
+ /*==============================================================*
+ // copy name directly into the end of the buffer. *
+ //==============================================================*/
+ namePtr = (char *)TraceRecordHeader + procTraceRecLen;
+ memcpy(namePtr, dataPointer->setName, TraceRecordHeader->nameLen);
+ }
+ else
+ {
+ TraceRecordHeader->nameLen = 0;
+ }
+ }
+ else
+ {
+ TraceRecordHeader->setID = 0;
+ TraceRecordHeader->nameLen = 0;
+ }
+#ifdef PABLODEBUG
+ fprintf( debugFile, "HDFprocEventRecord done\n" );
+ fflush( debugFile );
+#endif /* PABLODEBUG */
+ returnRecord(&traceRecord);
}
/*======================================================================*
// Internal Routine: miscEventRecord *
// Called for misc start and end events. *
//======================================================================*/
TR_RECORD *miscEventRecord( int recordType,
- TR_EVENT *eventPointer,
- CLOCK timeStamp,
- void *dataPointer,
- unsigned dataLength )
+ TR_EVENT *eventPointer,
+ CLOCK timeStamp,
+ void *dataPointer,
+ unsigned dataLength )
{
- static TR_RECORD traceRecord;
- static struct miscTraceRecordData miscRecord;
- static int initialized = FALSE;
- int eventID;
-
- if ( clockCompare( timeStamp, noSuchClock ) == 0 ) {
- timeStamp = eventPointer->eventLast;
- }
-
- eventID = eventPointer->eventID;
- if ( ! initialized ) {
- miscRecord.packetLength = sizeof( miscRecord );
- miscRecord.packetType = PKT_DATA;
- miscRecord.packetTag = FAMILY_MISC | RECORD_TRACE;
- miscRecord.nodeNumber = traceProcessorNumber;
-
- traceRecord.recordLength = miscRecord.packetLength;
- traceRecord.recordContents = (char *) &miscRecord;
- initialized = TRUE;
- }
-
- switch ( eventID ) {
- case ID_malloc:
- case ID_free:
- miscRecord.seconds = clockToSeconds( timeStamp ) ;
- miscRecord.eventID = eventID ;
- break;
- case -ID_malloc:
- case -ID_free:
- miscRecord.bytes = *(int *)dataPointer;
- miscRecord.duration = clockToSeconds( timeStamp)
- - miscRecord.seconds;
- return &traceRecord; /* generate trace record */
- default:
- fprintf( stderr, "miscEventRecord: unknown eventID %d\n", eventID );
- break;
- }
- /*==================================================================*
- // If we get here then no trace record generated. Normally we *
- // should get here if this is an entry call. *
- //==================================================================*/
- return( nullRecordFunction( recordType, eventPointer, timeStamp,
+ static TR_RECORD traceRecord;
+ static struct miscTraceRecordData miscRecord;
+ static int initialized = FALSE;
+ int eventID;
+
+ if ( clockCompare( timeStamp, noSuchClock ) == 0 )
+ {
+ timeStamp = eventPointer->eventLast;
+ }
+
+ eventID = eventPointer->eventID;
+ if ( ! initialized )
+ {
+ miscRecord.packetLength = sizeof( miscRecord );
+ miscRecord.packetType = PKT_DATA;
+ miscRecord.packetTag = FAMILY_MISC | RECORD_TRACE;
+ miscRecord.nodeNumber = traceProcessorNumber;
+
+ traceRecord.recordLength = miscRecord.packetLength;
+ traceRecord.recordContents = (char *) &miscRecord;
+ initialized = TRUE;
+ }
+
+ switch ( eventID )
+ {
+ case ID_malloc:
+ case ID_free:
+ miscRecord.seconds = clockToSeconds( timeStamp ) ;
+ miscRecord.eventID = eventID ;
+ break;
+ case -ID_malloc:
+ case -ID_free:
+ miscRecord.bytes = *(int *)dataPointer;
+ miscRecord.duration = clockToSeconds( timeStamp)
+ - miscRecord.seconds;
+ return &traceRecord; /* generate trace record */
+ default:
+ fprintf( stderr, "miscEventRecord: unknown eventID %d\n", eventID );
+ break;
+ }
+ /*===================================================================*
+ // If we get here then no trace record generated. Normally we *
+ // should get here if this is an entry call. *
+ //===================================================================*/
+ return( nullRecordFunction( recordType, eventPointer, timeStamp,
dataPointer, dataLength ) );
}
/*======================================================================*
@@ -653,33 +621,39 @@ TR_RECORD *miscEventRecord( int recordType,
//======================================================================*/
int findHDFProcEvent( int eventID )
{
- int procIndex;
-
-#ifdef DEBUG
- fprintf( debugFile, "findHDFProcEvent\n" );
- fflush( debugFile );
-#endif /* DEBUG */
- if ( isBeginHDFEvent(eventID) ) {
- procIndex = eventID - BEGIN_HDF;
- } else if ( isEndHDFEvent( eventID ) ) {
- procIndex = -eventID - BEGIN_HDF;
- } else {
- procIndex = -1 ;
- }
- return procIndex;
+ int procIndex;
+
+#ifdef PABLODEBUG
+ fprintf( debugFile, "findHDFProcEvent\n" );
+ fflush( debugFile );
+#endif /* PABLODEBUG */
+ if ( isBeginHDFEvent(eventID) )
+ {
+ procIndex = eventID - BEGIN_HDF;
+ }
+ else if ( isEndHDFEvent( eventID ) )
+ {
+ procIndex = -eventID - BEGIN_HDF;
+ }
+ else
+ {
+ procIndex = -1 ;
+ }
+ return procIndex;
}
void createHDFTraceDescriptor( int Inx )
{
- char BUF1[256], BUF2[256] ;
- int FAMILY;
- strcpy( BUF2, "HDF ");
- strcat( BUF2, HDFprocNames[Inx] );
- strcat( BUF2, " Procedure");
- strcpy( BUF1, BUF2 );
- strcat( BUF1, " Trace");
-
- FAMILY = HDF_FAMILY + (Inx + 1)*8;
- _hdfTraceDescriptor( BUF1, BUF2, FAMILY );
+ char BUF1[256];
+ char BUF2[256] ;
+ int FAMILY;
+ strcpy( BUF2, "HDF ");
+ strcat( BUF2, HDFprocNames[Inx] );
+ strcat( BUF2, " Procedure");
+ strcpy( BUF1, BUF2 );
+ strcat( BUF1, " Trace");
+
+ FAMILY = HDF_FAMILY + (Inx + 1)*8;
+ _hdfTraceDescriptor( BUF1, BUF2, FAMILY );
}
/*======================================================================*
// NAME *
@@ -695,61 +669,68 @@ void _hdfTraceDescriptor( char *recordName,
char *recordDescription,
int recordFamily )
{
- static char recordBuffer[ 4096 ];
- int recordLength;
+ static char recordBuffer[ 4096 ];
+ int recordLength;
+
+ hdfRecordPointer = recordBuffer;
+ /*====================================================================
+ // Allow space at the beginning of the record for the packet *
+ //length which will be computed after the packet is complete. *
+ //===================================================================*/
+ sddfWriteInteger( &hdfRecordPointer, 0 );
+ /*====================================================================
+ // The record type, tag, and name *
+ //===================================================================*/
+ sddfWriteInteger( &hdfRecordPointer, PKT_DESCRIPTOR );
+ sddfWriteInteger( &hdfRecordPointer, ( recordFamily | RECORD_TRACE ) );
+ sddfWriteString( &hdfRecordPointer, recordName );
+ /*====================================================================
+ // The record attribute count and string pair *
+ //===================================================================*/
+ sddfWriteInteger( &hdfRecordPointer, 1 );
+ sddfWriteString( &hdfRecordPointer, "description" );
+ sddfWriteString( &hdfRecordPointer, recordDescription );
+ /*===================================================================*
+ // The record field count *
+ //===================================================================*/
+ sddfWriteInteger( &hdfRecordPointer, 5);
+ /*===================================================================*
+ // Create fields *
+ //===================================================================*/
+ WRITE_HDF_FIELD( "Event Identifier",
+ "Event ID",
+ "Event Identifier Number",
+ INTEGER,
+ 0 );
+ WRITE_HDF_FIELD( "Seconds",
+ "Seconds",
+ "Floating Point Timestamp",
+ DOUBLE,
+ 0 );
+ WRITE_HDF_FIELD2( "HDF ID",
+ "HDF ID",
+ "File, Data Set or Dim Identifier number",
+ "0",
+ "No HDF ID specified",
+ LONG,
+ 0 );
+ WRITE_HDF_FIELD( "Processor Number",
+ "Node",
+ "Processor number",
+ INTEGER,
+ 0 );
+ WRITE_HDF_FIELD( "HDF Name",
+ "HDF Name",
+ "Name of File, Data Set or Dim",
+ CHARACTER,
+ 1 );
+
+ recordLength = (int)(hdfRecordPointer - recordBuffer);
- hdfRecordPointer = recordBuffer;
- /*===================================================================
- // Allow space at the beginning of the record for the packet *
- //length which will be computed after the packet is complete. *
- //==================================================================*/
- sddfWriteInteger( &hdfRecordPointer, 0 );
- /*===================================================================
- // The record type, tag, and name *
- //==================================================================*/
- sddfWriteInteger( &hdfRecordPointer, PKT_DESCRIPTOR );
- sddfWriteInteger( &hdfRecordPointer, ( recordFamily | RECORD_TRACE ) );
- sddfWriteString( &hdfRecordPointer, recordName );
- /*===================================================================
- // The record attribute count and string pair *
- //==================================================================*/
- sddfWriteInteger( &hdfRecordPointer, 1 );
- sddfWriteString( &hdfRecordPointer, "description" );
- sddfWriteString( &hdfRecordPointer, recordDescription );
- /*==================================================================*
- // The record field count *
- //==================================================================*/
- sddfWriteInteger( &hdfRecordPointer, 5);
- /*==================================================================*
- // Create fields *
- //==================================================================*/
- WRITE_HDF_FIELD( "Event Identifier",
- "Event ID",
- "Event Identifier Number",
- INTEGER, 0 );
- WRITE_HDF_FIELD( "Seconds",
- "Seconds",
- "Floating Point Timestamp",
- DOUBLE, 0 );
- WRITE_HDF_FIELD2( "HDF ID",
- "HDF ID", "File, Data Set or Dim Identifier number",
- "0", "No HDF ID specified",
- LONG, 0 );
- WRITE_HDF_FIELD( "Processor Number",
- "Node",
- "Processor number",
- INTEGER, 0 );
- WRITE_HDF_FIELD( "HDF Name",
- "HDF Name", "Name of File, Data Set or Dim",
- CHARACTER, 1 );
-
-
- recordLength = (int)(hdfRecordPointer - recordBuffer);
-
- hdfRecordPointer = recordBuffer;
- sddfWriteInteger( &hdfRecordPointer, recordLength );
-
- putBytes( recordBuffer, (unsigned) recordLength );
+ hdfRecordPointer = recordBuffer;
+ sddfWriteInteger( &hdfRecordPointer, recordLength );
+
+ putBytes( recordBuffer, (unsigned) recordLength );
}
/*======================================================================*
// NAME *
@@ -766,62 +747,67 @@ void _hdfMiscDescriptor( void )
static char recordBuffer[ 4096 ];
int recordLength;
-#ifdef DEBUG
- fprintf( debugFile, "_hdfMiscDescriptor entered\n" );
- fflush( debugFile );
-#endif /* DEBUG */
- hdfRecordPointer = recordBuffer;
- /*==================================================================*
- // Allow space at the beginning of the record for the packet *
- //length which will be computed after the packet is complete. *
- //==================================================================*/
- sddfWriteInteger( &hdfRecordPointer, 0 );
- /*==================================================================*
- // The record type, tag, and name *
- //==================================================================*/
- sddfWriteInteger( &hdfRecordPointer, PKT_DESCRIPTOR );
- sddfWriteInteger( &hdfRecordPointer, ( FAMILY_MISC | RECORD_TRACE ) );
- sddfWriteString( &hdfRecordPointer, "Misc Trace" );
- /*==================================================================*
- // The record attribute count and string pair *
- //==================================================================*/
- sddfWriteInteger( &hdfRecordPointer, 1 );
- sddfWriteString( &hdfRecordPointer, "description" );
- sddfWriteString( &hdfRecordPointer, "Misc Trace Record" );
- /*==================================================================*
- // The record field count *
- //==================================================================*/
- sddfWriteInteger( &hdfRecordPointer, 5);
- /*==================================================================*
- // Create fields *
- //==================================================================*/
- WRITE_HDF_FIELD( "Event Identifier",
- "Event ID",
- "Event Identifier Number",
- INTEGER, 0 );
- WRITE_HDF_FIELD( "Seconds",
- "Seconds",
- "Floating Point Timestamp",
- DOUBLE, 0 );
- WRITE_HDF_FIELD( "Duration",
- "Duration",
- "Operation Duration",
- DOUBLE, 0 );
- WRITE_HDF_FIELD( "Bytes",
- "Bytes",
- "Bytes Requested",
- LONG, 0 );
- WRITE_HDF_FIELD( "Processor Number",
- "Node",
- "Processor number",
- INTEGER, 0 );
-
- recordLength = (int)(hdfRecordPointer - recordBuffer);
-
- hdfRecordPointer = recordBuffer;
- sddfWriteInteger( &hdfRecordPointer, recordLength );
-
- putBytes( recordBuffer, (unsigned) recordLength );
+#ifdef PABLODEBUG
+ fprintf( debugFile, "_hdfMiscDescriptor entered\n" );
+ fflush( debugFile );
+#endif /* PABLODEBUG */
+ hdfRecordPointer = recordBuffer;
+ /*===================================================================*
+ // Allow space at the beginning of the record for the packet *
+ //length which will be computed after the packet is complete. *
+ //===================================================================*/
+ sddfWriteInteger( &hdfRecordPointer, 0 );
+ /*===================================================================*
+ // The record type, tag, and name *
+ //===================================================================*/
+ sddfWriteInteger( &hdfRecordPointer, PKT_DESCRIPTOR );
+ sddfWriteInteger( &hdfRecordPointer, ( FAMILY_MISC | RECORD_TRACE ) );
+ sddfWriteString( &hdfRecordPointer, "Misc Trace" );
+ /*===================================================================*
+ // The record attribute count and string pair *
+ //===================================================================*/
+ sddfWriteInteger( &hdfRecordPointer, 1 );
+ sddfWriteString( &hdfRecordPointer, "description" );
+ sddfWriteString( &hdfRecordPointer, "Misc Trace Record" );
+ /*===================================================================*
+ // The record field count *
+ //===================================================================*/
+ sddfWriteInteger( &hdfRecordPointer, 5);
+ /*===================================================================*
+ // Create fields *
+ //===================================================================*/
+ WRITE_HDF_FIELD( "Event Identifier",
+ "Event ID",
+ "Event Identifier Number",
+ INTEGER,
+ 0 );
+ WRITE_HDF_FIELD( "Seconds",
+ "Seconds",
+ "Floating Point Timestamp",
+ DOUBLE,
+ 0 );
+ WRITE_HDF_FIELD( "Duration",
+ "Duration",
+ "Operation Duration",
+ DOUBLE,
+ 0 );
+ WRITE_HDF_FIELD( "Bytes",
+ "Bytes",
+ "Bytes Requested",
+ LONG,
+ 0 );
+ WRITE_HDF_FIELD( "Processor Number",
+ "Node",
+ "Processor number",
+ INTEGER,
+ 0 );
+
+ recordLength = (int)(hdfRecordPointer - recordBuffer);
+
+ hdfRecordPointer = recordBuffer;
+ sddfWriteInteger( &hdfRecordPointer, recordLength );
+
+ putBytes( recordBuffer, (unsigned) recordLength );
}
#endif /* PCF_BUILD */
diff --git a/pablo/ProcTrace.h b/pablo/ProcTrace.h
index f4650d5..6ff2911 100644
--- a/pablo/ProcTrace.h
+++ b/pablo/ProcTrace.h
@@ -99,7 +99,7 @@ LAST_TRACE_TYPE=MPI_SUMMARY_TRACE,
NUM_HDF_IDS
} ;
-#define SUPPRESS_MPIO_TRACE 2
+#define SUPPRESS_MPIO_TRACE 6
#define ID_HDF_Last_Entry ID_ALLHDF
void HDFinitTrace( const char *, int trace_id, ... );