How to benchmark TChart recalc / redraw times?

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
FOCUS electronics
Newbie
Newbie
Posts: 3
Joined: Wed Apr 14, 2021 12:00 am

How to benchmark TChart recalc / redraw times?

Post by FOCUS electronics » Fri Apr 23, 2021 10:36 am

Hello all,

I'd like to benchmark the times required for adding points to a TLineSeries and the actual time consumed during redraw. If I understand correctly, the redrawing is performed in next call to message loop.

Is there an example how to benchmark the redraw performance?

Best regards,
Focus

Yeray
Site Admin
Site Admin
Posts: 9613
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: How to benchmark TChart recalc / redraw times?

Post by Yeray » Mon Apr 26, 2021 9:13 am

Hello,

You can start a TStopWatch at the Chart's OnBeforeDraw event calculate the elapsed time at OnAfterDraw event. Ie:

Code: Select all

uses Diagnostics, TimeSpan;

var stopWatch: TStopwatch;

procedure TForm1.ChartBeforeDraw(Sender: TObject);
begin
  label1.Caption:='Drawing...';
  stopWatch:=TStopwatch.Create;
  stopWatch.Start;
end;

procedure TForm1.ChartAfterDraw(Sender: TObject);
var elapsed: TTimeSpan;
    seconds: Double;
begin
  elapsed:=stopWatch.Elapsed;
  seconds:=elapsed.TotalSeconds;
  label1.Caption:='Drawing took ' + FormatFloat('#,##0.##', seconds) + ' seconds';
end;
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Post Reply