jdk.jfr.events.ActiveRecordingEvent Java Examples

The following examples show how to use jdk.jfr.events.ActiveRecordingEvent. 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: PlatformRecorder.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
public PlatformRecorder() throws Exception {
    repository = Repository.getRepository();
    Logger.log(JFR_SYSTEM, INFO, "Initialized disk repository");
    repository.ensureRepository();
    jvm.createNativeJFR();
    Logger.log(JFR_SYSTEM, INFO, "Created native");
    JDKEvents.initialize();
    Logger.log(JFR_SYSTEM, INFO, "Registered JDK events");
    JDKEvents.addInstrumentation();
    startDiskMonitor();
    SecuritySupport.registerEvent(ActiveRecordingEvent.class);
    activeRecordingEvent = EventType.getEventType(ActiveRecordingEvent.class);
    SecuritySupport.registerEvent(ActiveSettingEvent.class);
    activeSettingEvent = EventType.getEventType(ActiveSettingEvent.class);
    shutdownHook = SecuritySupport.createThreadWitNoPermissions("JFR: Shutdown Hook", new ShutdownHook(this));
    SecuritySupport.setUncaughtExceptionHandler(shutdownHook, new ShutdownHook.ExceptionHandler());
    SecuritySupport.registerShutdownHook(shutdownHook);
    timer = createTimer();
}
 
Example #2
Source File: PlatformRecorder.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
public PlatformRecorder() throws Exception {
    repository = Repository.getRepository();
    Logger.log(JFR_SYSTEM, INFO, "Initialized disk repository");
    repository.ensureRepository();
    jvm.createNativeJFR();
    Logger.log(JFR_SYSTEM, INFO, "Created native");
    JDKEvents.initialize();
    Logger.log(JFR_SYSTEM, INFO, "Registered JDK events");
    JDKEvents.addInstrumentation();
    startDiskMonitor();
    SecuritySupport.registerEvent(ActiveRecordingEvent.class);
    activeRecordingEvent = EventType.getEventType(ActiveRecordingEvent.class);
    SecuritySupport.registerEvent(ActiveSettingEvent.class);
    activeSettingEvent = EventType.getEventType(ActiveSettingEvent.class);
    shutdownHook = SecuritySupport.createThreadWitNoPermissions("JFR: Shutdown Hook", new ShutdownHook(this));
    SecuritySupport.setUncaughtExceptionHandler(shutdownHook, new ShutdownHook.ExceptionHandler());
    SecuritySupport.registerShutdownHook(shutdownHook);
    timer = createTimer();
}
 
Example #3
Source File: PlatformRecorder.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
public PlatformRecorder() throws Exception {
    repository = Repository.getRepository();
    Logger.log(JFR_SYSTEM, INFO, "Initialized disk repository");
    repository.ensureRepository();
    jvm.createNativeJFR();
    Logger.log(JFR_SYSTEM, INFO, "Created native");
    JDKEvents.initialize();
    Logger.log(JFR_SYSTEM, INFO, "Registered JDK events");
    JDKEvents.addInstrumentation();
    startDiskMonitor();
    SecuritySupport.registerEvent(ActiveRecordingEvent.class);
    activeRecordingEvent = EventType.getEventType(ActiveRecordingEvent.class);
    SecuritySupport.registerEvent(ActiveSettingEvent.class);
    activeSettingEvent = EventType.getEventType(ActiveSettingEvent.class);
    shutdownHook = SecuritySupport.createThreadWitNoPermissions("JFR: Shutdown Hook", new ShutdownHook(this));
    SecuritySupport.setUncaughtExceptionHandler(shutdownHook, new ShutdownHook.ExceptionHandler());
    SecuritySupport.registerShutdownHook(shutdownHook);
    timer = createTimer();
}
 
Example #4
Source File: PlatformRecorder.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
private void writeMetaEvents() {

        if (activeRecordingEvent.isEnabled()) {
            for (PlatformRecording r : getRecordings()) {
                if (r.getState() == RecordingState.RUNNING && r.shouldWriteMetadataEvent()) {
                    ActiveRecordingEvent event = new ActiveRecordingEvent();
                    event.id = r.getId();
                    event.name = r.getName();
                    WriteableUserPath p = r.getDestination();
                    event.destination = p == null ? null : p.getText();
                    Duration d = r.getDuration();
                    event.recordingDuration = d == null ? Long.MAX_VALUE : d.toMillis();
                    Duration age = r.getMaxAge();
                    event.maxAge = age == null ? Long.MAX_VALUE : age.toMillis();
                    Long size = r.getMaxSize();
                    event.maxSize = size == null ? Long.MAX_VALUE : size;
                    Instant start = r.getStartTime();
                    event.recordingStart = start == null ? Long.MAX_VALUE : start.toEpochMilli();
                    event.commit();
                }
            }
        }
        if (activeSettingEvent.isEnabled()) {
            for (EventControl ec : MetadataRepository.getInstance().getEventControls()) {
                ec.writeActiveSettingEvent();
            }
        }
    }
 
Example #5
Source File: PlatformRecorder.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
private void writeMetaEvents() {

        if (activeRecordingEvent.isEnabled()) {
            for (PlatformRecording r : getRecordings()) {
                if (r.getState() == RecordingState.RUNNING && r.shouldWriteMetadataEvent()) {
                    ActiveRecordingEvent event = new ActiveRecordingEvent();
                    event.id = r.getId();
                    event.name = r.getName();
                    WriteableUserPath p = r.getDestination();
                    event.destination = p == null ? null : p.getText();
                    Duration d = r.getDuration();
                    event.recordingDuration = d == null ? Long.MAX_VALUE : d.toMillis();
                    Duration age = r.getMaxAge();
                    event.maxAge = age == null ? Long.MAX_VALUE : age.toMillis();
                    Long size = r.getMaxSize();
                    event.maxSize = size == null ? Long.MAX_VALUE : size;
                    Instant start = r.getStartTime();
                    event.recordingStart = start == null ? Long.MAX_VALUE : start.toEpochMilli();
                    event.commit();
                }
            }
        }
        if (activeSettingEvent.isEnabled()) {
            for (EventControl ec : MetadataRepository.getInstance().getEventControls()) {
                ec.writeActiveSettingEvent();
            }
        }
    }
 
Example #6
Source File: PlatformRecorder.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
private void writeMetaEvents() {

        if (activeRecordingEvent.isEnabled()) {
            for (PlatformRecording r : getRecordings()) {
                if (r.getState() == RecordingState.RUNNING && r.shouldWriteMetadataEvent()) {
                    ActiveRecordingEvent event = new ActiveRecordingEvent();
                    event.id = r.getId();
                    event.name = r.getName();
                    WriteableUserPath p = r.getDestination();
                    event.destination = p == null ? null : p.getText();
                    Duration d = r.getDuration();
                    event.recordingDuration = d == null ? Long.MAX_VALUE : d.toMillis();
                    Duration age = r.getMaxAge();
                    event.maxAge = age == null ? Long.MAX_VALUE : age.toMillis();
                    Long size = r.getMaxSize();
                    event.maxSize = size == null ? Long.MAX_VALUE : size;
                    Instant start = r.getStartTime();
                    event.recordingStart = start == null ? Long.MAX_VALUE : start.toEpochMilli();
                    event.commit();
                }
            }
        }
        if (activeSettingEvent.isEnabled()) {
            for (EventControl ec : MetadataRepository.getInstance().getEventControls()) {
                ec.writeActiveSettingEvent();
            }
        }
    }