diff options
author | Luck <git@lucko.me> | 2022-11-16 21:41:04 +0000 |
---|---|---|
committer | Luck <git@lucko.me> | 2022-11-16 21:41:04 +0000 |
commit | e52ea7dbac9df3d610aef2ab3924fa9410d167e3 (patch) | |
tree | 9ae0bc66e21a99896b03abf3537cbd2a9cb92431 | |
parent | d12f13f7e3024c632f181473711290c88de8cfde (diff) | |
download | spark-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.java | 2 | ||||
-rw-r--r-- | spark-common/src/main/java/me/lucko/spark/common/sampler/async/jfr/JfrReader.java | 4 |
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(); |