Name
TAU_REGISTER_FORK — Informs the measurement system that a fork has taken place
Synopsis
C/C++:
TAU_REGISTER_FORK( |
pid, | |
option);
|
| int | pid; |
| enum TauFork_t | option; |
Description
To register a child process obtained from the fork()
syscall, invoke the TAU_REGISTER_FORK macro. It takes
two parameters, the first is the node id of the child process (typically
the process id returned by the fork call or any 0..N-1 range integer).
The second parameter specifies whether the performance data for the
child process should be derived from the parent at the time of fork
( TAU_INCLUDE_PARENT_DATA ) or should be independent of
its parent at the time of fork
( TAU_EXCLUDE_PARENT_DATA ). If the process id is used as
the node id, before any analysis is done, all profile files should be
converted to contiguous node numbers (from 0..N-1). It is highly
recommended to use flat contiguous node numbers in this call for
profiling and tracing.
Example
C/C++ :
pID = fork();
if (pID == 0) {
printf("Parent : pid returned %d\n", pID)
} else {
// If we'd used the TAU_INCLUDE_PARENT_DATA, we get
// the performance data from the parent in this process
// as well.
TAU_REGISTER_FORK(pID, TAU_EXCLUDE_PARENT_DATA);
printf("Child : pid = %d", pID);
}