rtsDDe (1158446), страница 3
Текст из файла (страница 3)
| MesPtr | | the pointer to sent message or the pointer to the memory area, the message will be written to. |
| Count | | a number of elements in the message. |
| Size | | message element size in bytes. |
| SenderProcNum | | internal number of sending processor. |
| *PSRefPtr | | reference to the processor system, which processors the message is sent to. |
The function sends the message, if internal number of the current processor is equal to SenderProcNum and receives the message otherwise.
All processors of the system, specified by PSRefPtr parameter, must belong to the current processor system. NULL value of PSRefPtr pointer or zero value of *PSRefPtr reference specify the current processor system.
The processor with SenderProcNum number may not belong to the processor system, specified by *PSRefPtr reference, but must belong to the current processor system.
6Synchronization of the programs, executed at different processors
long bsynch_(void);
The function execution consists in the following: the central processor (see section 4) receives synchromessages from all other processors, and then sends synchromessages-answers to the processors. Any of the processors sends synchromessage to the central processor, and then receives synchromessage-answer from the central processor. The synchromessage is a word (integer), which content is irrelevant.
The function returns zero.
long tsynch_(void);
The function tsynch_, as well as the function bsynch_, performs barrier synchronization of the processors of the current processor system, but also aligns the time on all the processors. The time aligning means, that after execution by Run-Time System some actions the function dvm_time (see section 3) will be return identical time at all the processors at every astronomical time moment. This time is equal to the time, returned by the function dvm_time at the central processor before the function tsynch_ execution.
The time aligning is implemented in the following way. Let the central processor at the time moment t1 (according to its own clock) sends a message to processor P, being in state of receiving this message. The processor P after receiving the message from the central processor sends to the central processor the message receiving time T (according to its own clock). The central processor after sending the message to processor P waits for the message, containing time T, from the processor, and receives it at time moment t2 according to its own clock. Then the central processor sends time (t1+t2)/2 T to the processor P. This time will be always added to the time of its clock when the function dvm_time will be executed.
The central processor performed this operation with all other processors. To avoid accidental hindrances time aligning operation is repeated several times and for every processor the value of (t1+t2)/2 T, for which message passing time (t1-t2)/2 is minimal, is set as result.
The function returns zero.
7Tracing user program and Run-Time System
7.1General information about trace accumulation
Let an internal event (or event) be execution of some point or part of user program or Run-Time System under certain conditions. A system trace is accumulation of information about occurring events in their time sequence.
All calls of Run-Time System functions, accessible for users, are events. Moreover, passing through some internal parts of Run-Time System and calls of some its internal functions are also events. The examples of traced internal functions are the functions of access to communication libraries. Tracing function call caused tracing function return.
The full list of trace events is contained in the file events.def of source texts of Run-Time System. In this file a certain number is corresponded to a name of each event. The function call event has name call_<function name>, and function return event has the name ret_<function name>.
Tracing each event may be enabled or disabled by its number.
Accumulated trace information contains also all informational messages of Run-Time System and all messages about errors, detected by it (see section 8).
Run-Time System accumulates trace information, using the functions, considered in section . Each of these functions outputs information in text mode to three independently opened and closed trace streams:
-
stream of Run-Time System information messages (tracing to the “screen”, usually it is stdout stream);
-
memory buffer;
-
file.
Tracing in informational message stream is implemented according to the general rules of the control of information message output (see section 8). Information, sent to this stream, does not contain Run-Time System informational messages and error messages.
When tracing in memory buffer the information is accumulated in a buffer of each processor up to the program completion, and then is uploaded in a file (own for each processor). Trace buffers are initialized when Run-Time System is initialized.
Two ways of tracing in a buffer are possible. In the first way the buffer overflow caused stop of tracing (the way of keeping trace beginning). In the second way last information is kept because of deleting most old information (way of “circle” tracing).
Trace in file is implemented by output of the receiving information directly in the file, own for each processor. The files for direct output of trace are opened when Run-Time System is initialized and are closed when the program is terminated.
Run-Time System places in one directory all files with accumulated trace (as files when tracing in the buffer, as files when tracing directly in files). The directory name and file extensions for each stream are specified in parameter file systrace.* (see section 8). The names of trace files have the form <internal processor number>_<external processor number>.
A structure of accumulated information is determined by trace mode. In brief mode the following information is output:
-
event name;
-
time, passed from previous event;
-
file name of the user program and line number in the file specifying a point of event occurred in the program.
In verbose trace mode accumulated information is extended and depends on event type. If the event is a function call, then its input parameters are output. When exiting the function its result parameters are output. The verbs trace mode may be specified for each event independently on common mode.
Note. System trace is functioned only if Is_DVM_TRACE parameter kept in systrace.* files, is not equal to zero (see section 7.2.1). Nevertheless some of the functions are not traced. Such functions are the functions, requiring high execution efficiency because of supposed frequent function invoking (for example, it is the tstelm_ function of checking whether specified element of distributed array belongs to its local part or not). The functions of such kind will be traced if parameter Is_ALL_TRACE (systrace.* files) is not equal to zero. Moreover to trace functions invoking DVM-debugger Is_DEB_TRACE parameter must have non-zero value and to trace functions invoking information accumulation system for performance analysis Is_STAT_TRACE parameter must have non-zero value (see section 7.2.1).
7.2Controlling trace accumulation by parameter files
Controlling trace modes and a set of traced events is implemented by parameters, contained in the files systrace.* and trcevent.*. Let us consider the main of them. By default, it is assumed, that a parameter is in the files systrace.*.
7.2.1Trace enabling and disabling
-
Is_DVM_TRACE non-zero value of the parameter is the common flag of enabled tracing.
-
Is_ALL_TRACE flag to trace all Run-Time System functions (except the functions invoking DVM-debugger and statistics accumulation system).
-
Is_DEB_TRACE flag to trace the functions invoking DVM-debugger.
-
Is_STAT_TRACE flag to trace the functions invoking information accumulation system for performance analyzer.
-
TraceProcList list of internal numbers of the processors with enabled tracing. When flag of common trace is on, tracing is performed only on the processors from the list. At the main processor (see section 4) the trace information is always accumulated independently of a presence of its (zero) number in TraceProcList list. A mark of TraceProcList list end is -1.
-
IsTraceProcList flag of enabled TraceProcList list. If the parameter has zero value the trace is accumulated at all the processors.
-
IsEvent[<event number>] this parameter with value, equal to1 or 2, is the flag enabled tracing of event with the number <event number>. The value 2 specifies tracing of given event in verbose mode independently from common mode of verbose tracing. Zero value of the parameter disables specified event tracing. The parameter is in the files trcevent.*. Стандартно (т. е. в базовых наборах параметров) трассировка всех событий включена, а трассировка событий с номерами 0, 1, 2 и 3 включена в расширенном режиме.
-
DisableTraceEvents список номеров событий (через запятую), трассировка которых выключена. Список DisableTraceEvents отменяет трассировку заданных в нём событий, включённую ранее параметром IsEvent. Признаком конца списка DisableTraceEvents является номер события, равный -1. Отмена трассировки событий с номерами 0, 1, 2 и 3 не допускается.
-
IsDisableTraceEvents признак включённого списка DisableTraceEvents. При нулевом значении этого параметра отмена трассировки событий не производится.
-
BlockTrace flag of postponed trace enabling. When common tracing is enabled the accumulation is started only by special instruction from the function void tron(void). Enabled tracing can be disabled by the function void troff(void) (and then can be again enabled and so on).
7.2.2Specifying opened (enabled) trace streams
-
TracePath name of directory for trace files (as files when tracing in the buffer, as files when tracing directly in files). If directory name is not empty, the last symbol of the name must be "\" or "/".
-
ScreenTrace if the parameter is not equal to zero, the trace is output to information message stream (flag to output trace to the "screen"). Trace, outputted to informational message stream, doesn’t contain informational messages and messages about errors of Run-Time System.
-
BufferTrace flag of trace accumulation in the memory buffer.
-
TraceBufLength trace buffer size in bytes.
-
TraceBufferExt trace file extension when tracing in buffer.
-
FileTrace flag to accumulate trace directly in the files.
-
FatTraceNoOpen flag to complete work in the case of trace file opening failure for direct trace accumulation. If the parameter is equal to zero, warning is output in the case of the file opening failure.
-
TraceFileExt trace file extension when tracing directly in files.
7.2.3Trace mode specifying
-
DelSysTrace flag to delete "old" trace files (remained from previous startup) when initializing Run-Time System.
-
FullTrace common flag of verbose trace mode.
-
FullTraceEvents список номеров событий (через запятую), трассируемых в расширенном режиме (вне зависимости от общего признака расширенного режима трассироки, задаваемого параметром FullTrace). Признаком конца списка FullTraceEvents является номер события, равный -1. Список FullTraceEvents изменяет режим трассировки заданных в нём событий, но не включает ранее отменённую их трассировку.
-
IsFullTraceEvents признак включённого списка FullTraceEvents. При нулевом значении этого параметра изменение режима трассировки событий, заданных в списке FullTraceEvents, не производится.
-
MaxTraceLevel common maximal traced function call enclosure. Zero value of the parameter means to trace the functions, directly called by the user program.
-
MaxEventLevel[<event number>] maximal traced function call enclosure for the event with the number <event number>. This parameter has priority under the parameter MaxTraceLevel. The parameter is in files trcevent.*.
-
FullBufferStop flag to stop tracing if buffer is overflowed. If the parameter is equal to zero, then last information is written in place of most old information when the buffer is overflowed.
-
BufferTraceUnLoad – flag to upload trace, accumulated in trace buffers, into the files before program termination. If flag is equal to 0, Run-Time System does not upload trace, accumulated in trace buffers, into the files, entrusting this work to the dump-program, started if it is required.
-
LowDumpLevel – flag to upload trace, accumulated in the buffers, into the files, using low-level input/output functions. Uploading trace buffers by high-level input/output functions is performed more slowly.
-
SetTraceBuf flag to trace directly into the files with buffering performed by operation system. Trace mode with buffering is set at once after opening trace stream by the function setbuf.
-
TraceFlush flag to upload trace information from operation system buffer into the file after each event (when tracing directly into the files). The mode, specified by this parameter, is active only in the case of tracing with buffering (the parameter SetTraceBuf is not equal to 0). TraceFlush parameter can have two non-zero values: 1 and 2. In the first case the trace is uploaded by fflush function. In the second case additionally trace file is closed and then opened in write mode to add information to the file end.
-
DisableTraceTime – flag to subtract the execution time of trace programs from time interval between the events, which are output to the trace.
7.2.4Controlling form of accumulated information
-
KeyWordName flag to precede the name of each event by “NAME=”.
-
PreUnderLine flag to underline heading of each event (event heading is a trace line, containing event name, time, file name and line number).
-
PreUnderLining underlining line of heading of each event.
-
PostUnderLine flag to underline end line of output information of each event.
-
PostUnderLining underlining string of the end line of information of each event.
-
BufferTraceShift coefficient of indentation of output information when tracing in buffer. The number of blanks, equal to product of this parameter by the current function call enclosure will be inserted before each output line.
-
FileTraceShift coefficient of indentation of output information when tracing directly into the files.
-
TimePrecision – a number of digits after dot when printing time, passed from the previous event.
7.2.5Controlling internal self-checking Run-Time System mechanisms, functioning during trace accumulation
In the process of trace information accumulation Run-Time System can check certain memory areas terminates the program in the case of such area modification and outputs corresponding error message. Such areas are:
-
left (low) and right (high) control parts of each dynamically allocated memory block;
-
memory areas explicitly specified by their initial and end addresses in parameter files systrace.*;
-
memory area, containing program code of a user program and Run-Time System (command memory).
The control parts of dynamically allocated memory blocks are created by special instruction in parameter files sysdebug.* and are filled by the code, also specified in the files. Their contents can be checked on each memory allocation and freeing, and also in the process of tracing.
Explicitly specified memory area is checked by comparison its reference checksum with the current one. The reference checksum is calculated when Run-Time System is initialized.















