changeset 929:6cc1450c6a0f

profilers: perfasm, warn about low event count.
author shade
date Thu, 24 Jul 2014 00:21:17 +0400
parents 0e44461d621b
children efb7e106292a
files jmh-core/src/main/java/org/openjdk/jmh/profile/LinuxPerfAsmProfiler.java
diffstat 1 files changed, 12 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/jmh-core/src/main/java/org/openjdk/jmh/profile/LinuxPerfAsmProfiler.java	Wed Jul 23 21:33:19 2014 +0400
+++ b/jmh-core/src/main/java/org/openjdk/jmh/profile/LinuxPerfAsmProfiler.java	Thu Jul 24 00:21:17 2014 +0400
@@ -482,6 +482,18 @@
             }
         }
 
+        {
+            int sum = 0;
+            for (String ev : events.totalCounts.keySet()) {
+                sum += events.totalCounts.get(ev);
+            }
+
+            if (sum < 1000) {
+                pw.println("WARNING: The perf event count is suspiciously low (" + sum + "). The performance data might be\n" +
+                        "inaccurate or misleading. Try to do the profiling again, or tune up the sampling frequency.");
+            }
+        }
+
         /**
          * Print perf output, if needed:
          */