Jump to content

Leaderboard


Popular Content

Showing content with the highest reputation on 04/26/20 in all areas

  1. Lars Fosdal

    Where did I come from

    I usually have a construct which I check in the event UI handlers. If I am writing changes to the UI, the event handler contains a busy check. type TGuard = record private FBusy: Integer; public procedure Enter; // Increments FBusy procedure Leave; // Decrements FBusy function Busy: Boolean; //True if FBusy > 0 function Idle: Boolean; // not Busy end; // In the form/frame type TMyForm = class(TForm) protected Update: TGuard; //... procedure TMyForm.UpdateUI; begin Update.Enter; try CheckBox1.Checked := TrueOrFalse; finally Update.Leave; end; end; procedure TMyForm.OnCheckBox1Clicked(sender: TObject); begin if Update.Busy then Exit; // do the event handling
  2. Attila Kovacs

    Profiler for Delphi

    As I could not find anything measuring the InitUnits, and it has its reasons, I come up with this poor mans profiler: Two breakpoints is System.pas, one on TProc(P)(); in "procedure InitUnits;" and the other on the very next asm line: Then right-clink on the red bullets, "Breakpoint properties" -> "Advanced" On the first one: (actually you don't need the "Log result" here) On the second: (I have attached the InitHelper.pas to this post.) And just run the app. It will take a time to finish, then you can save the Events and process/investigate the output. Of course, the measured times are higher because of the debugger, but it gives a very good orientation for finding bottlenecks. To check the unit, place a conditional breakpoint on "I" somewhere. InitHelper.pas
×