diff options
author | Luck <git@lucko.me> | 2022-11-14 19:54:58 +0000 |
---|---|---|
committer | Luck <git@lucko.me> | 2022-11-14 19:54:58 +0000 |
commit | 3b0564cc4b259f49a15aa6cdb2c4b8e35f5e26e0 (patch) | |
tree | 576feb28e6c9d2309793dabf247febdc35c8a64b /spark-common/src/main/java/me/lucko/spark | |
parent | b9f0e49ed17a7c32f36f31141c02529359944d03 (diff) | |
download | spark-3b0564cc4b259f49a15aa6cdb2c4b8e35f5e26e0.tar.gz spark-3b0564cc4b259f49a15aa6cdb2c4b8e35f5e26e0.tar.bz2 spark-3b0564cc4b259f49a15aa6cdb2c4b8e35f5e26e0.zip |
Suppress profiler logs when running in background
Diffstat (limited to 'spark-common/src/main/java/me/lucko/spark')
3 files changed, 9 insertions, 4 deletions
diff --git a/spark-common/src/main/java/me/lucko/spark/common/SparkPlatform.java b/spark-common/src/main/java/me/lucko/spark/common/SparkPlatform.java index 5461ed4..105b167 100644 --- a/spark-common/src/main/java/me/lucko/spark/common/SparkPlatform.java +++ b/spark-common/src/main/java/me/lucko/spark/common/SparkPlatform.java @@ -187,7 +187,6 @@ public class SparkPlatform { this.plugin.log(Level.INFO, "Starting background profiler..."); try { startBackgroundProfiler(); - this.plugin.log(Level.INFO, "... done!"); } catch (Exception e) { e.printStackTrace(); } diff --git a/spark-common/src/main/java/me/lucko/spark/common/sampler/async/AsyncProfilerJob.java b/spark-common/src/main/java/me/lucko/spark/common/sampler/async/AsyncProfilerJob.java index 7b123a7..8991e94 100644 --- a/spark-common/src/main/java/me/lucko/spark/common/sampler/async/AsyncProfilerJob.java +++ b/spark-common/src/main/java/me/lucko/spark/common/sampler/async/AsyncProfilerJob.java @@ -83,6 +83,8 @@ public class AsyncProfilerJob { private ThreadDumper threadDumper; /** The profiling window */ private int window; + /** If the profiler should run in quiet mode */ + private boolean quiet; /** The file used by async-profiler to output data */ private Path outputFile; @@ -116,11 +118,12 @@ public class AsyncProfilerJob { } // Initialise the job - public void init(SparkPlatform platform, int interval, ThreadDumper threadDumper, int window) { + public void init(SparkPlatform platform, int interval, ThreadDumper threadDumper, int window, boolean quiet) { this.platform = platform; this.interval = interval; this.threadDumper = threadDumper; this.window = window; + this.quiet = quiet; } /** @@ -139,6 +142,9 @@ public class AsyncProfilerJob { // construct a command to send to async-profiler String command = "start,event=" + this.access.getProfilingEvent() + ",interval=" + this.interval + "us,threads,jfr,file=" + this.outputFile.toString(); + if (this.quiet) { + command += ",loglevel=NONE"; + } if (this.threadDumper instanceof ThreadDumper.Specific) { command += ",filter"; } diff --git a/spark-common/src/main/java/me/lucko/spark/common/sampler/async/AsyncSampler.java b/spark-common/src/main/java/me/lucko/spark/common/sampler/async/AsyncSampler.java index d6cfd4f..f2e7191 100644 --- a/spark-common/src/main/java/me/lucko/spark/common/sampler/async/AsyncSampler.java +++ b/spark-common/src/main/java/me/lucko/spark/common/sampler/async/AsyncSampler.java @@ -79,7 +79,7 @@ public class AsyncSampler extends AbstractSampler { int window = ProfilingWindowUtils.windowNow(); AsyncProfilerJob job = this.profilerAccess.startNewProfilerJob(); - job.init(this.platform, this.interval, this.threadDumper, window); + job.init(this.platform, this.interval, this.threadDumper, window, this.background); job.start(); this.currentJob = job; @@ -116,7 +116,7 @@ public class AsyncSampler extends AbstractSampler { // start a new job int window = previousJob.getWindow() + 1; AsyncProfilerJob newJob = this.profilerAccess.startNewProfilerJob(); - newJob.init(this.platform, this.interval, this.threadDumper, window); + newJob.init(this.platform, this.interval, this.threadDumper, window, this.background); newJob.start(); this.currentJob = newJob; |