diff options
author | Luck <git@lucko.me> | 2018-05-30 16:50:36 +0100 |
---|---|---|
committer | Luck <git@lucko.me> | 2018-05-30 16:50:36 +0100 |
commit | 8b5071cdc5bd2609ee4f3805e3a54ced7f3d4df8 (patch) | |
tree | 9eca57156ed1c1f01df35c4927ffc071ec018c4a /common/src/main/java/me/lucko/spark/profiler/Sampler.java | |
parent | 645b2b34542c63c5416ada762c04efcacc3ca17f (diff) | |
download | spark-8b5071cdc5bd2609ee4f3805e3a54ced7f3d4df8.tar.gz spark-8b5071cdc5bd2609ee4f3805e3a54ced7f3d4df8.tar.bz2 spark-8b5071cdc5bd2609ee4f3805e3a54ced7f3d4df8.zip |
Add option to combine thread pool processes under the same node
Diffstat (limited to 'common/src/main/java/me/lucko/spark/profiler/Sampler.java')
-rw-r--r-- | common/src/main/java/me/lucko/spark/profiler/Sampler.java | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/common/src/main/java/me/lucko/spark/profiler/Sampler.java b/common/src/main/java/me/lucko/spark/profiler/Sampler.java index 9696c03..d03b4b6 100644 --- a/common/src/main/java/me/lucko/spark/profiler/Sampler.java +++ b/common/src/main/java/me/lucko/spark/profiler/Sampler.java @@ -61,14 +61,17 @@ public class Sampler extends TimerTask { private final int interval; /** The instance used to generate thread information for use in sampling */ private final ThreadDumper threadDumper; + /** The instance used to group threads together */ + private final ThreadGrouper threadGrouper; /** The time when sampling first began */ private long startTime = -1; /** The unix timestamp (in millis) when this sampler should automatically complete.*/ private final long endTime; // -1 for nothing - public Sampler(int interval, ThreadDumper threadDumper, long endTime) { + public Sampler(int interval, ThreadDumper threadDumper, ThreadGrouper threadGrouper, long endTime) { this.interval = interval; this.threadDumper = threadDumper; + this.threadGrouper = threadGrouper; this.endTime = endTime; } @@ -84,7 +87,8 @@ public class Sampler extends TimerTask { private void insertData(QueuedThreadInfo data) { try { - StackNode node = this.threadData.computeIfAbsent(data.threadName, StackNode::new); + String group = this.threadGrouper.getGroup(data.threadName); + StackNode node = this.threadData.computeIfAbsent(group, StackNode::new); node.log(data.stack, Sampler.this.interval); } catch (Exception e) { e.printStackTrace(); |