1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
|
/*
* This file is an extension to NCSA HDF to enable the use of the
* Pablo trace library.
*
* Developed by: The TAPESTRY Parallel Computing Laboratory
* University of Illinois at Urbana-Champaign
* Department of Computer Science
* 1304 W. Springfield Avenue
* Urbana, IL 61801
*
* Copyright (c) 1995
* The University of Illinois Board of Trustees.
* All Rights Reserved.
*
* PABLO is a registered trademark of
* The Board of Trustees of the University of Illinois
* registered in the U.S. Patent and Trademark Office.
*
* Author: George Xin Zhou (xzhou@cs.uiuc.edu)
* Contributing Author: Jonathan M. Reid (jreid@cs.uiuc.edu)
*
* Project Manager and Principal Investigator:
* Daniel A. Reed (reed@cs.uiuc.edu)
*
* Funded by: National Aeronautics and Space Administration under NASA
* Contracts NAG-1-613 and USRA 5555-22 and by the Advanced Research
* Projects Agency under ARPA contracts DAVT63-91-C-0029 and
* DABT63-93-C-0040.
*
*/
/*======================================================================*
// File: PabloHDF_SDDF.c *
// Purpose: support use of Pablo trace library to analyze HDF *
// performance *
// Contents: *
// HDFinitTrace_SDDF: initialize SDDF tracing *
// HDFendTrace_SDDF: end SDDF tracing *
// startHDFtraceEvent: record start of HDF procedure *
// endHDFtraceEvent: record end of HDF proc *
// preInitHDFProcTrace: called by HDFinitTrace_SDDF to set up SDDF *
// interface function calls *
// initHDFProcTrace: called by HDFinitTrace_SDDF to initialize data *
// structures used in tracing HDF procedures. *
// writeHDFProcRecordDescriptors: *
// generates the record descriptors for the HDF *
// procedure entry/exit event families. *
// HDFprocEventRecord: generates trace records for events which are *
// to produce procedure entry or exit event family *
// trace records. *
// findHDFProcEvent: retruns procedure entry/exit index *
// _hdfTraceEntryDescriptor: *
// Generate a SDDF binary format record descriptor *
// for HDF procedure entries *
// _hdfTraceExitDescriptor: *
// Generate a SDDF binary format record descriptor *
// for the HDF procedure exits *
//======================================================================*/
#include <stdio.h>
#ifdef HAVE_PARALLEL
#include "mpi.h"
#endif
#undef HAVE_PABLO
#include "H5private.h"
#define HAVE_PABLO
#include "H5config.h"
#include "ProcIDs.h"
#include "SystemDepend.h"
#include "SDDFparam.h"
#include "TraceParam.h"
#include "Trace.h"
#include "HDF5Trace.h"
void HDFendTrace_SDDF(void);
void startHDFtraceEvent(int eventID);
void endHDFtraceEvent(int , int , char *, int );
int preInitHDFProcTrace( void );
int initHDFProcTrace( int , int * );
int writeHDFProcRecordDescriptors( void );
int findHDFProcEvent( int ) ;
TR_RECORD *HDFprocEventRecord( int, TR_EVENT *, CLOCK, HDFsetInfo *, unsigned );
TR_RECORD *miscEventRecord( int , TR_EVENT *, CLOCK, void *, unsigned );
void _hdfMiscDescriptor( void );
void _hdfProcNameDescriptor( void );
int setEventRecordFunction( int, void *(*)() );
void HDFtraceIOEvent( int, void *, unsigned );
void initIOTrace( void );
void enableIOdetail( void );
void disableLifetimeSummaries( void );
void disableTimeWindowSummaries( void );
void disableFileRegionSummaries( void );
void _hdfTraceDescriptor( char *, char *, int );
void createHDFTraceDescriptor( int );
void HDFfinalTimeStamp( void );
void initIOTrace( void );
void endIOTrace( void );
#define PABLO 1
/* on the ipsc/860 we don't include unistd.h */
#ifndef __NX
#include <unistd.h>
#endif
#define returnRecord(x) return x;
#ifdef HAVE_MPIOTRACE
int initMPIOTrace( char *, int );
void endMPIOTrace( void ) ;
#endif
extern char *hdfRecordPointer;
/*======================================================================*
// Prototypes of functions in this file. *
//======================================================================*/
void HDFinitTrace_SDDF( char *, uint32 );
/*======================================================================*
// Each procedure being traced has associated with it a distinct pair *
// of entry and exit event IDs. This code maintains a vector of such *
// matchings which permits the ready identification of an event ID as *
// being either an entry event or an exit event and for which procedure.*
//======================================================================*/
typedef struct procEventMatch {
int entryID; /* procedure entry event ID */
int exitID; /* procedure exit event ID */
} PROC_EVENTS;
static PROC_EVENTS *procEvents = /* array of event ID pairs */
(PROC_EVENTS *) 0;
/*======================================================================*
// For each procedure being traced this code maintains a stack of *
// procedure entry times. Each procedure entry event causes the *
// corresponding procedure's stack to be pushed, each procedure exit *
// event causes the corresponding procedure's stack to be popped, and *
// from the difference in time between entry and exit the procedure *
// duration may be calculated in a very straightforward subtraction. *
// The above procedure entry-exit event ID matching is used to map *
// events to their corresponding procedures. In addition, the *
// cumulative total of these procedure durations is maintained for all *
// traced subprocedures of each traced procedure. That is, when a *
// traced procedure exits, it increases this duration sum for its most *
// immediate traced ancestor procedure. By subtracting this *
// subprocedure duration sum from the traced procedure's inclusive *
// duration, we arrive at the exclusive duration of the procedure. *
//======================================================================*/
typedef struct procEntryTime {
CLOCK entryTime; /* when proc entered */
CLOCK subProcTime; /* subproc duration */
struct procEntryTime *nextTime; /* stack pointer down */
struct procEntryTime *ancestorProc; /* traced ancestor */
} PROC_ENTRY;
/*
static PROC_ENTRY **procEntryStack =*/ /* array of pointers to */
/* (PROC_ENTRY **) 0;*/ /* stack top elements */
/*======================================================================*
// Define data structure types for procedure entry and exit trace *
// records, similarly to record data structures in Trace.h *
//======================================================================*/
/*======================================================================*
// TraceRecord Data packets: *
//======================================================================*/
struct procTraceRecordData {
int packetLength; /* bytes in packet */
int packetType; /* == PKT_DATA */
int packetTag; /* FAMILY_PROCEXIT | RECORD_TRACE */
int eventID; /* ID of corresponding event */
double seconds; /* floating-point timestamp */
long setID; /* index of file | Data Set accessed */
int nodeNumber; /* occurred on which node */
int nameLen; /* Length of file or data set name */
/* name comes next, but no space is allocated */
};
#define procTraceRecLen 6*sizeof(int) + sizeof(double) +sizeof(long)
/*======================================================================*
// 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 */
};
#define miscTraceLen 5*sizeof(int) + 2*sizeof(double) +sizeof(long)
/*======================================================================*
// The procEntries array specifies the event IDs of procedure entry *
// events. *
//======================================================================*/
int procEntries[] = {
#include "HDFidList.h"
ID_HDF_Last_Entry
};
/*======================================================================*
// The procEntryCalled array indicates whether or not a procedure entry *
// was called. *
//======================================================================*/
int *procEntryCalled;
/*======================================================================*
// The HDFProcNames array holds the names of the HDF entries. *
//======================================================================*/
static char HDFProcNames[][40] = {
#include "HDFentryNames.h"
"HDF_LAST_ENTRY"
};
/*=======================================================================
// NAME *
// HDFinitTrace_SDDF -- initalize HDF tracing with SDDF records *
// USAGE *
// HDFinitTrace_SDDF( traceFileName, procTraceMask ) *
// 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, uint32 procTraceMask )
{
/*===============================================================
// set traceFileName and set IO tracing switches. If MPIO *
// tracing is available, this will be initialized also. *
//==============================================================*/
#ifdef HAVE_PARALLEL
int myNode;
/*===============================================================
// 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 );
#ifdef HAVE_MPIOTRACE
initMPIOTrace( traceFileName, 0 );
#else
buff = (char *)malloc( strlen(traceFileName)+12);
sprintf( buff, "%s.nd%.4d\0",traceFileName,myNode);
setTraceFileName( buff );
free( buff );
#endif
#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 /* HAVE_PARALLEL */
/*===============================================================
// complete HDF initiailization. *
//==============================================================*/
preInitHDFProcTrace();
initHDFProcTrace( sizeof(procEntries)/sizeof(int), procEntries );
procTrace = procTraceMask;
}
/*=======================================================================
// NAME *
// HDFendTrace_SDDF -- end HDF tracing *
// USAGE *
// HDFendTrace_SDDF() *
// RETURNS *
// None. *
//======================================================================*/
void HDFendTrace_SDDF(void)
{
HDFfinalTimeStamp();
#ifdef HAVE_MPIOTRACE
/*===============================================================
// 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 *
// initHDFProcTrace: *
// This function initializes data structures specific to *
// the procedure entry/exit tracing extensions of the Pablo *
// instrumentation library. The argument numProcs specifies *
// how many procedures are to be traced. The argument procEntryID *
// is a vector specifying the event IDs to be use as entry events *
// for each of the procedures. The negative value is used for *
// the exit event ID. *
// USAGE *
// result = initHDFProcTrace(numProcs,procEntryID) *
// PARAMETERS *
// int numProcs -- number of Procedures to be initialized *
// int *procEntryID -- array of id entry codes for these procedures *
// RETURNS *
// SUCCESS or FAILURE *
//======================================================================*/
int initHDFProcTrace( int numProcs, int *procEntryID )
{
int procIndex;
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++ ) {
procEvents[ procIndex ].entryID = procEntryID[ procIndex ];
procEvents[ procIndex ].exitID = -procEntryID[ procIndex ];
setEventRecordFunction( procEntryID[ procIndex ],
(void *(*)())HDFprocEventRecord );
setEventRecordFunction( -procEntryID[ procIndex ],
(void *(*)())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, (void *(*)())miscEventRecord );
setEventRecordFunction( -ID_malloc, (void *(*)())miscEventRecord );
procEvents[ numProcs+1 ].entryID = ID_free;
procEvents[ numProcs+1 ].exitID = -ID_free;
setEventRecordFunction( ID_free, (void *(*)())miscEventRecord );
setEventRecordFunction( -ID_free, (void *(*)())miscEventRecord );
return SUCCESS;
}
/*=======================================================================
// NAME *
// preInitHDFProcTrace: *
// This function calls the trace library interface function *
// setRecordDescriptor, which records the address of the *
// procedure that generates the record descriptors for the *
// procedure trace event families. It is automatically *
// invoked by HDFinitTrace_SDDF. *
// USAGE *
// result = preInitHDFProcTrace(); *
// RESULT *
// SUCCESS or FAILURE *
/=======================================================================*/
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;
}
/*=======================================================================
// NAME *
// writeHDFProcRecordDescriptors: *
// This function generates the record descriptors for the HDF *
// procedure entry/exit event families. It will be invoked *
// by the instrumentation library initialization routines. *
// Patterned after instrumentation library internal function *
// writeRecordDescriptors. *
// USAGE *
// result = writeHDFProcRecordDescriptors(); *
// RESULT *
// SUCCESS *
/=======================================================================*/
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;
}
/*=======================================================================
// NAME *
// HDFprocEventRecord: *
// This function generates trace records for events which are *
// to produce procedure entry or exit event family trace records. *
// Patterned after the instrumentation library internal functions *
// externalEventRecord and sddfRecord. *
// USAGE *
// REC = HDFprocEventRecord( recordType, eventPointer, timeStamp, *
// dataPointer, dataLength) *
// PARAMETERS *
// int recordType -- type of event record *
// TR_EVENT eventPointer -- pointer to event data structure *
// CLOCK timeStamp -- time event is recorded *
// HDFsetInfo dataPointer -- information about HDF data set accessed *
// unsigned dataLength -- dummy for compatability *
// RETURNS *
// pointer to trace record for this event *
//======================================================================*/
TR_RECORD *
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;
#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,
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 = NoDSid;
TraceRecordHeader->nameLen = 0;
}
#ifdef DEBUG
fprintf( debugFile, "HDFprocEventRecord done\n" );
fflush( debugFile );
#endif /* DEBUG */
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 )
{
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 ) );
}
/*======================================================================*
// NAME *
// findHDFProcEvent: *
// Search the procedure entry/exit event ID matching data *
// structure for an event ID (either entry or exit) which is *
// the same as the argument eventID. If found, return the *
// index from that table, which will be between 0 and *
// numberProcedures - 1, inclusive. If not found, return -1; *
// USAGE *
// index = findHDFProcEvent *
// RETURNS *
// index of the procedure corresponding to this ID *
//======================================================================*/
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;
}
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 *
// _hdfTraceDescriptor *
// Generate a SDDF binary format record descriptor for the *
// full trace class of events in the HDF procedure entry *
// USAGE *
// _hdfTraceDescriptro( recordName, recordDescription, recordFamily ) *
// RETURNS *
// void *
//======================================================================*/
void _hdfTraceDescriptor( char *recordName,
char *recordDescription,
int recordFamily )
{
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;
sddfWriteInteger( &hdfRecordPointer, recordLength );
putBytes( recordBuffer, (unsigned) recordLength );
}
/*======================================================================*
// NAME *
// _hdfMiscDescriptor *
// Generate a SDDF binary format record descriptor for the *
// misc procedure *
// USAGE *
// _hdfMiscDescriptor() *
// RETURNS *
// void *
//======================================================================*/
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 );
}
/*#endif */ /* HAVE_PABLO */
|