DEB_DD (1158343), страница 7
Текст из файла (страница 7)
unsigned long Line;
long Parent;
struct tag_LOOP_INFO* LoopInfo;
}
LOOP_END;
RecordType – trace record type.
File – file name.
Line – line number.
Parent – trace record number of parental loop.
LoopInfo – pointer to the loop description structure.
The following record describes the iteration beginning:
typedef struct tag_ITERATION
{
byte RecordType;
long Index[MAXARRAYDIM];
long LI;
char Checked;
long Parent;
byte Rank;
}
ITERATION;
RecordType – trace record type.
Index – values of iteration variables.
LI – absolute iteration index.
Checked – it is equal to one if the iteration has been performed. This flag is used to check repeated execution of iterations.
Parent – the number of trace record of beginning of the loop, to which the iteration belongs.
Rank – iteration (loop) rank.
The following record describes the variable reading, writing, or reduction calculation result:
typedef struct tag_VARIABLE
{
byte RecordType;
long vType;
char Operand[MaxOperand];
char File[MaxSourceFile];
unsigned long Line;
byte Reduct;
VALUE val;
}
VARIABLE;
RecordType – record type.
vType – variable type. The program tracing supports the following four types: int, long, float and double.
Operand – variable name.
File – file name.
Line – line number.
Reduct – it is equal to 1, if the reduction variable is used.
val – variable value.
The TRACE type describes common trace structure. The system contains only one global variable Trace of this type.
typedef struct tag_TRACE
{
TABLE tTrace;
s_COLLECTION cLoops;
TABLE tBegLoops;
long CurIter;
long CurLoop;
long CurTraceRecord;
long CurPreWriteRecord;
byte IterFlash;
LOOP_INFO* pCurLoopInfo;
int ErrCode;
int Level;
unsigned long Bytes;
unsigned long StrCount;
FILE * TrcFileHandle;
}
TRACE;
tTrace – table of trace records.
cLoops – a set of the of root loop descriptions.
tBegLoops – the table that contains trace numbers of all loop beginning records.
CurIter – the trace number of current executed iteration.
CurLoop – the trace number of current executed loop.
CurTraceRecord – the trace number of current processed trace record.
CurPreWriteRecord – the trace number of beginning current executed term.
IterFlash – the postponed iteration recording flag.
pCurLoopInfo – pointer to the current loop description structure.
ErrCode – the code of the last detected error.
Level – trace level.
Bytes – size of the full trace of the sequential program part.
StrCount – the string count of trace of the sequential program part.
The following functions are intended for work with “comparing execution results” module. These functions use functions of trace writing, reading, accumulation and comparing modules dependently from the current assigned parameters and current trace mode.
void cmptrace_Init(void);
Initialization of structures of comparing execution results module. If the trace comparing mode is selected then the function reads standard trace file and loads it into the memory. If the trace-accumulation mode is selected then the function reads loop description file and loop parameters.
void cmptrace_ReInit(void);
Preparation internal structures to begin comparing execution trace with reference trace after reading standard trace from a file.
void cmptrace_Done(void);
The function uninitializes structures of comparing execution results module. It frees all allocated memory and forms standard trace file and loop description file if corresponding trace modes are turned on.
void cmptrace_Read(void);
The function reads the standard trace file or/and the loop description file according to the current trace mode.
void cmptrace_Write(void);
The function forms the standard trace file or loop description file according to the current trace mode.
The following functions call functions of the accumulation or comparing modules according to the current trace mode:
void cmptrace_BeginSeqLoop( char *File, unsigned long Line, long No );
File – file name.
Line – line number.
No – loop number.
The function generates a trace event of the sequential loop beginning.
void cmptrace_BeginParLoop( char *File, unsigned long Line, long No, byte Rank, long *Init, long *Last, long *Step );
File – file name.
Line – line number.
No – loop number.
Rank – loop rank.
Init – the array of initial values of iteration variables.
Last – the array of end values of iteration variables.
Step – the array of iteration variables steps.
The function generates a trace event of the parallel loop beginning.
void cmptrace_EndLoop( char *File, unsigned long Line, long No, unsigned long BegLine );
File – file name.
Line – line number.
No – loop number.
BegLine – number of the loop beginning line.
The function generates a trace event of the finishing of a parallel or sequential loop.
void cmptrace_NextLoop( AddrType *index );
index – array of pointers to loop iteration variables.
The function generates a trace event of the new iteration beginning.
void cmptrace_PreStoreVar( char *File, unsigned long Line, char *Operand, long Type, byte Reduct );
File – file name.
Line – line number.
Operand – variable name.
Type – variable type.
Reduct – reduction variable flag. It is equal to 1 if a reduction variable is used.
The function enervates a trace event of the beginning of an expression calculation.
void cmptrace_PostStoreVar( char *File, unsigned long Line, char *Operand, long Type, void *Value, byte Reduct );
File – file name.
Line – line number.
Operand – variable name.
Type – variable type.
Value – variable address.
Reduct – reduction variable flag. It is equal to one if a reduction variable is used.
The function generates a trace event of the finishing of an expression calculation and storing the expression result into a variable.
void cmptrace_LoadVar( char *File, unsigned long Line, char *Operand, long Type, void *Value, byte Reduct );
File – file name.
Line – line number.
Operand – variable name.
Type – variable type.
Value – variable address.
Reduct – reduction variable flag. It is equal to one if a reduction variable is used.
The function generates a trace event of the reading from a variable.
void cmptrace_ReductVar( char *File, unsigned long Line, long Type, void *Value, byte Wait );
File – file name.
Line – line number.
Operand – variable name.
Type – variable type.
Value – variable address.
Wait – wait reduction flag. It is equal to one if reduction result will be stored in the trace only after a current loop finishing.
The function generates a trace event of the completion reduction calculation.
void cmptrace_SkipBlock( char *File, unsigned long Line );
File – file name.
Line – line number.
The function generates a trace event of possible skip of group of statements in a sequential branch of the program after checking a membership of an array element to the current processor.
LOOP_INFO * trc_InfoNew(LOOP_INFO* pParent);
pParent – pointer to the parent loop description structure.
Allocation and initialization of a new loop description structure. The function returns a pointer to the new structure.
void trc_InfoDone( LOOP_INFO * pInfo);
pInfo – pointer to the loop description structure.
Destructor of the loop description structure.
int trc_InfoCanTrace(LOOP_INFO * pInfo, int nRecType);
pInfo – pointer to the loop description structure.
nRecType – type of the trace event.
The function checks the loop trace level and entrance of the current loop iteration in a range of traced iterations. It returns a value greater zero if the specified trace event can be traced.
void trc_InfoSetup(LOOP_INFO* pInfo, long *Init, long *Last, long *Step);
pInfo – pointer to the loop description structure.
Init – the array of initial values of iteration variables.
Last – the array of end values of iteration variables.
Step – the array of iteration variables steps.
Preparation of the loop description structure to beginning of the loop execution.
LOOP_INFO *trc_InfoFindForCurrentLevel(long No, byte IsPar, byte Rank, char *File, unsigned long Line);
No – loop number.
IsPar –loop flag. Equal one if the loop is a parallel.
Rank – loop rang.
File – file name.
Line – line number.
The function searches a loop description structure in the current level by the specified parameters.
LOOP_INFO *trc_InfoFindByNo(long No, s_COLLECTION *pColl);
No – loop number.
pColl – collection of loop description structures.
The function recursively searches a loop description structure by the loop number.
4.3.Trace processing modules
The comparing execution results system contains the following base sub-modules: the trace reading module, the trace writing module, the trace accumulation module, the trace comparing module and the module of the reduction processing. These modules are called according to a current trace mode.
4.3.1.Trace writing module
void trc_wrt_headloop( s_COLLECTION *Loops, int Level, FILE *hf, nWriteInfo );
Loops –a set of loop description structures of the first level.
Level – current processed level. This parameter is used for the recursive calls.
hf – opened file handle.
nWriteInfo – it is equal to 1, if an additional trace information should be written in to the loop description file.
The function forms the loop description file. It recursively calls itself with Level+1 and set of sub-loops of each loop from the Loop.
void trc_wrt_trace( FILE *hf );
hf – open file handle.
The function forms standard trace file.
size_t trc_wrt_beginloop( FILE *hf, LOOP_BEGIN *loop );
hf – open file handle.
loop – pointer to the trace record of the loop beginning.
The function writes the record of loop beginning into the standard trace file. It returns the size of the written record in bytes.
size_t trc_wrt_endloop( FILE *hf, LOOP_END *loop );
hf – opened file handle.
loop – pointer to the trace record of the loop finishing.
The function writes the record of loop finishing into the standard trace file. It returns the size of the written record in bytes.
size_t trc_wrt_iter( FILE *hf, ITERATION *Iter );
hf – opened file handle.
Iter – pointer to the trace record of the iteration beginning.
The function writes the record of iteration beginning into the standard trace file. It returns the size of the written record in bytes.
size_t trc_wrt_readvar( FILE *hf, VARIABLE *Var );
hf – opened file handle.
Var – pointer to the trace record of the variable usage.
The function writes the record of variable reading into the standard trace file. It returns the size of the written record in bytes.
size_t trc_wrt_prewritevar( FILE *hf, VARIABLE *Var );
hf – opened file handle.
Var – pointer to the trace record of the variable usage.
The function writes the record of beginning expression calculation into the standard trace file and returns the size of the written record in bytes.
size_t trc_wrt_postwritevar( FILE *hf, VARIABLE *Var );
hf – opened file handle.
Var – pointer to the trace record of the variable usage.
The function writes the record of finishing expression calculation into the standard trace file and returns the size of the written record in bytes.
size_t trc_wrt_reductvar( FILE *hf, VARIABLE *Var );
hf – opened file handle.
Var – pointer to the trace record of the reduction result.
The function writes the record of completion reduction calculation into the standard trace file. The size of the written record in bytes is returned.
size_t trc_wrt_variable( FILE *hf, VARIABLE *Var, int iType );
hf – opened file handle.
Var – pointer to the trace record of the variable usage.
The common function of writing a variable usage record into the standard trace file. The size of the written record in bytes is returned.
size_t trc_wrt_skip( FILE *hf, SKIP *Skip );















