changeset 1407:c888a60d747f

7901904: perfasm should handle the absence of events gracefully
author shade
date Fri, 24 Feb 2017 13:48:24 +0100
parents ed0a5f40acfb
children f65a83dc54af
files jmh-core/src/main/java/org/openjdk/jmh/profile/AbstractPerfAsmProfiler.java
diffstat 1 files changed, 6 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/jmh-core/src/main/java/org/openjdk/jmh/profile/AbstractPerfAsmProfiler.java	Wed Jan 18 14:38:04 2017 +0100
+++ b/jmh-core/src/main/java/org/openjdk/jmh/profile/AbstractPerfAsmProfiler.java	Fri Feb 24 13:48:24 2017 +0100
@@ -672,7 +672,7 @@
         List<Region> regions = new ArrayList<>();
 
         SortedSet<Long> allAddrs = events.getAllAddresses();
-        for (Interval intv : figureHotIntervals(allAddrs, allAddrs.first(), allAddrs.last())) {
+        for (Interval intv : figureHotIntervals(allAddrs)) {
             SortedSet<Long> eventfulAddrs = allAddrs.subSet(intv.src, intv.dst + 1);
 
             List<ASMLine> regionLines = asms.getLines(intv.src, intv.dst, printMargin);
@@ -705,10 +705,12 @@
     }
 
 
-    private List<Interval> figureHotIntervals(SortedSet<Long> allAddrs, long from, long to) {
+    private List<Interval> figureHotIntervals(SortedSet<Long> addrs) {
+        if (addrs.isEmpty()) {
+            return Collections.emptyList();
+        }
+
         List<Interval> intervals = new ArrayList<>();
-        SortedSet<Long> addrs = allAddrs.subSet(from, to);
-
         long begAddr = addrs.first();
         long lastAddr = addrs.first();
         for (long addr : addrs) {