A couple of months back I was looking at the performance of a customer's application. The usual protocol for these kind of things is to figure out where the application actually gets launched and then insert a call to collect before this happens:
collect -F on <application> <params>
Of course this can sometimes be difficult to locate. An alternative is to use dbx and attach to the running process:
This requires less searching of startup scripts, but does require a bit of typing (and the application freezes, waiting, while you do it).
A while back a colleague suggested to me that it would be possible to script this. When I was working on spot, I wanted it to be able to attach to a running process and generate a profile, consequently I finally ended up writing the script. I'm very grateful to the Analyzer team because they took my script and implemented it in the product in Sun Studio 11:
collect -P <pid>
Coming back to the customer's application, the first profiles I got were using this relatively painless method.