1 /*
   2  * Copyright (c) 2014, 2015, Dynatrace and/or its affiliates. All rights reserved.
   3  * 
   4  * This file is part of the Lock Contention Tracing Subsystem for the HotSpot
   5  * Virtual Machine, which is developed at Christian Doppler Laboratory on
   6  * Monitoring and Evolution of Very-Large-Scale Software Systems. Please
   7  * contact us at <http://mevss.jku.at/> if you need additional information
   8  * or have any questions.
   9  *
  10  * This code is free software; you can redistribute it and/or modify it
  11  * under the terms of the GNU General Public License version 2 only, as
  12  * published by the Free Software Foundation.
  13  *
  14  * This code is distributed in the hope that it will be useful, but WITHOUT
  15  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  16  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  17  * version 2 for more details (a copy is included in the LICENSE file that
  18  * accompanied this code).
  19  *
  20  * You should have received a copy of the GNU General Public License version
  21  * 2 along with this work. If not, see <http://www.gnu.org/licenses/>.
  22  *
  23  */ 
  24 package sun.evtracing.parser;
  25 
  26 import sun.evtracing.parser.TraceEventType;
  27 import sun.evtracing.parser.metadata.JavaClass;
  28 import sun.evtracing.parser.metadata.MetadataRef;
  29 import sun.evtracing.processing.TraceEventHandler;
  30 
  31 public class MonitorInflateEvent extends MonitorEvent {
  32 
  33         public static final TraceEventType EVENT_TYPE = TraceEventType.MonitorInflate;
  34 
  35         public static MonitorInflateEvent parse(TraceReader reader, long thread) {
  36                 TraceEventType eventType = reader.readEventType();
  37                 assert eventType == EVENT_TYPE;
  38                 long timestamp = reader.readTimestamp();
  39                 long sequenceNumber = reader.readSequenceNumber();
  40                 long monitor = reader.readMonitor();
  41                 int object = reader.readObject();
  42                 MetadataRef<JavaClass> clazz = reader.readClass();
  43                 return new MonitorInflateEvent(thread, timestamp, sequenceNumber, monitor, object, clazz);
  44         }
  45 
  46         private final int object;
  47         private final MetadataRef<JavaClass> clazz;
  48 
  49         protected MonitorInflateEvent(long thread, long timestamp, long sequenceNumber, long monitor, int object, MetadataRef<JavaClass> klass) {
  50                 super(thread, timestamp, sequenceNumber, monitor);
  51                 this.object = object;
  52                 this.clazz = klass;
  53         }
  54 
  55         @Override
  56         public TraceEventType type() {
  57                 return EVENT_TYPE;
  58         }
  59 
  60         public int object() {
  61                 return object;
  62         }
  63 
  64         public MetadataRef<JavaClass> clazz() {
  65                 return clazz;
  66         }
  67 
  68         @Override
  69         public void accept(TraceEventHandler handler) {
  70                 handler.monitorInflate(this);
  71         }
  72 }