Uploaded image for project: 'Jackrabbit Oak'
  1. Jackrabbit Oak
  2. OAK-3877

PerfLogger should use System.nanoTime instead of System.currentTimeMillis

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.3.14, 1.4
    • Component/s: core
    • Labels:
      None

      Description

      PerfLogger currently make use of System.currentTimeMillis for timing the performance. It would be better to make use of System.nanoTime.

      Per Ian Boston comment and [1]

      You should always try to use nanoTime to do timing measurement or calculation

      This would provide following benefits

      • Simpler integration with Metric stats support which makes use of nanoTime
      • No possibility of drift i.e. currentTimeMillis going back in time

      [1] https://blogs.oracle.com/dholmes/entry/inside_the_hotspot_vm_clocks

        Attachments

          Activity

            People

            • Assignee:
              chetanm Chetan Mehrotra
              Reporter:
              chetanm Chetan Mehrotra
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: