Wyatt Allen 261917281e Optionally log timing baselines with timer object
The gr-reporting "time" and "timeEnd" methods provide a convenient
mechanism for PolyGerrit components to record timings. However, because
they record the start time in a global dictionary keyed by the timing
name, they do not work well when multiple timers with the same key may
be reported simultaneously.

This multiple-timer scenario can come about when creating diff drafts,
which uses the CreateDraftComment timing key to time each draft,
potentially overwriting timers for earlier requests.

      Create      Create       Draft 1     Draft 2
      Draft 1     Draft 2      Created     Created
         |           |            |           |
         +------------------------+           |
         |           |            |           |
         |           +------------------------+
         |           |            |           |
Time ----+-----------+------------+-----------+---------------->
         |           |            |           |
        Save        Save        Timer    Timer attempts
        Timer       Timer       Ended    to end, but no
       Baseline    Baseline             timer is running!
                 (Overwrite!)

Provide a new method to record timing using timer objects that do not
store start times statefully. This gives a simple tool for the
concurrent timer cases, while preserving the convenient interface for
the timers for which concurrency is not an issue.

Change-Id: Ia5c030a16c87537700928df71a175821770e6814
2018-06-18 16:21:34 -07:00
..