--- /dev/null 2016-10-25 08:46:44.038854975 +0200 +++ new/src/share/classes/sun/evtracing/processing/statistics/ParkBlockerNopAnalyser.java 2016-10-25 10:40:50.070804597 +0200 @@ -0,0 +1,80 @@ +/* + * Copyright (c) 2014, 2015, Dynatrace and/or its affiliates. All rights reserved. + * + * This file is part of the Lock Contention Tracing Subsystem for the HotSpot + * Virtual Machine, which is developed at Christian Doppler Laboratory on + * Monitoring and Evolution of Very-Large-Scale Software Systems. Please + * contact us at if you need additional information + * or have any questions. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work. If not, see . + * + */ +package sun.evtracing.processing.statistics; + +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import sun.evtracing.parser.metadata.JavaStack; +import sun.evtracing.parser.metadata.JavaThread; +import sun.evtracing.processing.statistics.aggregator.ContentionProcessor; +import sun.evtracing.processing.statistics.metadata.Contention; +import sun.evtracing.processing.statistics.metadata.Group; +import sun.evtracing.processing.statistics.metadata.JavaObjectStack; +import sun.evtracing.processing.statistics.metadata.ParkEventTuple; + +public class ParkBlockerNopAnalyser implements ParkBlockerAnalyser { + private final ContentionProcessor cproc; + + private final Pattern[] condWaitPatterns; + + public ParkBlockerNopAnalyser(ContentionProcessor cproc, Pattern[] condWaitPatterns) { + this.cproc = cproc; + this.condWaitPatterns = condWaitPatterns; + } + + @Override + public void begin(ParkEventTuple tuple) { + // nothing + } + + @Override + public void end(ParkEventTuple tuple) { + // nothing + } + + @Override + public void finish(ParkEventTuple tuple) { + JavaThread contendingThread = tuple.end().thread().metadata(); + JavaThread ownerThread = JavaThread.UNKNOWN; + JavaStack contendingSite = tuple.begin().stack().metadata(); + JavaStack ownerSite = JavaStack.UNKNOWN; + JavaObjectStack blocker = tuple.blocker(); + long startTime = tuple.begin().timestamp(); + long duration = tuple.end().timestamp() - startTime; + + Group group = Group.JavaUtilConcurrent; + if (condWaitPatterns != null) { + for (Pattern p : condWaitPatterns) { + Matcher m = p.matcher(blocker.top().clazz().toString()); + if (m.matches()) { + group = Group.JavaUtilConcurrentConditionalWaiting; + break; + } + } + } + + cproc.submit(new Contention(group, contendingThread, ownerThread, contendingSite, ownerSite, blocker, startTime, duration)); + } + +}