Free cookie consent management tool by TermsFeed Policy Generator

Opened 6 years ago

Last modified 5 years ago

#2869 new enhancement

Change measurement of execution time

Reported by: abeham Owned by:
Priority: medium Milestone: HeuristicLab 3.3.17
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 6 years ago.
A patch that updates classes in HeuristicLab.Optimization

Download all attachments as: .zip

Change History (6)

Changed 6 years ago by abeham

A patch that updates classes in HeuristicLab.Optimization

comment:1 Changed 6 years 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 6 years ago by abeham

Revision r15603 implements this feature in another branch

comment:3 Changed 6 years ago by abeham

  • Version set to branch

comment:4 Changed 6 years 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.

comment:5 Changed 5 years ago by abeham

  • Milestone changed from HeuristicLab 3.3.16 to HeuristicLab 3.3.17
Note: See TracTickets for help on using tickets.