Do not look for instrumenters in TIME mode
This commit is contained in:
@@ -99,9 +99,7 @@ public class Preloader {
|
|||||||
private static Handler getHandler(ProfilingMode profilingMode, ClassLoader withInstrumenter) {
|
private static Handler getHandler(ProfilingMode profilingMode, ClassLoader withInstrumenter) {
|
||||||
if (profilingMode == ProfilingMode.NO_TIME) return new Handler();
|
if (profilingMode == ProfilingMode.NO_TIME) return new Handler();
|
||||||
|
|
||||||
ServiceLoader<Instrumenter> loader = ServiceLoader.load(Instrumenter.class, withInstrumenter);
|
final Instrumenter instrumenter = profilingMode == ProfilingMode.PROFILE ? loadInstrumenter(withInstrumenter) : null;
|
||||||
Iterator<Instrumenter> instrumenters = loader.iterator();
|
|
||||||
final Instrumenter instrumenter = instrumenters.hasNext() ? instrumenters.next() : Instrumenter.DO_NOTHING;
|
|
||||||
|
|
||||||
final int[] counter = new int[1];
|
final int[] counter = new int[1];
|
||||||
final int[] size = new int[1];
|
final int[] size = new int[1];
|
||||||
@@ -127,6 +125,18 @@ public class Preloader {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static Instrumenter loadInstrumenter(ClassLoader withInstrumenter) {
|
||||||
|
ServiceLoader<Instrumenter> loader = ServiceLoader.load(Instrumenter.class, withInstrumenter);
|
||||||
|
Iterator<Instrumenter> instrumenters = loader.iterator();
|
||||||
|
if (instrumenters.hasNext()) {
|
||||||
|
return instrumenters.next();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
System.err.println("No instrumenters found");
|
||||||
|
return Instrumenter.DO_NOTHING;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private enum ProfilingMode {
|
private enum ProfilingMode {
|
||||||
NO_TIME,
|
NO_TIME,
|
||||||
TIME,
|
TIME,
|
||||||
|
|||||||
Reference in New Issue
Block a user