Uploaded image for project: 'Commons Lang'
  1. Commons Lang
  2. LANG-1373

Stopwatch based capability for nested, named, timings in a call stack

    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Closed
    • Major
    • Resolution: Won't Fix
    • None
    • None
    • lang.time.*

    Description

      While working on adding some timing functionality to a Metron feature, I came across the
      Stopwatch class, but found that it didn’t suite my needs.

      What I wanted to do was to create a timing from a top level function in our Stellar dsl, and have have a group of related timings, such that the end result was the overall time of the call, and nested timings of other calls executed during the dsl execution of that function. These timings would all be named, and have a path for identification and include timing the language compiler/execution as well as the function execution itself. It would be helpful if they were tagged in some way as well, such that the consumer could filter during visitation.

      So I have written StackWatch to provide this functionality, and submitted it in a Metron PR.

      From the PR description:

      StackWatch

      A set of utility classes under the new package stellar.common.timing have been added. These provide the StackWatch functionality.

      StackWatch provides an abstraction over the Apache Commons StopWatch class that allows callers to create multiple named and possibly nested timing operations.

      <…>

      This class may be more generally useful to this and other projects, but I am not sure where it would live since we wouldn’t want it in common.

      StackWatch uses a combination of Deque and a custom Tree implementation to create, start and end timing operations.

      A Visitor pattern is also implemented to allow for retrieving the results after the completion of the operation.

      Attachments

        1. LANG-1373.patch
          13 kB
          Gilles Sadowski

        Issue Links

          Activity

            People

              otto Otto Fowler
              otto Otto Fowler
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: