summaryrefslogtreecommitdiffstats
path: root/pablo/PabloHDF_SDDF.c
diff options
context:
space:
mode:
Diffstat (limited to 'pablo/PabloHDF_SDDF.c')
-rw-r--r--pablo/PabloHDF_SDDF.c934
1 files changed, 460 insertions, 474 deletions
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 */