debugDDe (1158408), страница 9
Текст из файла (страница 9)
If the trace-comparing mode is specified then these functions are used by trace reading module for reading trace file and forming trace structure in the memory.
| void trc_put_beginstruct( char *File, unsigned long Line, long No, byte Type, byte Rank, long *Init, long *Last, long *Step ) | ||
| File | – | the source file name of DVM-program |
| Line | – | the line number of DVM-program |
| No | – | unique structure number |
| Type | – | structure type (parallel or sequential loop, task region) |
| Rank | – | structure 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 puts the record of the structure beginning into the trace table.
| void trc_put_endstruct(char *File, unsigned long Line, long No, unsigned long BegLine) | ||
| File | – | the source file name of DVM-program |
| Line | – | the line number of DVM-program |
| No | – | unique structure number |
| BegLine | – | line number of the structure beginning |
The function puts the record of the structure finishing into the trace table.
| void trc_put_iteration( AddrType *index ) | ||
| index | – | array of pointers to iteration variables |
The function puts the record of an iteration or task beginning into the trace table. If the mode of writing empty iterations is not specified then the record really will be put into the trace table only after beginning an inner structure or variable accessing inside this iteration.
| void trc_put_iteration_flash_par( byte Rank, long *Index, long LI ) | ||
| Rank | – | iteration rank. |
| Index | – | array of pointers to iteration variables |
| LI | – | absolute iteration index |
The function unconditionally puts the record of the iteration or task beginning into the trace table.
| void trc_put_iteration_flash(void) |
The function put the current postponed record of the iteration beginning into the trace table. This function is called from functions trc_put_beginstruct() and trc_put_variable()
| void trc_put_readvar( char *File, unsigned long Line, char *Operand, long Type, void *Value, byte Reduct ) | ||
| File | – | the source file name of DVM-program |
| Line | – | the line number of DVM-program |
| Operand | – | variable name |
| Type | – | variable type |
| Value | – | variable address |
| Reduct | – | reduction variable flag. It is equal to 1 if a reduction variable is used |
The function puts the record of the variable reading into the trace table.
| void trc_put_prewritevar( char *File, unsigned long Line, char *Operand, long Type, byte Reduct ) | ||
| File | – | the source file name of DVM-program |
| Line | – | the line number of DVM-program |
| Operand | – | variable name |
| Type | – | variable type |
| Reduct | – | reduction variable flag. It is equal to 1 if a reduction variable is used |
The function puts the record of the beginning of an expression calculation into the trace table.
| void trc_put_postwritevar( char *File, unsigned long Line, char *Operand, long Type, void *Value, byte Reduct ) | ||
| File | – | the source file name of DVM-program |
| Line | – | the line number of DVM-program |
| Operand | – | variable name |
| Type | – | variable type |
| Value | – | variable address |
| Reduct | – | reduction variable flag. It is equal to 1 if a reduction variable is used |
The function puts the record of the completion of an expression calculation into the trace table.
| void trc_put_reductvar( char *File, unsigned long Line, long Type, void *Value ) | ||
| File | – | the source file name of DVM-program |
| Line | – | the line number of DVM-program |
| Operand | – | variable name |
| Type | – | variable type |
| Value | – | variable address |
The function puts the record of the completion a reduction calculation into the trace table.
| void trc_put_variable( char *File, unsigned long Line, char *Operand, byte iType, long Type, void *Value, byte Reduct ) | ||
| File | – | the source file name of DVM-program |
| Line | – | the line number of DVM-program |
| Operand | – | variable name |
| iType | – | trace record type |
| Type | – | variable type |
| Value | – | variable address |
| Reduct | – | reduction variable flag. It is equal to 1 if a reduction variable is used |
The common function of putting the record of the variable accesses into the trace table.
| void trc_put_skip( char *File, unsigned long Line ) | ||
| File | – | the source file name of DVM-program |
| Line | – | the line number of DVM-program |
The function puts the record of finishing self-calculation block in a sequential branch of the program.
6.5.4Trace reading module
The functions of trace reading module read trace records from the standard trace file and form corresponding records in the memory by using the trace accumulation functions (trc_put_*). This module also is used for reading trace configuration file.
The trace reading functions have the following prototypes:
| void trc_rd_header( DVMFILE *hf, char* szFileName ) | ||
| hf | – | opened file handle; |
| szFileName | – | file name that is used in the diagnostic messages. |
The function reads trace configuration file. It forms the hierarchy of program structures in the memory. The function returns number of read lines.
| void trc_rd_trace( DVMFILE *hf, char* szFileName, unsigned long StrBase ) | ||
| hf | – | opened file handle; |
| szFileName | – | file name that is used in the diagnostic messages. |
| StrBase | – | the line number that was read from this file. This parameter is used for diagnostic messages |
The function reads the standard trace file.
| unsigned long trc_rd_gets( DVMFILE *hf ) | ||
| hf | – | opened file handle; |
The function reads a next record from a file. This function skips all empty strings and removes comments. The number of read lines is returned.
| short trc_rd_search_key(char *str) | ||
| str | – | string with a keyword. |
The function finds matched key code that corresponds to a keyword. It returns -1 if key code is not found for the specified string.
| char* trc_rd_split( char *Str, char *Format, … ) | ||
| Str | – | the parsed string; |
| Format | – | the string format; |
| … | – | variable addresses that accepts parameters. |
The function parses string and gets parameters by specified format.
The following symbols can be used with the Format string:
-
& – a keyword. The parameter variable has short type.
-
% – an optional integer value. The parameter variable has long type.
-
! – a required integer value. The parameter variable has long type.
-
#<type> – required value of the specified type, where the type can be one of the following symbols:
-
i – int
-
l – long
-
f – float
-
d – double
-
@ – any string.
6.5.5Trace comparing module
The trace comparing functions compares trace events with standard trace records.
The trace comparing functions have the following prototypes:
| void trc_cmp_beginstruct( char *File, unsigned long Line, long No, byte Type, byte Rank, long *Init, long *Last, long *Step ) | ||
| File | – | the source file name of DVM-program |
| Line | – | the line number of DVM-program |
| No | – | unique structure number |
| Type | – | structure type (parallel or sequential loop, task region) |
| Rank | – | structure 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 compares the trace record of a program structure beginning with the corresponding standard trace record.
| void trc_cmp_endstruct(char *File, unsigned long Line, long No, unsigned long BegLine) | ||
| File | – | the source file name of DVM-program |
| Line | – | the line number of DVM-program |
| No | – | unique structure number |
| BegLine | – | line number of the structure beginning |
The function compares the trace record of a program structure completion with the corresponding standard trace record.
| void trc_cmp_iteration( AddrType *index ) | ||
| index | – | array of pointers to iteration variables |
The function compares the trace record of the iteration or task beginning with the corresponding standard trace record. If the mode of writing empty iterations is not selected then the record really will be compared only after beginning an inner structure or variable accessing inside this iteration.
| void trc_cmp_iteration_flash(void) |
The function compares the current postponed trace record of the iteration beginning with the corresponding standard trace record. This function is called from functions trc_cmp_beginstruct() and trc_cmp_variable ().
| void trc_cmp_readvar(char *File, unsigned long Line, long Type, void *Value, byte Reduct) | ||
| File | – | the source file name of DVM-program |
| Line | – | the line number of DVM-program |
| Operand | – | variable name |
| Type | – | variable type |
| Value | – | variable address |
| Reduct | – | reduction variable flag. It is equal to 1 if a reduction variable is used |
The function compares the trace record of a variable reading with the corresponding standard trace record.
| void trc_cmp_prewritevar( char *File, unsigned long Line, long Type, byte Reduct ) | ||
| File | – | the source file name of DVM-program |
| Line | – | the line number of DVM-program |
| Operand | – | variable name |
| Type | – | variable type |
| Reduct | – | reduction variable flag. It is equal to 1 if a reduction variable is used |
The function compares the trace record of a beginning expression calculation with the corresponding standard trace record.
| void trc_cmp_postwritevar( char *File, unsigned long Line, long Type, void *Value, byte Reduct ) | ||
| File | – | the source file name of DVM-program |
| Line | – | the line number of DVM-program |
| Operand | – | variable name |
| Type | – | variable type |
| Value | – | variable address |
| Reduct | – | reduction variable flag. It is equal to 1 if a reduction variable is used |
The function compares the trace record of a completion expression calculation with the corresponding standard trace record.
| void trc_cmp_reductvar( char *File, unsigned long Line, long Type, void *Value ) | ||
| File | – | the source file name of DVM-program |
| Line | – | the line number of DVM-program |
| Operand | – | variable name |
| Type | – | variable type |
| Value | – | variable address |
The function compares the trace record of a reduction result with the corresponding standard trace record.
| void trc_cmp_variable( char *File, unsigned long Line, enum_TraceType iType, long vType, void *Value, byte Reduct ) | ||
| File | – | the source file name of DVM-program |
| Line | – | the line number of DVM-program |
| Operand | – | variable name |
| iType | – | trace record type |
| Type | – | variable type |
| Value | – | variable address |
| Reduct | – | reduction variable flag. It is equal to 1 if a reduction variable is used |
The general function of the comparing variable usage trace record with the corresponding standard trace record.
| void trc_cmp_skip( char *File, unsigned long Line ) | ||
| File | – | the source file name of DVM-program |
| Line | – | the line number of DVM-program |
The function compares the trace record of finishing self-calculation block in a sequential branch of the program with the standard trace record. The function may skip several trace records if it is needed.
| long trc_cmp_forward(long CurTraceRecord, enum_TraceType iType) | ||
| CurTraceRecord | – | the number of the current trace record |
| iType | – | searched trace record type |
The function searches a nearest trace record with the specified type from the current trace record. It returns the number of a found trace record or –1 if the specified type is absent or records with ‘structure beginning’, ‘iteration beginning’ or ‘structure completion’ types are presented between the current and found trace records.
6.5.6Reduction processing module
The reduction-processing module uses its own variable-table. This variable-table contains entries of the following type that describe a reduction variable:
| typedef struct tag_REDUCT_INFO | ||||
| { | ||||
| char* | Current; | |||
| char* | Initial; | |||
| byte | StartReduct; | |||
| s_REDVAR* | RVar; | |||
| } | REDUCT_INFO; | |||
| Current | – | pointer to the buffer with a current calculated reduction result | ||
| Initial | – | pointer to the buffer with an initial value of the reduction variable | ||
| StartReduct | – | asynchronous reduction flag. It is equal to one if reduction calculation is started | ||
| RVar | – | pointer to an internal RTL-structure that describes the reduction variable | ||
The method of manual reduction calculation is used for validation of the specified reduction operation. This method is based on partial reduction result calculation after each performed loop iteration. The function diter_() calculates partial reduction result by applying the specified reduction operation and restores initial value reduction variable after each performed iteration or parallel task. The dendl_() function calculates the final reduction result after completion the parallel structure.















