You can specify a script as the target for the collect command. When the target is a script, collect by default collects data on the program that is launched to execute the script, and on all descendant processes.
To collect data only on a specific process, use the –F option to specify the name of the executable to follow.
For example, to profile the script start.sh, but collect data primarily from the executable myprogram, use the following command.
$ collect -F =myprogram start.sh
Data is collected on the founder process that is launched to execute the start.sh script, and on all myprogram processes that are spawned from the script, but not collected for other processes.