public class ContinuousProfilingScheduler extends java.lang.Object implements ProfilingScheduler
| Constructor and Description |
|---|
ContinuousProfilingScheduler(Config config,
Exporter exporter) |
| Modifier and Type | Method and Description |
|---|---|
static java.time.Instant |
alignProfilingIntervalStartTime(java.time.Instant profilingIntervalStartTime,
java.time.Duration uploadInterval)
Aligns profilingIntervalStartTime to the closest aligned upload time either forward or backward
For example if upload interval is 10s and profilingIntervalStartTime is 00:00.01 it will return 00:00
and if profilingIntervalStartTime is 00:09.239 it will return 00:10
...
|
void |
start(Profiler profiler)
Use Profiler's to start, stop, dumpProfile
Profiler.start()
Profiler.stop()
Profiler.dumpProfile(Instant)
Here is an example of naive implementation |
public void start(Profiler profiler)
ProfilingSchedulerProfiler.start()
Profiler.stop()
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 ContinuousProfilingScheduler and
Github issue #40 for more details.start in interface ProfilingSchedulerpublic static java.time.Instant alignProfilingIntervalStartTime(java.time.Instant profilingIntervalStartTime,
java.time.Duration uploadInterval)
profilingIntervalStartTime - the time to alignuploadInterval -