aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuck <git@lucko.me>2022-11-16 21:41:04 +0000
committerLuck <git@lucko.me>2022-11-16 21:41:04 +0000
commite52ea7dbac9df3d610aef2ab3924fa9410d167e3 (patch)
tree9ae0bc66e21a99896b03abf3537cbd2a9cb92431
parentd12f13f7e3024c632f181473711290c88de8cfde (diff)
downloadspark-e52ea7dbac9df3d610aef2ab3924fa9410d167e3.tar.gz
spark-e52ea7dbac9df3d610aef2ab3924fa9410d167e3.tar.bz2
spark-e52ea7dbac9df3d610aef2ab3924fa9410d167e3.zip
Fix exception from zero thread id (#262)
-rw-r--r--spark-common/src/main/java/me/lucko/spark/common/sampler/async/AsyncProfilerJob.java2
-rw-r--r--spark-common/src/main/java/me/lucko/spark/common/sampler/async/jfr/JfrReader.java4
2 files changed, 3 insertions, 3 deletions
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 1310e97..db1808c 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
@@ -249,7 +249,7 @@ public class AsyncProfilerJob {
duration = TimeUnit.NANOSECONDS.toMicros(sample.time - samples.get(i - 1).time);
}
- String threadName = reader.threads.get(sample.tid);
+ String threadName = reader.threads.get((long) sample.tid);
if (threadName == null) {
continue;
}
diff --git a/spark-common/src/main/java/me/lucko/spark/common/sampler/async/jfr/JfrReader.java b/spark-common/src/main/java/me/lucko/spark/common/sampler/async/jfr/JfrReader.java
index e0cc4e9..ea4985e 100644
--- a/spark-common/src/main/java/me/lucko/spark/common/sampler/async/jfr/JfrReader.java
+++ b/spark-common/src/main/java/me/lucko/spark/common/sampler/async/jfr/JfrReader.java
@@ -51,7 +51,7 @@ public class JfrReader implements Closeable {
public final Dictionary<JfrClass> types = new Dictionary<>();
public final Map<String, JfrClass> typesByName = new HashMap<>();
- public final Dictionary<String> threads = new Dictionary<>();
+ public final Map<Long, String> threads = new HashMap<>(); // spark
public final Dictionary<ClassRef> classes = new Dictionary<>();
public final Dictionary<byte[]> symbols = new Dictionary<>();
public final Dictionary<MethodRef> methods = new Dictionary<>();
@@ -324,7 +324,7 @@ public class JfrReader implements Closeable {
}
private void readThreads(boolean hasGroup) {
- int count = threads.preallocate(getVarint());
+ int count = getVarint(); //threads.preallocate(getVarint());
for (int i = 0; i < count; i++) {
long id = getVarlong();
String osName = getString();