aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md2
-rw-r--r--spark-common/src/main/java/me/lucko/spark/common/command/modules/SamplerModule.java7
-rw-r--r--spark-common/src/main/java/me/lucko/spark/sampler/ThreadGrouper.java6
3 files changed, 13 insertions, 2 deletions
diff --git a/README.md b/README.md
index 33a544d..50fb42a 100644
--- a/README.md
+++ b/README.md
@@ -103,6 +103,8 @@ Starts a new profiling operation.
* The `*` character can be used in place of a name to mark that all threads should be profiled
* `--regex`
* Specifies that the set of threads defined should be interpreted as regex patterns.
+* `--combine-all`
+ * Specifies that all threads should be combined into a single node.
* `--not-combined`
* Specifies that threads from a pool should not be combined into a single node.
* `--interval <interval>`
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 7b456ac..6ebbee1 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
@@ -57,6 +57,7 @@ public class SamplerModule<S> implements CommandModule<S> {
.argumentUsage("timeout", "timeout seconds")
.argumentUsage("thread", "thread name")
.argumentUsage("regex", null)
+ .argumentUsage("combine-all", null)
.argumentUsage("not-combined", null)
.argumentUsage("interval", "interval millis")
.argumentUsage("only-ticks-over", "tick length millis")
@@ -96,7 +97,9 @@ public class SamplerModule<S> implements CommandModule<S> {
}
ThreadGrouper threadGrouper;
- if (arguments.boolFlag("not-combined")) {
+ if (arguments.boolFlag("combine-all")) {
+ threadGrouper = ThreadGrouper.AS_ONE;
+ } else if (arguments.boolFlag("not-combined")) {
threadGrouper = ThreadGrouper.BY_NAME;
} else {
threadGrouper = ThreadGrouper.BY_POOL;
@@ -171,7 +174,7 @@ public class SamplerModule<S> implements CommandModule<S> {
}
})
.tabCompleter((platform, sender, arguments) -> {
- List<String> opts = new ArrayList<>(Arrays.asList("--timeout", "--regex",
+ List<String> opts = new ArrayList<>(Arrays.asList("--timeout", "--regex", "--combine-all",
"--not-combined", "--interval", "--only-ticks-over", "--include-line-numbers"));
opts.removeAll(arguments);
opts.add("--thread"); // allowed multiple times
diff --git a/spark-common/src/main/java/me/lucko/spark/sampler/ThreadGrouper.java b/spark-common/src/main/java/me/lucko/spark/sampler/ThreadGrouper.java
index 031d7c1..3f1be33 100644
--- a/spark-common/src/main/java/me/lucko/spark/sampler/ThreadGrouper.java
+++ b/spark-common/src/main/java/me/lucko/spark/sampler/ThreadGrouper.java
@@ -63,4 +63,10 @@ public interface ThreadGrouper {
}
};
+ /**
+ * Implementation of {@link ThreadGrouper} which groups all threads as one, under
+ * the name "All".
+ */
+ ThreadGrouper AS_ONE = threadName -> "All";
+
}