<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=utf-8"><meta name=Generator content="Microsoft Word 15 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:"Times New Roman",serif;
color:black;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
span.EmailStyle17
{mso-style-type:personal-reply;
font-family:"Calibri",sans-serif;
color:#1F497D;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body bgcolor=white lang=EN-US link=blue vlink=purple><div class=WordSection1><p class=MsoNormal><b><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'>Just a friendly suggestion… You are close to how I did it in Modern Pascal:<o:p></o:p></span></b></p><p class=MsoNormal><b><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'><o:p> </o:p></span></b></p><p class=MsoNormal><br>procedure Test;<br>begin<br> EnterProfiling('MyUnit.Test');<br> try<br> // <<< real code here<br> finally<br> LeaveProfiling('MyUnit.Test');<br> end;<br>end;<br><br><b><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'>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.</span></b><b><span style='font-size:11.0pt;font-family:"Calibri",sans-serif'><o:p></o:p></span></b></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'>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).<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'>Regards,<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'>Ozz<o:p></o:p></span></p></div></body></html>