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

_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel

Reply via email to