Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8224749

JFR: Event Metrics

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Unresolved
    • Icon: P3 P3
    • tbd
    • 13
    • hotspot
    • None
    • jfr

      Today it is possible to configure the interval at which periodic events are emitted, for example emit the CPU load once every second. This works well if you want an overall picture of what is happening in the application, but not so well if you want to measure what happens exactly.

      For example, you may want to know how many CPU ticks that has occurred during a transaction or how much allocation that has happened in a method in integration testing (to prevent regressions).

      If an event could be annotated with @Allocation, @CPUTime, @NetworkUsage etc, it would be possible to take a snapshot when the begin and end method is called. This adds addtional overhead but it could be very useful for some events.

      Example usage:

      @Allocation
      @CPUTime
      @Name("example.Transaction");
      class Transaction extends Event {
         long transactionId;
      }

      void executeTransaction(String userId, long id) {
        Transaction event = new Transaction()
         event.userId = userId;
         event.transactionId = id;
         event.begin();
         doTransaction();
         event.commit();
      }

      $ jfr print recording.jfr

      example.Transaction {
         startTime = 20:12:52.838
         duration = 20,5 ms
         allocated = 500 kb
         cpuTime = 3 ms
         transactionId = 5671
         userId = "egahlin"
      }

      Here are some metrics that might be interesting:

      - thread CPU time
      - process CPU time
      - machine CPU time
      - total allocated
      - thread allocated
      - network read / write
      - thread network read / write
      - file read / write
      - thread file read / write
      - time spent in safe point




            Unassigned Unassigned
            egahlin Erik Gahlin
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: