--- /dev/null 2016-10-25 08:46:44.038854975 +0200 +++ new/src/share/classes/sun/evtracing/parser/ThreadParkBeginEvent.java 2016-10-25 10:40:38.452796902 +0200 @@ -0,0 +1,100 @@ +/* + * 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.parser; + +import sun.evtracing.parser.TraceEventType; +import sun.evtracing.parser.metadata.JavaClass; +import sun.evtracing.parser.metadata.JavaStack; +import sun.evtracing.parser.metadata.MetadataRef; +import sun.evtracing.processing.TraceEventHandler; + +public class ThreadParkBeginEvent extends GlobalSequenceOrderedEvent { + + public static final TraceEventType EVENT_TYPE = TraceEventType.ThreadParkBegin; + + public static ThreadParkBeginEvent parse(TraceReader reader, long thread) { + TraceEventType eventType = reader.readEventType(); + assert eventType == EVENT_TYPE; + long timestamp = reader.readTimestamp(); + long sequenceNumber = reader.readSequenceNumber(); + int blockerObject = reader.readObject(); + MetadataRef clazz = reader.readClass(); + MetadataRef stack = reader.readStack(); + int nestingLevel = reader.readUnsignedByte(); + boolean isAbsolute = reader.readBoolean(); + long parkTime = reader.readDuration(); + return new ThreadParkBeginEvent(thread, timestamp, sequenceNumber, blockerObject, clazz, stack, nestingLevel, isAbsolute, parkTime); + } + + private final int blockerObject; + private final MetadataRef clazz; + private final MetadataRef stack; + private final int nestingLevel; + private final boolean isAbsolute; + private final long parkTime; + + protected ThreadParkBeginEvent(long thread, long timestamp, long sequenceNumber, int blockerObject, MetadataRef clazz, MetadataRef stack, int nestingLevel, boolean isAbsolute, long parkTime) { + super(thread, timestamp, sequenceNumber); + this.blockerObject = blockerObject; + this.clazz = clazz; + this.stack = stack; + this.nestingLevel = nestingLevel; + this.isAbsolute = isAbsolute; + this.parkTime = parkTime; + } + + @Override + public TraceEventType type() { + return EVENT_TYPE; + } + + public int blockerObject() { + return blockerObject; + } + + public MetadataRef clazz() { + return clazz; + } + + public MetadataRef stack() { + return stack; + } + + public int nestingLevel() { + return nestingLevel; + } + + public boolean isAbsolute() { + return isAbsolute; + } + + public long parkTime() { + return parkTime; + } + + @Override + public void accept(TraceEventHandler handler) { + handler.threadParkBegin(this); + } +}