You can obtain a lot of information about a program by calling it under
strace. This shows every system call that the program makes, which can be too much information sometimes, but can be a big help to find what's going wrong.
Approach one is to run your big application under
strace. This is likely to produce a lot of output and slow your application down.
strace -s9999 -efile,process -f -o bigapp.strace bigapp
If the big application is interactive, you may prefer to start it, and connect strace to it once you're ready to trigger the calculations. Note the application's process ID, say 12345, and run
strace -s9999 -efile,process -f -o bigapp-calculations.strace -p12345
If it's enough to observe that external executable, then as
other answers have already suggested, replace that executable by a wrapper script. You can move the executable to a different name and put the wrapper script in its place, or put the wrapper script ahead of the usual executable in the
PATH, or configure the application to call your wrapper script instead of the usual executable, whatever is convenient. Make that wrapper script
exec strace -s9999 -efile -o auxapp-$$.strace /path/to/original/executable "$@"
Explanation of the strace parameters used:
-e selects the system calls to trace. You can specify system calls by name or use a few categories such as
write, …) and
-f makes strace follows forks, i.e. trace subprocesses as well as the original process.
-o selects the name of the file containing the trace.
$$ is a shell construct that stands for the process ID of the shell process (due to the use of
exec in the last wrapper script, that will also be the auxiliary application's process ID).
-s9999 makes it display that many bytes for
write and other calls.