[svn-r853] Updated code to better handle new HDF entry points.

This commit is contained in:
Dan Wells 1998-10-30 14:46:05 -05:00
parent 6089dc9098
commit 75b0660dbc
3 changed files with 130 additions and 335 deletions

View File

@ -88,7 +88,6 @@ int fileno ( FILE * );
#define HDFtrace3OPEN__ #define HDFtrace3OPEN__
int HDFtrace3OPEN( const char *, int, mode_t ); int HDFtrace3OPEN( const char *, int, mode_t );
/*#include "Assert_TrLib.h"*/
#include "SDDFparam.h" #include "SDDFparam.h"
#include "TraceParam.h" #include "TraceParam.h"
@ -115,7 +114,7 @@ int OUTPUT_SWITCH;
extern void preInitIOTrace( void ); extern void preInitIOTrace( void );
#include "ProcIDs.h" #include "ProcIDs.h"
#include "HDFTrace.h" #include "HDF5Trace.h"
#include "IOTrace.h" #include "IOTrace.h"
#define NO_OUTPUT 0 #define NO_OUTPUT 0
#define SDDF_OUTPUT 1 #define SDDF_OUTPUT 1
@ -127,6 +126,7 @@ void hdfendtrace_ ( void ) ;
void HDFendTrace (void); void HDFendTrace (void);
void HDFendTrace_RT (void); void HDFendTrace_RT (void);
void HDFendTrace_SDDF(void); void HDFendTrace_SDDF(void);
void HDFfinalTimeStamp( void );
void startHDFtraceEvent (int ); void startHDFtraceEvent (int );
int computeProcMask (int eventID); int computeProcMask (int eventID);
int computePacketTag(int eventID); int computePacketTag(int eventID);
@ -839,13 +839,13 @@ void *HDFtraceMALLOC(size_t bytes )
size_t byte_req; size_t byte_req;
byte_req = bytes; byte_req = bytes;
if ( IOtracingEnabled ) { if ( IOtracingEnabled ) {
HDFtraceIOEvent ( ID_malloc, &byte_req, sizeof(size_t) ); HDFtraceIOEvent ( ID_malloc, NULL, 0 );
} }
ptr = malloc( bytes ); ptr = malloc( bytes );
if ( IOtracingEnabled ) { if ( IOtracingEnabled ) {
HDFtraceIOEvent ( -ID_malloc, NULL, 0 ); HDFtraceIOEvent ( -ID_malloc, &byte_req, sizeof(size_t) );
} }
return ptr ; return ptr ;
@ -860,3 +860,36 @@ void HDFtraceIOEvent( int eventType, void *dataPtr, unsigned dataLen )
HDFtraceEvent_RT( eventType, (HDFsetInfo *)dataPtr, dataLen ); HDFtraceEvent_RT( eventType, (HDFsetInfo *)dataPtr, dataLen );
} }
} }
/*======================================================================*
// record the final time stamp *
//======================================================================*/
void HDFfinalTimeStamp( void )
{
TR_LOCK criticalSection;
CLOCK currentTime;
double seconds;
struct {
int packetLength,
packetType,
packetTag,
timeDim;
double Seconds;
int eventID,
node,
dataLen;
} Packet;
criticalSection = TRlock();
currentTime = getClock();
seconds = clockToSeconds( currentTime );
Packet.packetLength = sizeof(Packet);
Packet.packetType = PKT_DATA;
Packet.packetTag = FAMILY_EXTERNAL | RECORD_TRACE;
Packet.timeDim = 0; /* use fp time stamp only */
Packet.Seconds = seconds; /* fp time stamp */
Packet.eventID = ID_timeStamp;
Packet.node = TRgetNode();
Packet.dataLen = 0;
putBytes( (void *)&Packet , sizeof(Packet) );
}

View File

@ -114,7 +114,7 @@
#include "Trace.h" #include "Trace.h"
#include "TraceParam.h" #include "TraceParam.h"
#include "ProcIDs.h" #include "ProcIDs.h"
#include "HDFTrace.h" #include "HDF5Trace.h"
#include "SDDFparam.h" #include "SDDFparam.h"
#include <string.h> #include <string.h>
#include <stdio.h> #include <stdio.h>
@ -137,7 +137,7 @@
#endif #endif
#define NEG_THREAD_ID -999 #define NEG_THREAD_ID -999
#include "HDFrecord_RT.h" #include "HDF5record_RT.h"
#ifdef HAVE_PARALLEL #ifdef HAVE_PARALLEL
#include "MPIO_Init.h" #include "MPIO_Init.h"
@ -207,6 +207,7 @@ void writeHDFRecDescrptrsRT( void );
void printFileMappingsRT( char *, char **, int ); void printFileMappingsRT( char *, char **, int );
void _hdfNameDescriptor( void ); void _hdfNameDescriptor( void );
void _hdfDescriptorRT( char *, char *, int ); void _hdfDescriptorRT( char *, char *, int );
void HDFfinalTimeStamp( void );
/*======================================================================* /*======================================================================*
// Global variables * // Global variables *
//======================================================================*/ //======================================================================*/
@ -272,6 +273,7 @@ void HDFendTrace_RT( )
char **Names; char **Names;
char* mapFile; char* mapFile;
HDFfinalTimeStamp();
/*==============================================================* /*==============================================================*
// Assing pablo ids to named identifiers and tag records * // Assing pablo ids to named identifiers and tag records *
//==============================================================*/ //==============================================================*/
@ -398,9 +400,9 @@ void HDFtraceEvent_RT( int eventType, char *dataPtr, unsigned dataLen )
currentTime = getClock(); currentTime = getClock();
seconds = clockToSeconds( currentTime ); seconds = clockToSeconds( currentTime );
if ( isBeginIOEvent ( eventType ) ) { if ( isBeginIOEvent ( eventType ) || eventType == ID_malloc ) {
BeginIOEventRecord ( eventType, seconds, dataPtr ) ; BeginIOEventRecord ( eventType, seconds, dataPtr ) ;
} else if ( isEndIOEvent( eventType ) ) { } else if ( isEndIOEvent( eventType ) || eventType == -ID_malloc) {
EndIOEventRecord ( eventType, seconds, dataPtr ); EndIOEventRecord ( eventType, seconds, dataPtr );
} else if ( isBeginHDFEvent( eventType ) ) { } else if ( isBeginHDFEvent( eventType ) ) {
BeginHDFEventRecord ( eventType , seconds ) ; BeginHDFEventRecord ( eventType , seconds ) ;
@ -988,8 +990,8 @@ void HDFSummarySDDF( HDFnode_t *P, int procIndex )
HDFnode_t *Q; HDFnode_t *Q;
struct { struct {
int packetLen, int packetLen,
packetTag,
packetType, packetType,
packetTag,
eventID, eventID,
threadID, threadID,
nCalls; nCalls;
@ -1011,17 +1013,19 @@ void HDFSummarySDDF( HDFnode_t *P, int procIndex )
+ nByteFields*sizeof(int) /* array lens */ + nByteFields*sizeof(int) /* array lens */
+ nByteFields*nBkts*sizeof(int) /* byte hist */ + nByteFields*nBkts*sizeof(int) /* byte hist */
+ sizeof(int) ; /* Name len */ + sizeof(int) ; /* Name len */
Header.packetTag = ( procIndex + 1 )*HDF_FAMILY | RECORD_TRACE ; Header.packetTag = HDF_SUMMARY_FAMILY +
( procIndex + 1 )*8 + RECORD_TRACE ;
Header.packetType = PKT_DATA; Header.packetType = PKT_DATA;
Header.threadID = TRgetNode(); Header.threadID = TRgetNode();
while ( P != NULL ) { while ( P != NULL ) {
Q = P->ptr; Q = P->ptr;
Header.eventID = Q->eventID; Header.eventID = P->eventID;
Header.Seconds = Q->record.lastCall; Header.nCalls = P->record.nCalls;
Header.IncDur = Q->record.incDur; Header.Seconds = P->record.lastCall;
Header.ExcDur = Q->record.excDur; Header.IncDur = P->record.incDur;
Header.HDFid = Q->record.hdfID; Header.ExcDur = P->record.excDur;
Header.XREFid = Q->record.xRef; Header.HDFid = P->record.hdfID;
Header.XREFid = P->record.xRef;
memcpy( Packet, &Header, sizeof(Header) ); memcpy( Packet, &Header, sizeof(Header) );
Packet += sizeof(Header); Packet += sizeof(Header);
/*===========================================================* /*===========================================================*
@ -1030,15 +1034,15 @@ void HDFSummarySDDF( HDFnode_t *P, int procIndex )
arrayLen = nTallyFields; arrayLen = nTallyFields;
memcpy( Packet, &arrayLen, sizeof(int) ); memcpy( Packet, &arrayLen, sizeof(int) );
Packet += sizeof(int); Packet += sizeof(int);
memcpy( Packet, Q->record.times, nTallyFields*sizeof(int) ); memcpy( Packet, P->record.times, nTallyFields*sizeof(double) );
Packet += nTallyFields*sizeof(int); Packet += nTallyFields*sizeof(double);
/*===========================================================* /*===========================================================*
// copy length of counts array and counts array to Packet. * // copy length of counts array and counts array to Packet. *
//===========================================================*/ //===========================================================*/
arrayLen = nTallyFields; arrayLen = nTallyFields;
memcpy( Packet, &arrayLen, sizeof(int) ); memcpy( Packet, &arrayLen, sizeof(int) );
Packet += sizeof(int); Packet += sizeof(int);
memcpy( Packet, Q->record.counts, nTallyFields*sizeof(int) ); memcpy( Packet, P->record.counts, nTallyFields*sizeof(int) );
Packet += nTallyFields*sizeof(int); Packet += nTallyFields*sizeof(int);
/*===========================================================* /*===========================================================*
// copy length of bytes array and bytes array to Packet. * // copy length of bytes array and bytes array to Packet. *
@ -1046,7 +1050,7 @@ void HDFSummarySDDF( HDFnode_t *P, int procIndex )
arrayLen = nByteFields; arrayLen = nByteFields;
memcpy( Packet, &arrayLen, sizeof(int) ); memcpy( Packet, &arrayLen, sizeof(int) );
Packet += sizeof(int); Packet += sizeof(int);
memcpy( Packet, Q->record.counts, nByteFields*sizeof(int) ); memcpy( Packet, P->record.bytes, nByteFields*sizeof(int) );
Packet += nByteFields*sizeof(int); Packet += nByteFields*sizeof(int);
/*===========================================================* /*===========================================================*
// copy length of historgram arrays and arrays to Packet. * // copy length of historgram arrays and arrays to Packet. *
@ -1055,7 +1059,7 @@ void HDFSummarySDDF( HDFnode_t *P, int procIndex )
for ( i = 0; i < nByteFields; ++i ) { for ( i = 0; i < nByteFields; ++i ) {
memcpy( Packet, &arrayLen, sizeof(int) ); memcpy( Packet, &arrayLen, sizeof(int) );
Packet += sizeof(int); Packet += sizeof(int);
memcpy( Packet, Q->record.Hists[i], nBkts*sizeof(int) ); memcpy( Packet, P->record.Hists[i], nBkts*sizeof(int) );
Packet += nBkts*sizeof(int); Packet += nBkts*sizeof(int);
} }
arrayLen = 0; /* name length */ arrayLen = 0; /* name length */
@ -1375,7 +1379,7 @@ void writeHDFRecDescrptrsRT()
# include "HDFentryNames.h" # include "HDFentryNames.h"
"HDF_Last_Entry" "HDF_Last_Entry"
}; };
int j; int j, FAMILY;
char BUF1[256], BUF2[256] ; char BUF1[256], BUF2[256] ;
_hdfNameDescriptor(); /* Descriptor for named identifiers */ _hdfNameDescriptor(); /* Descriptor for named identifiers */
for ( j = 0; j < NumHDFProcs; ++j ) { for ( j = 0; j < NumHDFProcs; ++j ) {
@ -1385,7 +1389,8 @@ void writeHDFRecDescrptrsRT()
strcat( BUF2, " Procedure Summary"); strcat( BUF2, " Procedure Summary");
strcpy( BUF1, BUF2 ); strcpy( BUF1, BUF2 );
strcat( BUF1, " Trace"); strcat( BUF1, " Trace");
_hdfDescriptorRT( BUF1, BUF2, (j+1)*HDF_FAMILY ); FAMILY = HDF_SUMMARY_FAMILY + (j + 1)*8;
_hdfDescriptorRT( BUF1, BUF2, FAMILY );
} }
} }
return; return;

View File

@ -71,7 +71,7 @@
#include "SDDFparam.h" #include "SDDFparam.h"
#include "TraceParam.h" #include "TraceParam.h"
#include "Trace.h" #include "Trace.h"
#include "HDFTrace.h" #include "HDF5Trace.h"
void HDFendTrace_SDDF(void); void HDFendTrace_SDDF(void);
void startHDFtraceEvent(int eventID); void startHDFtraceEvent(int eventID);
void endHDFtraceEvent(int , int , char *, int ); void endHDFtraceEvent(int , int , char *, int );
@ -81,8 +81,6 @@ int writeHDFProcRecordDescriptors( void );
int findHDFProcEvent( int ) ; int findHDFProcEvent( int ) ;
TR_RECORD *HDFprocEventRecord( int, TR_EVENT *, CLOCK, HDFsetInfo *, unsigned ); TR_RECORD *HDFprocEventRecord( int, TR_EVENT *, CLOCK, HDFsetInfo *, unsigned );
TR_RECORD *miscEventRecord( int , TR_EVENT *, CLOCK, void *, unsigned ); TR_RECORD *miscEventRecord( int , TR_EVENT *, CLOCK, void *, unsigned );
void _hdfTraceEntryDescriptor( void );
void _hdfTraceExitDescriptor( void );
void _hdfMiscDescriptor( void ); void _hdfMiscDescriptor( void );
void _hdfProcNameDescriptor( void ); void _hdfProcNameDescriptor( void );
int setEventRecordFunction( int, void * ); int setEventRecordFunction( int, void * );
@ -92,6 +90,9 @@ void enableIOdetail( void );
void disableLifetimeSummaries( void ); void disableLifetimeSummaries( void );
void disableTimeWindowSummaries( void ); void disableTimeWindowSummaries( void );
void disableFileRegionSummaries( void ); void disableFileRegionSummaries( void );
void _hdfTraceDescriptor( char *, char *, int );
void createHDFTraceDescriptor( int );
void HDFfinalTimeStamp( void );
void initIOTrace( void ); void initIOTrace( void );
void endIOTrace( void ); void endIOTrace( void );
@ -156,24 +157,10 @@ static PROC_ENTRY **procEntryStack =*/ /* array of pointers to */
// records, similarly to record data structures in Trace.h * // records, similarly to record data structures in Trace.h *
//======================================================================*/ //======================================================================*/
/*======================================================================*
// FAMILY_PROCENTRY family Record Data packets: *
//======================================================================*/
struct procEntryTraceRecordData {
int packetLength; /* bytes in packet */
int packetType; /* == PKT_DATA */
int packetTag; /* FAMILY_PROCENTRY | RECORD_TRACE */
int eventID; /* ID of corresponding event */
double seconds; /* floating-point timestamp */
long sourceByte; /* source code byte offset in file */
int sourceLine; /* source code line number in file */
int nodeNumber; /* occurred on which node */
};
#define procEntryTraceLen 6*sizeof(int) + sizeof(long) + sizeof(double)
/*======================================================================* /*======================================================================*
// FAMILY_PROCEXIT family Record Data packets: * // TraceRecord Data packets: *
//======================================================================*/ //======================================================================*/
struct procExitTraceRecordData { struct procTraceRecordData {
int packetLength; /* bytes in packet */ int packetLength; /* bytes in packet */
int packetType; /* == PKT_DATA */ int packetType; /* == PKT_DATA */
int packetTag; /* FAMILY_PROCEXIT | RECORD_TRACE */ int packetTag; /* FAMILY_PROCEXIT | RECORD_TRACE */
@ -184,7 +171,7 @@ struct procExitTraceRecordData {
int nameLen; /* Length of file or data set name */ int nameLen; /* Length of file or data set name */
/* name comes next, but no space is allocated */ /* name comes next, but no space is allocated */
}; };
#define procExitTraceLen 6*sizeof(int) + 3*sizeof(double) +sizeof(long) #define procTraceRecLen 6*sizeof(int) + sizeof(double) +sizeof(long)
/*======================================================================* /*======================================================================*
// misc Record Data packets: * // misc Record Data packets: *
//======================================================================*/ //======================================================================*/
@ -199,31 +186,6 @@ struct miscTraceRecordData {
int nodeNumber; /* occurred on which node */ int nodeNumber; /* occurred on which node */
}; };
#define miscTraceLen 5*sizeof(int) + 2*sizeof(double) +sizeof(long) #define miscTraceLen 5*sizeof(int) + 2*sizeof(double) +sizeof(long)
/*======================================================================*
// HDFprocName Record Data packets: *
// These are used to pass information about the names of the traced *
// routine in the trace file to the post processing utilities. *
//======================================================================*/
struct HDFprocNameRecordData {
int packetLength; /* bytes in packet */
int packetType; /* == PKT_DATA */
int packetTag; /* FAMILY_HDFPROCNAME | RECORD_TRACE */
int eventID; /* ID of corresponding event */
int HDFeventID; /* ID of HDF proc */
int procIndex; /* Index of HDF proc */
int numProcs; /* Number of HDF procs */
int NameLen; /* length of HDF proc Name */
char *Name;
};
#define HDFprocNameRecLen 8*sizeof(int)
/*======================================================================*
// Define data structures used to contain source code location data for *
// Pablo instrumenting parser-generated code. *
//======================================================================*/
static long procByteOffset = -1; /* source code byte offset */
static int procLineNumber = -1; /* source code line number */
/*======================================================================* /*======================================================================*
// The procEntries array specifies the event IDs of procedure entry * // The procEntries array specifies the event IDs of procedure entry *
// events. * // events. *
@ -307,7 +269,6 @@ void HDFinitTrace_SDDF( char *traceFileName, uint32 procTraceMask )
//======================================================================*/ //======================================================================*/
void HDFendTrace_SDDF(void) void HDFendTrace_SDDF(void)
{ {
HDFtraceIOEvent( -ID_timeStamp, 0, 0 );
#ifdef HAVE_MPIOTRACE #ifdef HAVE_MPIOTRACE
/*=============================================================== /*===============================================================
// termintate MPI-IO tracing in the parallel case. This will * // termintate MPI-IO tracing in the parallel case. This will *
@ -318,6 +279,7 @@ void HDFendTrace_SDDF(void)
/*=============================================================== /*===============================================================
// terminate tracing * // terminate tracing *
//==============================================================*/ //==============================================================*/
HDFfinalTimeStamp();
endIOTrace(); endIOTrace();
endTracing(); endTracing();
#endif #endif
@ -391,10 +353,6 @@ int initHDFProcTrace( int numProcs, int *procEntryID )
procEvents[ numProcs+1 ].exitID = -ID_free; procEvents[ numProcs+1 ].exitID = -ID_free;
setEventRecordFunction( ID_free, miscEventRecord ); setEventRecordFunction( ID_free, miscEventRecord );
setEventRecordFunction( -ID_free, miscEventRecord ); setEventRecordFunction( -ID_free, miscEventRecord );
procEvents[ numProcs+2 ].entryID = ID_timeStamp;
procEvents[ numProcs+2 ].exitID = -ID_timeStamp;
setEventRecordFunction( ID_timeStamp, miscEventRecord );
setEventRecordFunction( -ID_timeStamp, miscEventRecord );
return SUCCESS; return SUCCESS;
} }
@ -448,9 +406,6 @@ int writeHDFProcRecordDescriptors( void )
#endif /* DEBUG */ #endif /* DEBUG */
_hdfMiscDescriptor(); _hdfMiscDescriptor();
_hdfTraceEntryDescriptor() ;
_hdfTraceExitDescriptor() ;
_hdfProcNameDescriptor();
#ifdef DEBUG #ifdef DEBUG
fprintf( debugFile, "writeHDFProcRecordDescriptors done\n" ); fprintf( debugFile, "writeHDFProcRecordDescriptors done\n" );
@ -484,19 +439,15 @@ HDFprocEventRecord( int recordType, TR_EVENT *eventPointer, CLOCK timeStamp,
static TR_RECORD traceRecord; static TR_RECORD traceRecord;
static void *recordBuffer = NULL; static void *recordBuffer = NULL;
static int bufferLength = 0; static int bufferLength = 0;
struct procEntryTraceRecordData *entryTraceRecordHeader; struct procTraceRecordData *TraceRecordHeader;
struct procExitTraceRecordData *exitTraceRecordHeader;
struct HDFprocNameRecordData *nameRecord;
int procIndex; int procIndex;
int recordFamily; int recordFamily;
char *namePtr; char *namePtr;
int NameLen;
int NameRecLen; #ifdef DEBUG
fprintf( debugFile, "HDFprocEventRecord\n" );
#ifdef DEBUG fflush( debugFile );
fprintf( debugFile, "HDFprocEventRecord\n" ); #endif /* DEBUG */
fflush( debugFile );
#endif /* DEBUG */
/*==============================================================* /*==============================================================*
// Find the index in the tables for the procedure corresponding * // Find the index in the tables for the procedure corresponding *
@ -512,25 +463,7 @@ HDFprocEventRecord( int recordType, TR_EVENT *eventPointer, CLOCK timeStamp,
// not already been produced. * // not already been produced. *
//==============================================================*/ //==============================================================*/
if ( procEntryCalled[procIndex] == 0 ) { if ( procEntryCalled[procIndex] == 0 ) {
NameLen = strlen( HDFProcNames[procIndex] ); createHDFTraceDescriptor( procIndex );
NameRecLen = HDFprocNameRecLen + NameLen;
nameRecord = ( struct HDFprocNameRecordData *)malloc( NameRecLen );
nameRecord->packetLength = NameRecLen;
nameRecord->packetType = PKT_DATA;
nameRecord->packetTag = FAMILY_HDFPROCNAME | RECORD_TRACE;
nameRecord->eventID = ID_HDFprocName;
nameRecord->HDFeventID = abs(eventPointer->eventID);
nameRecord->procIndex = procIndex;
nameRecord->numProcs = NumHDFProcs;
nameRecord->NameLen = NameLen;
/*===========================================================*
// copy procedure name into the packet, write out the packet *
// and set ProcEntryCalled[procIndex] to indicate the name *
// packet was produced. *
//===========================================================*/
memcpy( &(nameRecord->Name), HDFProcNames[procIndex], NameLen );
putBytes( (char *)nameRecord , NameRecLen );
free( nameRecord );
procEntryCalled[procIndex] = 1; procEntryCalled[procIndex] = 1;
} }
/*==============================================================* /*==============================================================*
@ -538,11 +471,7 @@ HDFprocEventRecord( int recordType, TR_EVENT *eventPointer, CLOCK timeStamp,
// exit family event by lookup in the procedure event ID * // exit family event by lookup in the procedure event ID *
// matching. * // matching. *
//==============================================================*/ //==============================================================*/
if ( procEvents[ procIndex ].entryID == eventPointer->eventID ) { recordFamily = HDF_FAMILY + ( procIndex + 1)*8;
recordFamily = FAMILY_PROCENTRY;
} else {
recordFamily = FAMILY_PROCEXIT;
}
/*==============================================================* /*==============================================================*
// The time stamp stored in the event descriptor will be used * // The time stamp stored in the event descriptor will be used *
// unless one is specified in the timeStamp parameter. * // unless one is specified in the timeStamp parameter. *
@ -554,16 +483,7 @@ HDFprocEventRecord( int recordType, TR_EVENT *eventPointer, CLOCK timeStamp,
// Determine how many bytes of storage will be needed for the * // Determine how many bytes of storage will be needed for the *
// contents of the trace record. * // contents of the trace record. *
//==============================================================*/ //==============================================================*/
switch (( recordFamily | recordType )) { traceRecord.recordLength = sizeof *TraceRecordHeader;
case FAMILY_PROCENTRY | RECORD_TRACE:
traceRecord.recordLength = sizeof *entryTraceRecordHeader;
break;
case FAMILY_PROCEXIT | RECORD_TRACE:
traceRecord.recordLength = sizeof *exitTraceRecordHeader;
break;
}
if ( dataPointer != NULL && dataPointer->setName != NULL ) { if ( dataPointer != NULL && dataPointer->setName != NULL ) {
traceRecord.recordLength += strlen( dataPointer->setName ); traceRecord.recordLength += strlen( dataPointer->setName );
} }
@ -590,54 +510,30 @@ HDFprocEventRecord( int recordType, TR_EVENT *eventPointer, CLOCK timeStamp,
/*==============================================================* /*==============================================================*
// Load the trace record fields into the allocated buffer * // Load the trace record fields into the allocated buffer *
//==============================================================*/ //==============================================================*/
switch (( recordFamily | recordType )) { 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();
case FAMILY_PROCENTRY | RECORD_TRACE: if ( dataPointer != 0 ) {
entryTraceRecordHeader = (struct procEntryTraceRecordData *) TraceRecordHeader->setID = dataPointer->setID;
recordBuffer; if (dataPointer->setName != NULL ) {
entryTraceRecordHeader->packetLength = TraceRecordHeader->nameLen = (int)strlen( dataPointer->setName );
traceRecord.recordLength; /*================================================*
entryTraceRecordHeader->packetType = PKT_DATA; // copy name directly into the end of the buffer. *
entryTraceRecordHeader->packetTag = recordFamily | recordType; //================================================*/
entryTraceRecordHeader->seconds = clockToSeconds( timeStamp ); namePtr = (char *)TraceRecordHeader + procTraceRecLen;
entryTraceRecordHeader->eventID = eventPointer->eventID; memcpy(namePtr, dataPointer->setName, TraceRecordHeader->nameLen);
entryTraceRecordHeader->nodeNumber = TRgetNode(); } else {
entryTraceRecordHeader->sourceByte = procByteOffset; TraceRecordHeader->nameLen = 0;
entryTraceRecordHeader->sourceLine = procLineNumber; }
break; } else {
TraceRecordHeader->setID = NoDSid;
case FAMILY_PROCEXIT | RECORD_TRACE: TraceRecordHeader->nameLen = 0;
exitTraceRecordHeader = (struct procExitTraceRecordData *) }
recordBuffer;
exitTraceRecordHeader->packetLength =
traceRecord.recordLength;
exitTraceRecordHeader->packetType = PKT_DATA;
exitTraceRecordHeader->packetTag = recordFamily | recordType;
exitTraceRecordHeader->seconds = clockToSeconds( timeStamp );
exitTraceRecordHeader->eventID = eventPointer->eventID;
exitTraceRecordHeader->nodeNumber = TRgetNode();
if ( dataPointer != 0 ) {
exitTraceRecordHeader->setID = dataPointer->setID;
if (dataPointer->setName != NULL ) {
exitTraceRecordHeader->nameLen
= (int)strlen( dataPointer->setName );
/*================================================*
// copy name directly into the end of the buffer. *
//================================================*/
namePtr = (char *)exitTraceRecordHeader
+ procExitTraceLen;
memcpy( namePtr, dataPointer->setName,
exitTraceRecordHeader->nameLen );
} else {
exitTraceRecordHeader->nameLen = 0;
}
} else {
exitTraceRecordHeader->setID = NoDSid;
exitTraceRecordHeader->nameLen = 0;
}
break;
}
#ifdef DEBUG #ifdef DEBUG
fprintf( debugFile, "HDFprocEventRecord done\n" ); fprintf( debugFile, "HDFprocEventRecord done\n" );
@ -680,23 +576,15 @@ TR_RECORD *miscEventRecord( int recordType,
case ID_malloc: case ID_malloc:
case ID_free: case ID_free:
miscRecord.seconds = clockToSeconds( timeStamp ) ; miscRecord.seconds = clockToSeconds( timeStamp ) ;
miscRecord.bytes = *(size_t *)dataPointer;
miscRecord.eventID = eventID ; miscRecord.eventID = eventID ;
break; break;
case -ID_malloc: case -ID_malloc:
case -ID_free: case -ID_free:
miscRecord.bytes = *(size_t *)dataPointer;
miscRecord.duration = clockToSeconds( timeStamp) miscRecord.duration = clockToSeconds( timeStamp)
- miscRecord.seconds; - miscRecord.seconds;
return &traceRecord; /* generate trace record */ return &traceRecord; /* generate trace record */
break; break;
case ID_timeStamp:
case -ID_timeStamp:
miscRecord.seconds = clockToSeconds( timeStamp ) ;
miscRecord.bytes = 0;
miscRecord.eventID = eventID ;
miscRecord.duration = 0;
return &traceRecord;
break;
default: default:
fprintf( stderr, "miscEventRecord: unknown eventID %d\n", eventID ); fprintf( stderr, "miscEventRecord: unknown eventID %d\n", eventID );
break; break;
@ -738,43 +626,54 @@ int findHDFProcEvent( int eventID )
} }
return procIndex; 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 );
}
/*======================================================================* /*======================================================================*
// NAME * // NAME *
// _hdfTraceEntryDescriptor * // _hdfTraceDescriptor *
// Generate a SDDF binary format record descriptor for the * // Generate a SDDF binary format record descriptor for the *
// full trace class of events in the HDF procedure entry * // full trace class of events in the HDF procedure entry *
// USAGE * // USAGE *
// _hdfTraceEntryDescriptro() * // _hdfTraceDescriptro( recordName, recordDescription, recordFamily ) *
// RETURNS * // RETURNS *
// void * // void *
//======================================================================*/ //======================================================================*/
void _hdfTraceEntryDescriptor( void ) void _hdfTraceDescriptor( char *recordName,
char *recordDescription,
int recordFamily )
{ {
static char recordBuffer[ 4096 ]; static char recordBuffer[ 4096 ];
int recordLength; int recordLength;
#ifdef DEBUG
fprintf( debugFile, "_hdfTraceEntryDescriptor entered\n" );
fflush( debugFile );
#endif /* DEBUG */
hdfRecordPointer = recordBuffer; hdfRecordPointer = recordBuffer;
/*==================================================================* /*===================================================================
// Allow space at the beginning of the record for the packet * // Allow space at the beginning of the record for the packet *
//length which will be computed after the packet is complete. * //length which will be computed after the packet is complete. *
//==================================================================*/ //==================================================================*/
sddfWriteInteger( &hdfRecordPointer, 0 ); sddfWriteInteger( &hdfRecordPointer, 0 );
/*==================================================================* /*===================================================================
// The record type, tag, and name * // The record type, tag, and name *
//==================================================================*/ //==================================================================*/
sddfWriteInteger( &hdfRecordPointer, PKT_DESCRIPTOR ); sddfWriteInteger( &hdfRecordPointer, PKT_DESCRIPTOR );
sddfWriteInteger( &hdfRecordPointer, ( FAMILY_PROCENTRY | RECORD_TRACE ) ); sddfWriteInteger( &hdfRecordPointer, ( recordFamily | RECORD_TRACE ) );
sddfWriteString( &hdfRecordPointer, "HDF Procedure Entry Trace" ); sddfWriteString( &hdfRecordPointer, recordName );
/*==================================================================* /*===================================================================
// The record attribute count and string pair * // The record attribute count and string pair *
//==================================================================*/ //==================================================================*/
sddfWriteInteger( &hdfRecordPointer, 1 ); sddfWriteInteger( &hdfRecordPointer, 1 );
sddfWriteString( &hdfRecordPointer, "description" ); sddfWriteString( &hdfRecordPointer, "description" );
sddfWriteString( &hdfRecordPointer, "HDF Procedure Entry Trace Record" ); sddfWriteString( &hdfRecordPointer, recordDescription );
/*==================================================================* /*==================================================================*
// The record field count * // The record field count *
//==================================================================*/ //==================================================================*/
@ -782,78 +681,6 @@ void _hdfTraceEntryDescriptor( void )
/*==================================================================* /*==================================================================*
// Create fields * // 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( "Source Byte",
"Byte",
"Source Byte Offset",
LONG, 0 );
WRITE_HDF_FIELD( "Source Line",
"Line",
"Source Line Number",
INTEGER, 0 );
WRITE_HDF_FIELD( "Processor Number",
"Node",
"Processor number",
INTEGER, 0 );
recordLength = (int)(hdfRecordPointer - recordBuffer);
hdfRecordPointer = recordBuffer;
sddfWriteInteger( &hdfRecordPointer, recordLength );
putBytes( recordBuffer, (unsigned) recordLength );
}
/*======================================================================*
// NAME *
// _hdfTraceExitDescriptor *
// Generate a SDDF binary format record descriptor for the *
// full trace class of events in the HDF procedure exit *
// USAGE *
// _hdfTraceExitDescriptor() *
// RETURNS *
// void *
//======================================================================*/
void _hdfTraceExitDescriptor( void )
{
static char recordBuffer[ 4096 ];
int recordLength;
#ifdef DEBUG
fprintf( debugFile, "_hdfExitTraceDescriptor 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_PROCEXIT | RECORD_TRACE ) );
sddfWriteString( &hdfRecordPointer, "HDF Procedure Exit Trace" );
/*==================================================================*
// The record attribute count and string pair *
//==================================================================*/
sddfWriteInteger( &hdfRecordPointer, 1 );
sddfWriteString( &hdfRecordPointer, "description" );
sddfWriteString( &hdfRecordPointer, "HDF Procedure Exit Trace Record" );
/*==================================================================*
// The record field count *
//==================================================================*/
sddfWriteInteger( &hdfRecordPointer, 5);
/*==================================================================*
// Create fields *
//==================================================================*/
WRITE_HDF_FIELD( "Event Identifier", WRITE_HDF_FIELD( "Event Identifier",
"Event ID", "Event ID",
"Event Identifier Number", "Event Identifier Number",
@ -870,10 +697,11 @@ void _hdfTraceExitDescriptor( void )
"Node", "Node",
"Processor number", "Processor number",
INTEGER, 0 ); INTEGER, 0 );
WRITE_HDF_FIELD( "HDF Name", WRITE_HDF_FIELD( "HDF Name",
"HDF Name", "Name of File, Data Set or Dim", "HDF Name", "Name of File, Data Set or Dim",
CHARACTER, 1 ); CHARACTER, 1 );
recordLength = (int)(hdfRecordPointer - recordBuffer); recordLength = (int)(hdfRecordPointer - recordBuffer);
hdfRecordPointer = recordBuffer; hdfRecordPointer = recordBuffer;
@ -881,7 +709,6 @@ void _hdfTraceExitDescriptor( void )
putBytes( recordBuffer, (unsigned) recordLength ); putBytes( recordBuffer, (unsigned) recordLength );
} }
/*======================================================================* /*======================================================================*
// NAME * // NAME *
// _hdfMiscDescriptor * // _hdfMiscDescriptor *
@ -954,75 +781,5 @@ void _hdfMiscDescriptor( void )
putBytes( recordBuffer, (unsigned) recordLength ); putBytes( recordBuffer, (unsigned) recordLength );
} }
/*======================================================================*
// NAME *
// _hdfProcNameDescriptor *
// Generate a SDDF binary format record descriptor for the *
// HDFProcName Records *
// USAGE *
// _hdfProcNameDescriptor() *
// RETURNS *
// void *
//======================================================================*/
void _hdfProcNameDescriptor( void )
{
static char recordBuffer[ 4096 ];
int recordLength;
#ifdef DEBUG
fprintf( debugFile, "_hdfProcNameDescriptor 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_HDFPROCNAME| RECORD_TRACE ) );
sddfWriteString( &hdfRecordPointer, "HDF Procedure Information" );
/*==================================================================*
// The record attribute count and string pair *
//==================================================================*/
sddfWriteInteger( &hdfRecordPointer, 1 );
sddfWriteString( &hdfRecordPointer, "description" );
sddfWriteString( &hdfRecordPointer, "HDF Proc Info 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( "HDF Proc Event Id",
"HDF Proc Event Identifier",
"HDF Proc Event Identifier Number",
INTEGER, 0 );
WRITE_HDF_FIELD( "HDF Proc Index",
"HDF Proc Index",
"Index of HDF Proc in Tables",
INTEGER, 0 );
WRITE_HDF_FIELD( "Num HDF Procs",
"Num HDF Procs",
"Number of HDF Procedures",
INTEGER, 0 );
WRITE_HDF_FIELD( "HDF Proc Name",
"HDF Proc Name",
"Name of HDF Procedure",
CHARACTER, 1 );
recordLength = (int)(hdfRecordPointer - recordBuffer);
hdfRecordPointer = recordBuffer;
sddfWriteInteger( &hdfRecordPointer, recordLength );
putBytes( recordBuffer, (unsigned) recordLength );
}
/*#endif */ /* HAVE_PABLO */ /*#endif */ /* HAVE_PABLO */