Initialize and Finalize

The application has to bootstrap the communication between the VTserver and its clients. This is done as follows:

  1. The application server initiates its processes.

  2. Each process calls VT_clientinit().

  3. VT_clientinit() allocates a port for TCP/IP communication with the VTserver or other clients and generates a string which identifies the machine and this port.

  4. Each process gets its own string as result of VT_clientinit().

  5. The application collects these strings in one place and calls VTserver with all strings as soon as all clients are ready. VT configuration is given to the VTserver as file or through command line options.

  6. Each process calls VT_initialize() to actually establish communication.

  7. The VTserver establishes communication with the processes, then waits for them to finalize the trace data collection.

  8. Trace data collection is finalized when all processes have called VT_finalize().

  9. Once the VTserver has written the trace file, it quits with a return code indicating success or failure.

Some of the VT API calls may block, especially VT_initialize(). Execute them in a separate thread if the process wants to continue. These pending calls can be aborted with VT_abort(), for example if another process failed to initialize trace data collection. This failure has to be communicated by the application itself and it also has to terminate the VTserver by sending it a kill signal, because it cannot be guaranteed that all processes and the VTserver will detect all failures that might prevent establishing the communication.

For more complete information about compiler optimizations, see our Optimization Notice.