Opened 12 months ago

Last modified 11 months ago

#2869 new enhancement

Change measurement of execution time

Reported by: abeham Owned by:
Priority: medium Milestone: HeuristicLab 3.3.16
Component: Optimization Version: branch
Keywords: Cc:

Description

Execution time is measured via a System.Timer that basically runs in a thread of its own. This has several drawbacks:

  1. The thread is created even in the case where no GUI exists and Execution Time updating is not of interest
  2. The execution time is only updated at a fixed interval of currently 200ms

I propose to change measuring execution time by recording a start date and some elapsed time. The execution time is then a sum of the time since it was started and the elapsed time.

Attachments (1)

executiontime.patch (27.1 KB) - added by abeham 12 months ago.
A patch that updates classes in HeuristicLab.Optimization

Download all attachments as: .zip

Change History (5)

Changed 12 months ago by abeham

A patch that updates classes in HeuristicLab.Optimization

comment:1 Changed 12 months ago by abeham

There are some notable issues when implementing this feature:

  1. We must use UtcTime to avoid daylight saving issues
  2. We must not use Stop() or Pause() methods, but rather OnStopped() and OnPaused()
  3. Going from Paused to Stop must not increment the execution time
  4. The TimeLimitRun that relies on ExecutionTimeChanged must implement its own timer
  5. ExecutionTimeChanged must disappear from the respective interfaces
  6. All views tracking execution time must implement a timer
  7. OnStopped() changes an algorithm's executionState in the base class (in the patch it's done right for BasicAlgorithm and wrong for HeuristicOptimizationAlgorithm)
  8. Engines need to be adapted as well

comment:2 Changed 11 months ago by abeham

Revision r15603 implements this feature in another branch

comment:3 Changed 11 months ago by abeham

  • Version set to branch

comment:4 Changed 11 months ago by abeham

Unfortunately, DateTime proved to be only a very rough estimate for measuring execution time. The startDate should be replaced with an instance of the Stopwatch class.

Note: See TracTickets for help on using tickets.