--- /dev/null 2016-10-25 08:46:44.038854975 +0200
+++ new/src/share/classes/sun/evtracing/EventTracing.java 2016-10-25 10:40:31.962792605 +0200
@@ -0,0 +1,114 @@
+/*
+ * 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;
+
+import java.util.HashMap;
+import java.util.Map;
+
+public class EventTracing {
+
+ private static final EventTracing instance;
+
+ public static EventTracing getEventTracing() {
+ // TODO: check permissions
+ return instance;
+ }
+
+ public static boolean isEnabled() {
+ return instance != null;
+ }
+
+ private StatisticsProvider statisticsProvider;
+
+ private EventTracing() {
+ }
+
+ public native long queueCount(long queueHandle);
+
+ public native TraceBuffer dequeueBuffer(long queueHandle, boolean shouldBlock);
+
+ public native void enqueueBuffer(long queueHandle, long bufferHandle);
+
+ public native void resetAndEnqueueBuffer(long queueHandle, long bufferHandle);
+
+ public native void freeBuffer(long bufferHandle);
+
+ public native void writeGroupEvent(long parkGlobalSeqBeginRef, Object source);
+
+ public native String getConfiguration();
+
+ public Map getStatistics() {
+ Map map = new HashMap() {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public Double put(String key, Double value) {
+ Double old = super.put(key, value);
+ assert old == null : "overwriting not permitted";
+ return old;
+ }
+ };
+
+ putNativeStatistics(map);
+ if (statisticsProvider != null) {
+ statisticsProvider.putStatistics(map);
+ }
+ return map;
+ }
+
+ public void resetStatistics() {
+ resetNativeStatistics();
+ if (statisticsProvider != null) {
+ statisticsProvider.resetStatistics();
+ }
+ }
+
+ public void setStatisticsProvider(StatisticsProvider provider) {
+ assert statisticsProvider == null : "already set";
+ this.statisticsProvider = provider;
+ }
+
+ private native void putNativeStatistics(Map map);
+
+ private native void resetNativeStatistics();
+
+ public native void reclaimBuffers(boolean waitUntilProcessed);
+
+ public void resetMetadata() {
+ resetNativeMetadata();
+ }
+
+ private native void resetNativeMetadata();
+
+
+ private static native boolean registerNatives();
+
+ static {
+ if (registerNatives()) {
+ instance = new EventTracing();
+ } else {
+ instance = null;
+ }
+ }
+}