All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.pyroscope.javaagent.api.ProfilingScheduler Maven / Gradle / Ivy

There is a newer version: 0.14.0
Show newest version
package io.pyroscope.javaagent.api;

import io.pyroscope.javaagent.Profiler;

import java.time.Instant;

/**
 *
 */
public interface ProfilingScheduler {
    /**
     * Use Profiler's to start, stop, dumpProfile
     * {@link Profiler#start()}
     * {@link Profiler#stop()}
     * {@link Profiler#dumpProfile(Instant)}
     * Here is an example of naive implementation
     * 
     * public void start(Profiler profiler) {
     *      new Thread(() -> {
     *          while (true) {
     *              Instant startTime = Instant.now();
     *              profiler.start();
     *              sleep(10);
     *              profiler.stop();
     *              exporter.export(
     *                  profiler.dumpProfile(startTime)
     *              );
     *              sleep(50);
     *          }
     *      }).start();
     *  }
     * 
* The real-world example will be more complex since profile start and stop time should be aligned to 10s intervals * See {@link io.pyroscope.javaagent.impl.ContinuousProfilingScheduler} and * Github issue #40 for more details. * **/ void start(Profiler profiler); }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy