diff options
author | Luck <git@lucko.me> | 2021-11-14 19:20:29 +0000 |
---|---|---|
committer | Luck <git@lucko.me> | 2021-11-14 19:20:29 +0000 |
commit | ea24440cf3fa6a1a7fa2ef3f09035bb1b963a6e5 (patch) | |
tree | 0ce891690476eb20221ed4807a1c8f2ef52af923 /spark-common | |
parent | 49fc0ba47fac077a2fe965c44fd382a1ab02089c (diff) | |
download | spark-ea24440cf3fa6a1a7fa2ef3f09035bb1b963a6e5.tar.gz spark-ea24440cf3fa6a1a7fa2ef3f09035bb1b963a6e5.tar.bz2 spark-ea24440cf3fa6a1a7fa2ef3f09035bb1b963a6e5.zip |
Print more useful information when async-profiler fails to load
Diffstat (limited to 'spark-common')
-rw-r--r-- | spark-common/src/main/java/me/lucko/spark/common/sampler/async/AsyncProfilerAccess.java | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/spark-common/src/main/java/me/lucko/spark/common/sampler/async/AsyncProfilerAccess.java b/spark-common/src/main/java/me/lucko/spark/common/sampler/async/AsyncProfilerAccess.java index 2506db3..f1d7209 100644 --- a/spark-common/src/main/java/me/lucko/spark/common/sampler/async/AsyncProfilerAccess.java +++ b/spark-common/src/main/java/me/lucko/spark/common/sampler/async/AsyncProfilerAccess.java @@ -73,8 +73,15 @@ public enum AsyncProfilerAccess { public boolean checkSupported(SparkPlatform platform) { if (this.setupException != null) { - platform.getPlugin().log(Level.INFO, "async-profiler engine is not supported on your system: " + this.setupException.getMessage()); - platform.getPlugin().log(Level.INFO, "Please see here for more information: https://spark.lucko.me/docs/misc/Using-async-profiler"); + if (this.setupException instanceof UnsupportedSystemException) { + platform.getPlugin().log(Level.INFO, "The async-profiler engine is not supported for your os/arch (" + + this.setupException.getMessage() + "), so the built-in Java engine will be used instead."); + } else { + platform.getPlugin().log(Level.WARNING, "Unable to initialise the async-profiler engine: " + this.setupException.getMessage()); + platform.getPlugin().log(Level.WARNING, "Please see here for more information: https://spark.lucko.me/docs/misc/Using-async-profiler"); + this.setupException.printStackTrace(); + } + } return this.profiler != null; } @@ -91,7 +98,7 @@ public enum AsyncProfilerAccess { .build(); if (!supported.containsEntry(os, arch)) { - throw new UnsupportedOperationException("Not supported for your os/arch: " + os + '/' + arch); + throw new UnsupportedSystemException(os, arch); } // extract the profiler binary from the spark jar file @@ -127,4 +134,10 @@ public enum AsyncProfilerAccess { throw new UnsupportedOperationException("CPU event is not supported"); } } + + private static final class UnsupportedSystemException extends UnsupportedOperationException { + public UnsupportedSystemException(String os, String arch) { + super(os + '/' + arch); + } + } } |