From 684cc5e071e30161bea825ba2b4b9f7b9984805d Mon Sep 17 00:00:00 2001 From: Luck Date: Tue, 3 Sep 2024 20:37:54 +0100 Subject: Refactor sampler node export process --- .../me/lucko/spark/common/command/modules/SamplerModule.java | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'spark-common/src/main/java/me/lucko/spark/common/command') diff --git a/spark-common/src/main/java/me/lucko/spark/common/command/modules/SamplerModule.java b/spark-common/src/main/java/me/lucko/spark/common/command/modules/SamplerModule.java index 334e416..cc7d56b 100644 --- a/spark-common/src/main/java/me/lucko/spark/common/command/modules/SamplerModule.java +++ b/spark-common/src/main/java/me/lucko/spark/common/command/modules/SamplerModule.java @@ -37,12 +37,11 @@ import me.lucko.spark.common.sampler.SamplerMode; import me.lucko.spark.common.sampler.ThreadDumper; import me.lucko.spark.common.sampler.ThreadGrouper; import me.lucko.spark.common.sampler.async.AsyncSampler; -import me.lucko.spark.common.sampler.node.MergeMode; +import me.lucko.spark.common.sampler.java.MergeStrategy; import me.lucko.spark.common.sampler.source.ClassSourceLookup; import me.lucko.spark.common.tick.TickHook; import me.lucko.spark.common.util.FormatUtil; import me.lucko.spark.common.util.MediaTypes; -import me.lucko.spark.common.util.MethodDisambiguator; import me.lucko.spark.common.ws.ViewerSocket; import me.lucko.spark.proto.SparkSamplerProtos; import net.kyori.adventure.text.Component; @@ -507,12 +506,7 @@ public class SamplerModule implements CommandModule { return new Sampler.ExportProps() .creator(resp.senderData()) .comment(Iterables.getFirst(arguments.stringFlag("comment"), null)) - .mergeMode(() -> { - MethodDisambiguator methodDisambiguator = new MethodDisambiguator(platform.createClassFinder()); - return arguments.boolFlag("separate-parent-calls") - ? MergeMode.separateParentCalls(methodDisambiguator) - : MergeMode.sameMethod(methodDisambiguator); - }) + .mergeStrategy(arguments.boolFlag("separate-parent-calls") ? MergeStrategy.SEPARATE_PARENT_CALLS : MergeStrategy.SAME_METHOD) .classSourceLookup(() -> ClassSourceLookup.create(platform)); } -- cgit