From 03bfa12bffa4f3116bf8ddac8f6bd528210651c9 Mon Sep 17 00:00:00 2001 From: Luck Date: Thu, 30 Dec 2021 21:34:18 +0000 Subject: Use wallclock sampling instead of itimer --- .../spark/common/sampler/async/AsyncProfilerAccess.java | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'spark-common/src/main/java/me') 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 3dfbbbf..d1c8393 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 @@ -27,6 +27,7 @@ import me.lucko.spark.common.SparkPlatform; import me.lucko.spark.common.util.TemporaryFiles; import one.profiler.AsyncProfiler; +import one.profiler.Events; import java.io.InputStream; import java.net.URL; @@ -60,8 +61,8 @@ public enum AsyncProfilerAccess { profiler = load(); if (isEventSupported(profiler, ProfilingEvent.CPU, false)) { profilingEvent = ProfilingEvent.CPU; - } else if (isEventSupported(profiler, ProfilingEvent.ITIMER, true)) { - profilingEvent = ProfilingEvent.ITIMER; + } else if (isEventSupported(profiler, ProfilingEvent.WALL, true)) { + profilingEvent = ProfilingEvent.WALL; } } catch (Exception e) { profiler = null; @@ -161,11 +162,18 @@ public enum AsyncProfilerAccess { } enum ProfilingEvent { - CPU, ITIMER; + CPU(Events.CPU), + WALL(Events.WALL); + + private final String id; + + ProfilingEvent(String id) { + this.id = id; + } @Override public String toString() { - return name().toLowerCase(Locale.ROOT); + return this.id; } } -- cgit