debugDDe (1158408), страница 7
Текст из файла (страница 7)
<SL | PL | TR> <M> (<P>) [<R>] {<FILE>, <LINE>}= <NONE | MINIMAL | MODIFY | FULL>, (<I0>:<L0>, <R0>, <S0>), (<I1>:<L1>, <R1>, <S1>), …
EL: <M>
END_HEADER
# End trace header
The MODE line specifies the trace level and a mode of empty iterations accumulation. All other records specify the parameters for the each structure and have the same format as records of the trace configuration file.
The following trace information is accumulated during execution result tracing:
-
The values of all read variables:
RD: [<variable type>] <variable name> = <value>; {<file name>, <line number>}
-
Expression calculation beginning:
BW: [<variable type>] <variable name>; {<file name>, <line number>}
-
The values of all variables assigned in:
AW: [<variable type>] <variable name> = <value>; {<file name>, <line number>}
-
The values of all read reduction variables:
RV_RD: [<variable type>] <variable name> = <value>; {<file name>, <line number>}
-
Beginning of expression calculation of a reduction variable:
RV_BW: [<variable type>] <variable name>; {<file name>, <line number>}
-
The values of all reduction variables assigned in:
RV_AW: [<variable type>] <variable name> = <value>; {<file name>, <line number>}
-
result of reduction operation:
RV: [<variable type>] <value>; {<file name>, <line number>}
-
Completion of self-execution block in he sequential part of a program:
SKP: {<file name>, <line number>}
-
Parallel loop beginning:
PL: <structure number> (<parent structure number>) [<structure rank>] ; {<file name>, <line number>}
-
Sequential loop beginning:
SL: <structure number> (<parent structure number>) [<structure rank>] ; {<file name>, <line number>}
-
Task region beginning:
TR: <structure number> (<parent structure number>) [<region rank (always equals one)>] ; {<file name>, <line number>}
-
Iteration beginning:
IT: <absolute iteration index (calculated from all values of all iteration variables)>, (<iteration variable value>,<iteration variable value>,…).
-
End of loop or task region execution:
EL: <structure number>; {<file name>, <line number>}
6.5Realization of comparing execution results
6.5.1Base structures of comparing execution results module
The structure of tracing is divided into two parts. The first part represents a hierarchy exposition of program structures. It maps an enclosure of structures, parameters of trace gathering for the each structure and other information. The structures hierarchy and their parameters are read from the trace configuration file when tracing is initialized. If the given file is not specified or its structure is broken, the structure description hierarchy is formed during trace gathering. Note that in the trace-comparing mode, the given file is not read and the structure parameters are taken from the standard trace file.
The array of trace records represents the second part of tracing. This array uses TABLE structure. During trace accumulation, the coherence of trace records and structure hierarchy is supported. When a new event of structure beginning occurs, the pointer to the corresponding structure description is stored with the new trace record. If the structure description is absent, a new structure description with defaults is dynamically created.
The each trace record of the structure beginning keeps trace record numbers of the all iteration or tasks of the structure. The hash-table is used for keeping these numbers.
Figure 4. Trace structure
The subsystem of comparing execution results consists of the following base modules: trace reading module, trace writing module, trace accumulation module, trace comparing module, and reduction processing module. Each of this modules is accessing dependently on parameters and modes of comparing execution results subsystem.
The trace accumulation functions forms records in the trace array. If the mode of direct writing to a file is specified then trace records aren’t created in the memory and are written to a trace-file right away by using trace writing module. In the trace comparing mode the trace reading module uses trace accumulation functions for forming trace in the memory.
The structures of comparing execution results subsystem are shown below.
Program structure description:
| typedef struct tag_STRUCT_INFO | ||||
| { | ||||
| long | No; | |||
| char | File[MaxSourceFile]; | |||
| unsigned long | Line; | |||
| enum_TraceLevel | TraceLevel; | |||
| enum_TraceLevel | RealLevel; | |||
| byte | bSkipExecution; | |||
| s_COLLECTION | cChildren; | |||
| byte | Type; | |||
| byte | Rank; | |||
| s_REGULARSET | Limit[MAXARRAYDIM]; | |||
| s_REGULARSET | Current[MAXARRAYDIM]; | |||
| s_REGULARSET | Common[MAXARRAYDIM]; | |||
| long | CurIter[MAXARRAYDIM]; | |||
| struct tag_ STRUCT _INFO* | pParent; | |||
| unsigned long | Bytes; | |||
| unsigned long | StrCount; | |||
| unsigned long | Iters; | |||
| } | STRUCT_INFO; | |||
| No | – | unique structure number; | ||
| File | – | the file name where the program structure is located | ||
| Line | – | line number of beginning the structure | ||
| TraceLevel | – | the trace level of the structure (full, only variable modifications, minimal or disabled) | ||
| RealLevel | – | the trace level that is actually used for the structure | ||
| bSkipExecution | – | this flag determines the tracing mode of the structure dependently on traced iteration range of parent structure | ||
| cChildren | – | the collection of descriptions of inner structures | ||
| Type | – | structure type (parallel or sequential loop, task region); | ||
| Rank | – | structure rank (defines the rank of parallel loop) | ||
| Limit | – | iteration limitations of structure tracing | ||
| Current | – | current ranges of structure iterations | ||
| Common | – | the most common limits of structure iterations | ||
| CurIter | – | the current values of iteration variables | ||
| pParent | – | refer to the parent structure description | ||
| Bytes | – | size of full trace of the structure | ||
| StrCount | – | the string count of trace of the structure | ||
| Iters | – | the number of executed structure iterations | ||
The following structures describe the records for different trace types.
The record type of completion self-calculation block in the sequential part of a program:
| typedef struct tag_SKIP | ||||
| { | ||||
| byte | RecordType; | |||
| char | File[MaxSourceFile]; | |||
| unsigned long | Line; | |||
| } | SKIP; | |||
| RecordType | – | record type | ||
| File | – | the source file name of DVM-program | ||
| Line | – | the line number of DVM-program | ||
The record type of program structure beginning:
| typedef struct tag_STRUCT_BEGIN | ||||
| { | ||||
| byte | RecordType; | |||
| char | File[MaxSourceFile]; | |||
| unsigned long | Line; | |||
| long | Parent; | |||
| long | LastRec; | |||
| struct tag_STRUCT_INFO * | pCnfgInfo; | |||
| HASH_TABLE | hIters; | |||
| } | STRUCT_BEGIN; | |||
| RecordType | – | record type | ||
| File | – | the source file name of DVM-program | ||
| Line | – | the line number of DVM-program | ||
| Parent | – | the number of parental trace record | ||
| LastRec | – | the number of trace record of the structure completion | ||
| pCnfgInfo | – | pointer to the structure description | ||
| hIters | – | hash-table that keeps numbers of records of iteration beginning | ||
The record type of program structure completion:
| typedef struct tag_STRUCT_END | ||||
| { | ||||
| byte | RecordType; | |||
| char | File[MaxSourceFile]; | |||
| unsigned long | Line; | |||
| long | Parent; | |||
| struct tag_STRUCT_INFO* | pCnfgInfo; | |||
| } | STRUCT_END; | |||
| RecordType | – | record type | ||
| File | – | the source file name of DVM-program | ||
| Line | – | the line number of DVM-program | ||
| Parent | – | the number of parental trace record | ||
| pCnfgInfo | – | pointer to the structure description | ||
The record type of loop iteration or parallel task beginning:
| typedef struct tag_ITERATION | ||||
| { | ||||
| byte | RecordType; | |||
| long | Index[MAXARRAYDIM]; | |||
| long | LI; | |||
| char | Checked; | |||
| long | Parent; | |||
| byte | Rank; | |||
| } | ITERATION; | |||
| RecordType | – | 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 parental trace record | ||
| Rank | – | iteration rank. It is equal to owner structure rank. | ||
The record type of variable accessing or reduction results:
| 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 | – | the source file name of DVM-program | ||
| Line | – | the line number of DVM-program | ||
| 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 | cStructs; | |||
| TABLE | tBegStructs; | |||
| long | CurIter; | |||
| long | CurStruct; | |||
| long | CurTraceRecord; | |||
| long | CurPreWriteRecord; | |||
| byte | IterFlash; | |||
| byte | ReductExprType; | |||
| STRUCT_INFO* | pCurCnfgInfo; | |||
| int | ErrCode; | |||
| int | Level; | |||
| unsigned long | Bytes; | |||
| unsigned long | StrCount; | |||
| unsigned long | Iters; | |||
| FILE * | TrcFileHandle; | |||
| unsigned long | TraceRecordBase; | |||
| unsigned | FloatPrecision; | |||
| } | TRACE; | |||
| tTrace | – | table of trace records | ||
| cStructs | – | a set of the of root structure descriptions | ||
| tBegStructs | – | the table that contains trace numbers of all loop beginning records | ||
| CurIter | – | the trace number of current executed iteration | ||
| CurStruct | – | the trace number of current executed structure | ||
| CurTraceRecord | – | the trace number of current processed trace record | ||
| CurPreWriteRecord | – | the trace number of beginning current executed term | ||
| IterFlash | – | the postponed iteration recording flag | ||
| ReductExprType | – | the type of reduction variable accessing. | ||
| pCurCnfgInfo | – | pointer to the current structure description | ||
| ErrCode | – | the code of the last detected error | ||
| Level | – | trace level of the program | ||
| Bytes | – | size of the full trace of the sequential program part | ||
| StrCount | – | the string count of trace of the sequential program part | ||
| Iters | – | the summary number of all executed loop iterations and parallel tasks. It is used for calculating memory volume. | ||
| TrcFileHandle | – | the trace file handle | ||
| TraceRecordBase | – | the line number of the trace file from which the trace records are written. This field is used for diagnostic messages | ||
| FloatPrecision | – | the number of digits after the decimal point. This field is calculated from the TraceOptions.Exp parameter | ||
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) |
The function initializes the 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 trace configuration file and parameters of program structures.
| void cmptrace_ReInit(void) |
The function prepares 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 trace configuration file according to the current trace mode.
| void cmptrace_Write(void) |
The function forms the standard trace file or trace configuration file according to the current trace mode.















