Well, nothing fancy here. Just open a DLL/package source (.dpr/.dpk), instrument it and compile it. Profiling will start on DLL/package load and stop on DLL/package unload. If you don't like that behaviour, disable Start profiling on target startup setting and use GpProfile API to start/stop profiling.