io.pyroscope.javaagent.api.ProfilingScheduler Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of agent Show documentation
Show all versions of agent Show documentation
The Java profiling agent for Pyroscope.io. Based on async-profiler.
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);
}