📄 slog_irec_write.c
字号:
"frame buffer size = "fmt_ui32"\n", slog->reserve->Nbytes_tot, old_buf_Nbytes_in_file, fbuf_bufsz( slog->fbuf ) ); fflush( errfile ); } } */ /* Endif ( slog->HasIrec2IOStreamBeenUsed == SLOG_TRUE ) */#if defined( CHECKTIMEORDER ) /* Check if the starttime supplied in this call follows the increasing starttime order of the previous call. */ if ( starttime < slog->prev_starttime ) { fprintf( errfile, __FILE__":SLOG_Irec_ReserveSpace() - Warning!!!\n" "\t""Current starttime("fmt_time") is earlier " "than previous starttime("fmt_time")\n", starttime, slog->prev_starttime ); fflush( errfile ); } slog->prev_starttime = starttime;#endif return SLOG_SUCCESS;}/*@C SLOG_Irec_SetMinRec - Set the fields for a bare minimal Interval Record Modified Input Variables :. intvlrec - pointer to the internal interval record to be modified. Unmodified Input Variables :. rectype - interval record's record field which determines if the record is a FIXED record or VARIABLE record, this in turns will determine the number of association and the number of sets of MPI call arguments. . intvltype - interval record's interval type field.. bebit_0 - interval record's first bebit.. bebit_1 - interval record's second bebit.. starttime - interval record's start time.. duration - interval record's life time.. orig_node_id - interval record's origin node ID.. orig_cpu_id - interval record's origin cpu ID.. orig_thread_id - interval record's origin thread ID.. instr_addr - interval record's instr_addr integer pointer.. ... - destination task labels for Message Record ( optional ) : dest_node_id - interval record's destination node ID. dest_cpu_id - interval record's destination cpu ID. dest_thread_id - interval record's destination thread ID. Modified Output Variables :. returned value - integer return status. Usage Notes on this subroutine : The subroutine initializes an allocated internal interval record data structure. So the routine must be called before appending the record to the SLOG file. The rectype may be a Message Record type. Include File Needed : slog.h.N SLOG_RETURN_STATUS@*/int SLOG_Irec_SetMinRec( SLOG_intvlrec_t *intvlrec, const SLOG_rectype_t rectype, const SLOG_intvltype_t intvltype, const SLOG_bebit_t bebit_0, const SLOG_bebit_t bebit_1, const SLOG_starttime_t starttime, const SLOG_duration_t duration, const SLOG_nodeID_t orig_node_id, const SLOG_cpuID_t orig_cpu_id, const SLOG_threadID_t orig_thread_id, const SLOG_iaddr_t instr_addr, ... ){ /* Local Variables */ va_list ap; SLOG_nodeID_t dest_node_id; SLOG_cpuID_t dest_cpu_id; SLOG_threadID_t dest_thread_id; if ( intvlrec == NULL ) { fprintf( errfile, __FILE__":SLOG_Irec_SetMinRec() - " "Destination interval record pointer is NULL/n" ); fflush( errfile ); return SLOG_FAIL; } /* Assemble all the input arguments as a SLOG_intvlrec_t, intvlrec */ intvlrec->rectype = rectype ; intvlrec->intvltype = intvltype; intvlrec->bebits[0] = bebit_0 ; intvlrec->bebits[1] = bebit_1 ; intvlrec->starttime = starttime; intvlrec->duration = duration ; SLOG_TaskID_Assign( &( intvlrec->origID ), orig_node_id, orig_cpu_id, orig_thread_id ); intvlrec->instr_addr = instr_addr ; intvlrec->bytesize = SLOG_typesz[ min_IntvlRec ]; if ( SLOG_global_IsOffDiagRec( intvlrec->rectype ) ) { va_start( ap, instr_addr );#if defined( GCC296_VA_ARG_FIX ) dest_node_id = va_arg( ap, SLOG_uint32 ); dest_cpu_id = va_arg( ap, SLOG_uint32 ); dest_thread_id = va_arg( ap, SLOG_uint32 );#else dest_node_id = va_arg( ap, SLOG_nodeID_t ); dest_cpu_id = va_arg( ap, SLOG_cpuID_t ); dest_thread_id = va_arg( ap, SLOG_threadID_t );#endif va_end( ap ); SLOG_TaskID_Assign( &( intvlrec->destID ), dest_node_id, dest_cpu_id, dest_thread_id ); intvlrec->bytesize += SLOG_typesz[ taskID_t ]; } return SLOG_SUCCESS;}/*@C SLOG_Irec_SetDestTaskLabel - Set the Destination Task IDs which are needed for a Message Record, i.e. Arrow. Modified Input Variables :. intvlrec - pointer to the internal Interval record to be modified. Unmodified Input Variables :. node_id - interval record's extra node ID.. cpu_id - interval record's extra cpu ID.. thread_id - interval record's extra thread ID. Modified Output Variables :. returned value - integer return status. Usage Notes on this subroutine : The subroutine appends the specified Internal Interval Record with the extra set of Task Labels. This subroutine is meant to be called once for each "Message" or "Arrow" interval record written to the slogfile. Include File Needed : slog.h@*/int SLOG_Irec_SetDestTaskLabel( SLOG_intvlrec_t *intvlrec, const SLOG_nodeID_t node_id, const SLOG_cpuID_t cpu_id, const SLOG_threadID_t thread_id ){ if ( intvlrec->bytesize == 0 ) { fprintf( errfile, __FILE__":SLOG_Irec_SetDestTaskLabel() - " "SLOG_Irec_SetMinRec() needs to be called first\n" ); fflush( errfile ); return SLOG_FAIL; } if ( ! SLOG_global_IsOffDiagRec( intvlrec->rectype ) ) { fprintf( errfile, __FILE__":SLOG_Irec_SetDestTaskLabel() - \n" "\t""the associated interval record is NOT of " " Message Record type, it has rectype = " fmt_rtype_t"\n", intvlrec->rectype ); fprintf( errfile, "\t""This function should NOT have been called\n" ); fflush( errfile ); return SLOG_FAIL; } SLOG_TaskID_Assign( &( intvlrec->destID ), node_id, cpu_id, thread_id ); intvlrec->bytesize += SLOG_typesz[ taskID_t ]; return SLOG_SUCCESS;}/*@C SLOG_Irec_SetAssocs - Set the association array of the interval record. Modified Input Variables :. intvlrec - pointer to the internal Interval record to be modified. Unmodified Input Variables :. slog - pointer to the SLOG_STREAM where the Record Definition Table is defined. . N_assocs - Number of elements in the association array. This number will be checked to determine if it coincides with what is in Record Definition Table. assocs - association array, array of file pointers to the associated interval records of the specified interval record. Modified Output Variables :. returned value - integer return status. Usage Notes on this subroutine : The subroutine appends the specified Internal Interval Record with the given association array. This subroutine is meant to be called once for each interval record written to the slogfile. Include File Needed : slog.h@*/int SLOG_Irec_SetAssocs( SLOG_intvlrec_t *intvlrec, const SLOG_STREAM *slog, const SLOG_N_assocs_t N_assocs, const SLOG_assoc_t *assocs ){ SLOG_N_assocs_t recdefs_Nassocs; int sizeof_assocs; int ii; if ( intvlrec->bytesize == 0 ) { fprintf( errfile, __FILE__":SLOG_Irec_SetAssocs() - " "SLOG_Irec_SetMinRec() needs to be called first\n" ); fflush( errfile ); return SLOG_FAIL; } if ( ! SLOG_global_IsVarRec( intvlrec->rectype ) ) { recdefs_Nassocs = SLOG_RecDef_NumOfAssocs( slog->rec_defs, intvlrec->intvltype, intvlrec->bebits[0], intvlrec->bebits[1] ); if ( N_assocs != recdefs_Nassocs ) { fprintf( errfile, __FILE__":SLOG_Irec_SetAssocs() - " "Input Number of association does NOT match " "the entry in Record Definition Table\n" ); fprintf( errfile, " ""The Input Number of associations = " fmt_Nassocs_t"\n", N_assocs ); fprintf( errfile, " ""SLOG_RecDef_NumOfAssocs() returns " fmt_Nassocs_t"\n", recdefs_Nassocs ); fflush( errfile ); return SLOG_FAIL; } } /* Read in the MPI call's corresponding association list as determined by input intvltype */ intvlrec->N_assocs = N_assocs; sizeof_assocs = intvlrec->N_assocs * sizeof( SLOG_assoc_t ); if ( intvlrec->N_assocs > 0 ) { intvlrec->assocs = ( SLOG_assoc_t * ) malloc( sizeof_assocs ); if ( intvlrec->N_assocs > 0 && intvlrec->assocs == NULL ) { fprintf( errfile, __FILE__":SLOG_Irec_SetAssocs() - " "malloc() for intvlrec->assocs fails\n" ); fflush( errfile ); return SLOG_FAIL; } for ( ii = 0; ii < N_assocs; ii++ ) intvlrec->assocs[ ii ] = assocs[ ii ]; intvlrec->bytesize += sizeof_assocs; } return SLOG_SUCCESS;}/*@C SLOG_Irec_SetArgs - Set the argument part of the interval record. Modified Input Variables :. intvlrec - pointer to the internal interval record to be modified. Unmodified Input Variables :. slog - pointer to the SLOG_STREAM where the Record Definition Table is defined.. N_args - Number of elements in the argument array. This number will be checked to determine if it coincides with what is in Record Definition Table. args - argument array, array of arguments of the specified interval record. Modified Output Variables :. returned value - integer return status. Usage Notes on this subroutine : The subroutine appends the specified Internal Interval with argument array. For Fixed interval record, the subroutine is meant to called once for each specified interval record. For variable interval record, the subroutine can be called as many times as needed. Include File Needed : slog.h@*/int SLOG_Irec_SetArgs( SLOG_intvlrec_t *intvlrec, const SLOG_STREAM *slog, const SLOG_N_args_t N_args, const SLOG_arg_t *args ){ SLOG_vtrarg_t *vtr_args; SLOG_N_args_t recdefs_Nargs; if ( SLOG_Irec_IsEmpty( intvlrec ) ) { fprintf( errfile, __FILE__":SLOG_Irec_SetArgs() - " "SLOG_Irec_SetMinRec() needs to be called first\n" ); fflush( errfile ); return SLOG_FAIL; } if ( ! SLOG_global_IsVarRec( intvlrec->rectype ) ) { recdefs_Nargs = SLOG_RecDef_NumOfArgs( slog->rec_defs, intvlrec->intvltype, intvlrec->bebits[0], intvlrec->bebits[1] ); if ( N_args != recdefs_Nargs ) { fprintf( errfile, __FILE__":SLOG_Irec_SetArgs() - " "Input Number of arguments does NOT match " "the entry in Record Definition Table\n" ); fprintf( errfile, " ""The Input Number of arguments = " fmt_Nargs_t"\n", N_args ); fprintf( errfile, " ""SLOG_RecDef_NumOfArgs() returns " fmt_Nargs_t"\n", recdefs_Nargs ); fflush( errfile ); return SLOG_FAIL; } } vtr_args = SLOG_Varg_Create( N_args, args ); if ( SLOG_Irec_AddVtrArgs( intvlrec, vtr_args ) != SLOG_SUCCESS ) { fprintf( errfile, __FILE__":SLOG_Irec_SetArgs() - " "SLOG_Irec_AddVtrArgs() fails\n" ); fflush( errfile ); return SLOG_FAIL; } if ( SLOG_global_IsVarRec( intvlrec->rectype ) ) intvlrec->bytesize += sizeof( SLOG_N_args_t ); intvlrec->bytesize += N_args * sizeof( SLOG_arg_t ); return SLOG_SUCCESS;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -