[fpc-devel] FPProfiler

Ozz Nixon ozznixon at gmail.com
Tue Feb 20 00:56:18 CET 2018


Just a friendly suggestion… You are close to how I did it in Modern Pascal:

 


procedure Test;
begin
  EnterProfiling('MyUnit.Test');
  try
    // <<< real code here
  finally
    LeaveProfiling('MyUnit.Test');
  end;
end;

In my profiler, I do not need a string for the Leaving Profiling, I use a Link-List Queue. My Enter Profiling Stores the procedure name, timestamp (nano) and when leaving, I track it in the Catcher app with elapsed time, etc. It uses a SQL Memory Dataset, allowing me to group etc. but, the primary point is optimizing the LeaveProfileing() to just a call.

 

Also, I do mine as {$IFDEF PROFILE_ON}EnterProfile(str); try{$ENDIF} {…original authors code…} {$IFDEF PROFILE_ON}Finally LeaveProfile; End;{$ENDIF}… this reduces an end to end code modification of my customers source. It’s a onetime modification, and I have checks to make sure nothing has been added w/o the wrapper… a simple sanity check. I would suggest incorporating this into FPC, like we have -Si, we could add –Sp, or since the S parameter is quite busy, putting into -P1 (Profiling Strategy 1).

 

Regards,

Ozz

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20180219/ef59a307/attachment.html>


More information about the fpc-devel mailing list