Java Code Examples for jdk.jfr.consumer.RecordedEvent#getLong()

The following examples show how to use jdk.jfr.consumer.RecordedEvent#getLong() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JFRExports.java    From MantaroBot with GNU General Public License v3.0 6 votes vote down vote up
private static void logTTSP(LongLongRingBuffer buffer, RecordedEvent event) {
    var id = event.getLong("safepointId");
    var time = buffer.remove(id);
    if(time == -1) {
        //safepoint lost, buffer overwrote it
        //this shouldn't happen unless we get a
        //massive amount of safepoints at once
        log.error("Safepoint with id {} lost", id);
    } else {
        //the buffer contains the time of the synchronize event,
        //because that's what gets posted first, but the start event
        //stats before
        var elapsed = time - nanoTime(event.getStartTime());
        SAFEPOINTS_TTSP.observe(elapsed / NANOSECONDS_PER_SECOND);
    }
}
 
Example 2
Source File: ProfileResults.java    From lucene-solr with Apache License 2.0 5 votes vote down vote up
/** value we accumulate for this event */
static long getValue(RecordedEvent event) {
  switch(event.getEventType().getName()) {
    case "jdk.ObjectAllocationInNewTLAB":
      return event.getLong("tlabSize");
    case "jdk.ObjectAllocationOutsideTLAB":
      return event.getLong("allocationSize");
    case "jdk.ExecutionSample":
      return 1L;
    case "jdk.NativeMethodSample":
      return 1L;
    default:
      throw new UnsupportedOperationException(event.toString());
  }
}
 
Example 3
Source File: JFRExports.java    From MantaroBot with GNU General Public License v3.0 5 votes vote down vote up
private static void logSafepointOperation(LongLongRingBuffer buffer, RecordedEvent event) {
    var id = event.getLong("safepointId");
    var time = buffer.remove(id);
    if(time == -1) {
        //safepoint lost, buffer overwrote it
        //this shouldn't happen unless we get a
        //massive amount of safepoints at once
        log.error("Safepoint with id {} lost", id);
    } else {
        var elapsed = nanoTime(event.getEndTime()) - time;
        SAFEPOINTS_OPERATION.observe(elapsed / NANOSECONDS_PER_SECOND);
    }
}