You can use the UFPWProfControl unit in your Free Pascal application to control FPWProf while the application is being profiled. At the moment the unit exposes the following procedures:
function FPWPCtlConnect: Boolean; procedure FPWPCtlDisconnect; procedure FPWPSendCommand(Cmd: UInt; WParam: WPARAM; LParam: LPARAM); procedure FPWPStartStop(StartStopCmd: Integer); procedure FPWPMarker(Name: string='');
The FPWPCtlConnect function will try to connect to FPWProf, returns false if fails. Note that any other call (except FPWPCtlDisconnect) will automatically connect anyway so you do not need to call this directly.
FPWPCtlDisconnect will try to disconnect from FPWProf.
FPWPSendCommand will send a command to FPWProf.
FPWPStartStop will try to start, stop, pause or continue sampling based on the StartStopCmd parameter which can be one of CmdStartStop_Stop, CmdStartStop_Start, CmdStartStop_Pause and CmdStartStop_Continue.
FPWPMarker can be used to place a marker in the timeline. Note that this isn't exact - FPWProf communication is done through windows messages which introduce a few milliseconds of latency - this should only be used for coarse markers, e.g. application startup to first window or loading maps in games when they take a long time.