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) {
|
||||
if (profilingMode == ProfilingMode.NO_TIME) return new Handler();
|
||||
|
||||
ServiceLoader<Instrumenter> loader = ServiceLoader.load(Instrumenter.class, withInstrumenter);
|
||||
Iterator<Instrumenter> instrumenters = loader.iterator();
|
||||
final Instrumenter instrumenter = instrumenters.hasNext() ? instrumenters.next() : Instrumenter.DO_NOTHING;
|
||||
final Instrumenter instrumenter = profilingMode == ProfilingMode.PROFILE ? loadInstrumenter(withInstrumenter) : null;
|
||||
|
||||
final int[] counter = 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 {
|
||||
NO_TIME,
|
||||
TIME,
|
||||
|
||||
Reference in New Issue
Block a user