diff --git a/.classpath b/.classpath index a283caa2dad0685df6e712d62163b902ab9738b1..f2ff7a566477c5392519d92872b6ac4614b5722c 100644 --- a/.classpath +++ b/.classpath @@ -8,5 +8,6 @@ </attributes> </classpathentry> <classpathentry kind="lib" path="lib/trove-3.0.3.jar"/> + <classpathentry combineaccessrules="false" kind="src" path="/common-monitoring"/> <classpathentry kind="output" path="bin"/> </classpath> diff --git a/src/explorviz/hpc_monitoring/byteaccess/UnsafeBits.java b/src/explorviz/hpc_monitoring/byteaccess/UnsafeBits.java deleted file mode 100644 index 8ce42a07f961129e7202058fb73cf470b1d0ea32..0000000000000000000000000000000000000000 --- a/src/explorviz/hpc_monitoring/byteaccess/UnsafeBits.java +++ /dev/null @@ -1,38 +0,0 @@ -package explorviz.hpc_monitoring.byteaccess; - -import java.lang.reflect.Field; -import sun.misc.Unsafe; - -public class UnsafeBits { - private static final Unsafe unsafe; - static { - try { - final Field field = Unsafe.class.getDeclaredField("theUnsafe"); - field.setAccessible(true); - unsafe = (Unsafe) field.get(null); - } - catch (final Exception e) { - throw new RuntimeException(e); - } - } - - private static final long byteArrayOffset = unsafe.arrayBaseOffset(byte[].class); - - public static final void putInt(final byte[] buffer, final int pos, - final int value) { - unsafe.putInt(buffer, byteArrayOffset + pos, value); - } - - public static final int getInt(final byte[] buffer, final int pos) { - return unsafe.getInt(buffer, byteArrayOffset + pos); - } - - public static final void putLong(final byte[] buffer, final int pos, - final long value) { - unsafe.putLong(buffer, byteArrayOffset + pos, value); - } - - public static final long getLong(final byte[] buffer, final int pos) { - return unsafe.getLong(buffer, byteArrayOffset + pos); - } -} \ No newline at end of file diff --git a/src/explorviz/hpc_monitoring/connector/TCPConnector.java b/src/explorviz/hpc_monitoring/connector/TCPConnector.java index 4719002ce510436420c42f34f5751b7e895ee73e..f28ea5c19a1bd399b63dea0f97a37e30ee9a74ee 100644 --- a/src/explorviz/hpc_monitoring/connector/TCPConnector.java +++ b/src/explorviz/hpc_monitoring/connector/TCPConnector.java @@ -3,83 +3,81 @@ package explorviz.hpc_monitoring.connector; import java.io.BufferedOutputStream; import java.io.IOException; import java.net.Socket; + import com.lmax.disruptor.EventHandler; -import explorviz.hpc_monitoring.reader.ByteArrayEvent; + +import explorviz.hpc_monitoring.disruptor.ByteArrayEvent; public class TCPConnector implements EventHandler<ByteArrayEvent> { - private static final int MESSAGE_BUFFER_SIZE = 65536; + private static final int MESSAGE_BUFFER_SIZE = 65536; - private String providerUrl; - private final int providerPort; + private String providerUrl; + private final int providerPort; - private Socket socket; + private Socket socket; - private BufferedOutputStream bufferedOutputStream; + private BufferedOutputStream bufferedOutputStream; - public TCPConnector(final String providerUrl, final int providerPort) { - this.providerUrl = providerUrl; - this.providerPort = providerPort; + public TCPConnector(final String providerUrl, final int providerPort) { + this.providerUrl = providerUrl; + this.providerPort = providerPort; - try { - connect(providerUrl); - } - catch (final IOException e) { - e.printStackTrace(); - } - } + try { + connect(providerUrl); + } catch (final IOException e) { + e.printStackTrace(); + } + } - private void connect(final String provider) throws IOException { - socket = new Socket(providerUrl, providerPort); - bufferedOutputStream = new BufferedOutputStream( - socket.getOutputStream(), MESSAGE_BUFFER_SIZE); - } + private void connect(final String provider) throws IOException { + socket = new Socket(providerUrl, providerPort); + bufferedOutputStream = new BufferedOutputStream( + socket.getOutputStream(), MESSAGE_BUFFER_SIZE); + } - public final void sendMessage(final byte[] message, final int length) { - try { - bufferedOutputStream.write(message, 0, length); - // if (endOfBatch) { - // bufferedOutputStream.flush(); - // } - } - catch (final IOException e) { - e.printStackTrace(); - } - } + public final void sendMessage(final byte[] message, final int length) { + try { + bufferedOutputStream.write(message, 0, length); + // if (endOfBatch) { + // bufferedOutputStream.flush(); + // } + } catch (final IOException e) { + e.printStackTrace(); + } + } - public final void cleanup() { - disconnect(); - } + public final void cleanup() { + disconnect(); + } - private void disconnect() { - if (socket.isConnected()) { - try { - socket.close(); - } - catch (final IOException e) { - System.out.println(e.toString()); - } - } - } + private void disconnect() { + if (socket.isConnected()) { + try { + socket.close(); + } catch (final IOException e) { + System.out.println(e.toString()); + } + } + } - public void setProvider(final String provider) { - synchronized (this) { - if (!provider.equals(providerUrl)) { - disconnect(); - try { - connect(provider); - providerUrl = provider; - notifyAll(); - } - catch (final IOException e) { - e.printStackTrace(); - } - } - } - } + public void setProvider(final String provider) { + synchronized (this) { + if (!provider.equals(providerUrl)) { + disconnect(); + try { + connect(provider); + providerUrl = provider; + notifyAll(); + } catch (final IOException e) { + e.printStackTrace(); + } + } + } + } - @Override - public void onEvent(final ByteArrayEvent event, final long sequence, - final boolean endOfBatch) throws Exception { - sendMessage(event.getValue(), event.getLength()); - } + @Override + public void onEvent(final ByteArrayEvent event, final long sequence, + final boolean endOfBatch) throws Exception { + sendMessage(event.getValue(), event.getLength()); + } } diff --git a/src/explorviz/hpc_monitoring/filter/counting/CountingThroughputFilter.java b/src/explorviz/hpc_monitoring/filter/counting/CountingThroughputFilter.java deleted file mode 100644 index 5d0c410e51cd1339bc32a8978d71136a6498b999..0000000000000000000000000000000000000000 --- a/src/explorviz/hpc_monitoring/filter/counting/CountingThroughputFilter.java +++ /dev/null @@ -1,57 +0,0 @@ -package explorviz.hpc_monitoring.filter.counting; - -public final class CountingThroughputFilter { - private volatile long firstIntervalStart = -1; - - private final long intervalSize; - - private int currentCountForCurrentInterval = 0; - - private volatile long firstTimestampInCurrentInterval = -1; - private volatile long lastTimestampInCurrentInterval = -1; - private final String beforeOut; - - public CountingThroughputFilter(final String beforeOut) { - this.beforeOut = beforeOut; - intervalSize = 1 * 1000 * 1000 * 1000; - } - - private void processEvent(final Object event, final long currentTime, - final int increment) { - final long startOfTimestampsInterval = computeFirstTimestampInInterval(currentTime); - final long endOfTimestampsInterval = computeLastTimestampInInterval(currentTime); - - if (endOfTimestampsInterval > lastTimestampInCurrentInterval) { - if (firstTimestampInCurrentInterval >= 0) { - final long currentCount = currentCountForCurrentInterval; - System.out.println(beforeOut + ": " + currentCount); - } - - firstTimestampInCurrentInterval = startOfTimestampsInterval; - lastTimestampInCurrentInterval = endOfTimestampsInterval; - currentCountForCurrentInterval = 0; - } - - currentCountForCurrentInterval += increment; - } - - public final void inputObjects(final Object object) { - processEvent(object, System.currentTimeMillis() * 1000 * 1000, 1); - } - - public final void inputObjectsCount(final int object) { - processEvent(object, System.currentTimeMillis() * 1000 * 1000, object); - } - - private long computeFirstTimestampInInterval(final long timestamp) { - if (firstIntervalStart == -1) { - firstIntervalStart = timestamp; - } - - return ((timestamp / intervalSize) * intervalSize); - } - - private long computeLastTimestampInInterval(final long timestamp) { - return ((((timestamp / intervalSize) + 1) * intervalSize) - 1); - } -} diff --git a/src/explorviz/hpc_monitoring/filter/reconstruction/TraceReconstructionFilter.java b/src/explorviz/hpc_monitoring/filter/reconstruction/TraceReconstructionFilter.java index 3aaa1f0cd9b1acffa0546840e47bb6f843fd7124..b4c8060d5c1d421848e34f767eed2d922d779d82 100644 --- a/src/explorviz/hpc_monitoring/filter/reconstruction/TraceReconstructionFilter.java +++ b/src/explorviz/hpc_monitoring/filter/reconstruction/TraceReconstructionFilter.java @@ -7,10 +7,10 @@ import com.lmax.disruptor.EventHandler; import com.lmax.disruptor.RingBuffer; import com.lmax.disruptor.dsl.Disruptor; +import explorviz.hpc_monitoring.disruptor.RecordEvent; import explorviz.hpc_monitoring.filter.counting.CountingThroughputFilter; import explorviz.hpc_monitoring.filter.reduction.TracePatternSummarizationFilter; import explorviz.hpc_monitoring.reader.IPeriodicTimeSignalReceiver; -import explorviz.hpc_monitoring.reader.RecordEvent; import explorviz.hpc_monitoring.reader.TimeReader; import explorviz.hpc_monitoring.record.IRecord; import explorviz.hpc_monitoring.record.Trace; @@ -71,8 +71,10 @@ public final class TraceReconstructionFilter implements } private void sendOutInvalidTrace(final Trace trace) { - counter.inputObjects(trace); - putInRingBuffer(trace); // TODO + // counter.inputObjects(trace); + // putInRingBuffer(trace); // TODO + System.out.println("Invalid trace: " + + trace.getTraceMetadata().getTraceId()); } private void putInRingBuffer(final IRecord record) { diff --git a/src/explorviz/hpc_monitoring/filter/reduction/TracePatternSummarizationFilter.java b/src/explorviz/hpc_monitoring/filter/reduction/TracePatternSummarizationFilter.java index 7cde13d8fc81413d562cdbe8f0b293ba5ca74606..29a5b016f6d37cc5438ee838ee99b60410ab781b 100644 --- a/src/explorviz/hpc_monitoring/filter/reduction/TracePatternSummarizationFilter.java +++ b/src/explorviz/hpc_monitoring/filter/reduction/TracePatternSummarizationFilter.java @@ -12,9 +12,9 @@ import com.lmax.disruptor.EventHandler; import com.lmax.disruptor.RingBuffer; import com.lmax.disruptor.dsl.Disruptor; +import explorviz.hpc_monitoring.disruptor.RecordEvent; import explorviz.hpc_monitoring.filter.counting.CountingThroughputFilter; import explorviz.hpc_monitoring.reader.IPeriodicTimeSignalReceiver; -import explorviz.hpc_monitoring.reader.RecordEvent; import explorviz.hpc_monitoring.reader.TimeReader; import explorviz.hpc_monitoring.record.IRecord; import explorviz.hpc_monitoring.record.Trace; diff --git a/src/explorviz/hpc_monitoring/reader/ByteArrayEvent.java b/src/explorviz/hpc_monitoring/reader/ByteArrayEvent.java deleted file mode 100644 index 959decea72a3fbfa142c50cdd15c4697914c621c..0000000000000000000000000000000000000000 --- a/src/explorviz/hpc_monitoring/reader/ByteArrayEvent.java +++ /dev/null @@ -1,36 +0,0 @@ -package explorviz.hpc_monitoring.reader; - -import com.lmax.disruptor.EventFactory; - -/** - * WARNING: This is a mutable object which will be recycled by the RingBuffer. - * You must take a copy of data it holds - * before the framework recycles it. - */ -public final class ByteArrayEvent { - private byte[] value; - private int length; - - public final byte[] getValue() { - return value; - } - - public void setValue(final byte[] value) { - this.value = value; - } - - public final int getLength() { - return length; - } - - public void setLength(final int length) { - this.length = length; - } - - public final static EventFactory<ByteArrayEvent> EVENT_FACTORY = new EventFactory<ByteArrayEvent>() { - @Override - public ByteArrayEvent newInstance() { - return new ByteArrayEvent(); - } - }; -} \ No newline at end of file diff --git a/src/explorviz/hpc_monitoring/reader/IPeriodicTimeSignalReceiver.java b/src/explorviz/hpc_monitoring/reader/IPeriodicTimeSignalReceiver.java deleted file mode 100644 index d145afb859a81200e4e95ed26f28e1df61f995a7..0000000000000000000000000000000000000000 --- a/src/explorviz/hpc_monitoring/reader/IPeriodicTimeSignalReceiver.java +++ /dev/null @@ -1,7 +0,0 @@ -package explorviz.hpc_monitoring.reader; - -public interface IPeriodicTimeSignalReceiver { - - void periodicTimeSignal(long timestamp); - -} diff --git a/src/explorviz/hpc_monitoring/reader/MessageDistributer.java b/src/explorviz/hpc_monitoring/reader/MessageDistributer.java index c2c0a985b0cda65556ce6a3bae3fbb7f26df2dde..43dba29e9e1a7970df554e0621dabe6b630557d2 100644 --- a/src/explorviz/hpc_monitoring/reader/MessageDistributer.java +++ b/src/explorviz/hpc_monitoring/reader/MessageDistributer.java @@ -10,6 +10,8 @@ import com.lmax.disruptor.RingBuffer; import com.lmax.disruptor.dsl.Disruptor; import explorviz.hpc_monitoring.byteaccess.UnsafeBits; +import explorviz.hpc_monitoring.disruptor.ByteArrayEvent; +import explorviz.hpc_monitoring.disruptor.RecordEvent; import explorviz.hpc_monitoring.filter.counting.CountingThroughputFilter; import explorviz.hpc_monitoring.filter.reconstruction.TraceReconstructionFilter; import explorviz.hpc_monitoring.record.IRecord; @@ -30,7 +32,7 @@ public class MessageDistributer implements EventHandler<ByteArrayEvent> { private final List<byte[]> waitingForStringMessages = new ArrayList<byte[]>( 1024); - private final byte[] unreadBytes = null; + private byte[] unreadBytes = null; private final RingBuffer<RecordEvent> ringBuffer; @@ -50,26 +52,26 @@ public class MessageDistributer implements EventHandler<ByteArrayEvent> { @Override public void onEvent(final ByteArrayEvent event, final long sequence, final boolean endOfBatch) throws Exception { - counter.inputObjectsCount(event.getLength() / 28); - - // final byte[] received = event.getValue(); - // final int receivedLength = event.getLength(); - // - // byte[] messages = received; - // int messagesLength = receivedLength; - // - // if (unreadBytes != null) { - // final int unreadBytesLength = unreadBytes.length; - // - // messagesLength += unreadBytesLength; - // messages = new byte[messagesLength]; - // - // System.arraycopy(unreadBytes, 0, messages, 0, unreadBytesLength); - // System.arraycopy(received, 0, messages, unreadBytesLength, - // receivedLength); - // } - // - // unreadBytes = messagesfromByteArray(messages, messagesLength); + // counter.inputObjectsCount(event.getLength()); + + final byte[] received = event.getValue(); + final int receivedLength = event.getLength(); + + byte[] messages = received; + int messagesLength = receivedLength; + + if (unreadBytes != null) { + final int unreadBytesLength = unreadBytes.length; + + messagesLength += unreadBytesLength; + messages = new byte[messagesLength]; + + System.arraycopy(unreadBytes, 0, messages, 0, unreadBytesLength); + System.arraycopy(received, 0, messages, unreadBytesLength, + receivedLength); + } + + unreadBytes = messagesfromByteArray(messages, messagesLength); } private byte[] messagesfromByteArray(final byte[] b, final int readSize) { diff --git a/src/explorviz/hpc_monitoring/reader/RecordEvent.java b/src/explorviz/hpc_monitoring/reader/RecordEvent.java deleted file mode 100644 index f2312eff38f72901f2f57fdb071116250bf6e1cf..0000000000000000000000000000000000000000 --- a/src/explorviz/hpc_monitoring/reader/RecordEvent.java +++ /dev/null @@ -1,28 +0,0 @@ -package explorviz.hpc_monitoring.reader; - -import com.lmax.disruptor.EventFactory; -import explorviz.hpc_monitoring.record.IRecord; - -/** - * WARNING: This is a mutable object which will be recycled by the RingBuffer. - * You must take a copy of data it holds - * before the framework recycles it. - */ -public final class RecordEvent { - private IRecord value; - - public final IRecord getValue() { - return value; - } - - public void setValue(final IRecord value) { - this.value = value; - } - - public final static EventFactory<RecordEvent> EVENT_FACTORY = new EventFactory<RecordEvent>() { - @Override - public RecordEvent newInstance() { - return new RecordEvent(); - } - }; -} \ No newline at end of file diff --git a/src/explorviz/hpc_monitoring/reader/TCPReader.java b/src/explorviz/hpc_monitoring/reader/TCPReader.java index 5540f9c131b3d428cee50199e4645561b0ccfa82..2bc2861a8a405e111da4da8e932766f6143b09da 100644 --- a/src/explorviz/hpc_monitoring/reader/TCPReader.java +++ b/src/explorviz/hpc_monitoring/reader/TCPReader.java @@ -12,8 +12,11 @@ import com.lmax.disruptor.EventHandler; import com.lmax.disruptor.RingBuffer; import com.lmax.disruptor.dsl.Disruptor; +import explorviz.hpc_monitoring.disruptor.ByteArrayEvent; +import explorviz.hpc_monitoring.disruptor.RecordEvent; + public final class TCPReader { - private static final int MESSAGE_BUFFER_SIZE = 65536 * 2; + private static final int MESSAGE_BUFFER_SIZE = 65536; private final int listeningPort; @@ -29,7 +32,7 @@ public final class TCPReader { throws IllegalArgumentException { this.listeningPort = listeningPort; - buffer = ByteBuffer.allocate(MESSAGE_BUFFER_SIZE); + buffer = ByteBuffer.allocateDirect(MESSAGE_BUFFER_SIZE); final ExecutorService exec = Executors.newCachedThreadPool(); final Disruptor<ByteArrayEvent> disruptor = new Disruptor<ByteArrayEvent>( @@ -50,10 +53,10 @@ public final class TCPReader { final SocketChannel socketChannel = serversocket.accept(); int readBytes = 0; while ((readBytes = socketChannel.read(buffer)) != -1) { - // final byte[] messages = new byte[MESSAGE_BUFFER_SIZE]; - // System.arraycopy(buffer.array(), 0, messages, 0, - // buffer.position()); - putInRingBuffer(null, readBytes); + final byte[] messages = new byte[readBytes]; + buffer.flip(); + buffer.get(messages, 0, readBytes); + putInRingBuffer(messages, readBytes); buffer.clear(); } diff --git a/src/explorviz/hpc_monitoring/reader/TimeReader.java b/src/explorviz/hpc_monitoring/reader/TimeReader.java deleted file mode 100644 index 19b2897a0bb09a393ac8c78e13d5a0da3fee0616..0000000000000000000000000000000000000000 --- a/src/explorviz/hpc_monitoring/reader/TimeReader.java +++ /dev/null @@ -1,34 +0,0 @@ -package explorviz.hpc_monitoring.reader; - -import java.util.concurrent.ScheduledExecutorService; -import java.util.concurrent.ScheduledThreadPoolExecutor; -import java.util.concurrent.TimeUnit; - -public final class TimeReader { - private final long period; - - private final ScheduledExecutorService executorService; - - private final IPeriodicTimeSignalReceiver receiver; - - public TimeReader(final long periodInMilliSec, - final IPeriodicTimeSignalReceiver receiver) { - period = periodInMilliSec; - this.receiver = receiver; - executorService = new ScheduledThreadPoolExecutor(1); - } - - public void start() { - executorService.scheduleAtFixedRate(new Runnable() { - @Override - public void run() { - sendTimestampEvent(); - } - }, 0, period, TimeUnit.MILLISECONDS); - } - - protected void sendTimestampEvent() { - final long timestamp = System.nanoTime(); - receiver.periodicTimeSignal(timestamp); - } -} diff --git a/src/explorviz/hpc_monitoring/record/IRecord.java b/src/explorviz/hpc_monitoring/record/IRecord.java deleted file mode 100644 index 1350246777a8093868efb5dc9c35efeefd5507db..0000000000000000000000000000000000000000 --- a/src/explorviz/hpc_monitoring/record/IRecord.java +++ /dev/null @@ -1,5 +0,0 @@ -package explorviz.hpc_monitoring.record; - -public interface IRecord { - -} diff --git a/src/explorviz/hpc_monitoring/record/RuntimeStatisticInformation.java b/src/explorviz/hpc_monitoring/record/RuntimeStatisticInformation.java deleted file mode 100644 index b87c75ebf64a6c385c5492a08cc41d7308e3a352..0000000000000000000000000000000000000000 --- a/src/explorviz/hpc_monitoring/record/RuntimeStatisticInformation.java +++ /dev/null @@ -1,119 +0,0 @@ -/*************************************************************************** - * Copyright 2013 Kieker Project (http://kieker-monitoring.net) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - ***************************************************************************/ - -package explorviz.hpc_monitoring.record; - -import java.io.Serializable; - -/** - * Provides methods to calculate the minimum, maximum, average and the standard - * deviation of numerical data. - * - * @author Florian Biss - * - * @since 1.8 - */ -public final class RuntimeStatisticInformation implements Serializable { - - private static final long serialVersionUID = -1628273045707598143L; - - private int count = 0; - private long min = Long.MAX_VALUE; - private long max = Long.MIN_VALUE; - - private double sum; - private double squareSum; - - public RuntimeStatisticInformation(final long runtime) { - set(runtime); - } - - public int getCount() { - return count; - } - - public long getMin() { - return min; - } - - public long getMax() { - return max; - } - - public long getAvg() { - if (count > 0) { - return (long) (sum / count); - } else { - return -1; - } - - } - - public long getStandardDeviation() { - if (count <= 2) { - return -1; - } else { - final double variance = (squareSum - ((sum * sum) / count)) - / (count - 1); - return (long) Math.sqrt(variance); - } - - } - - public double getSum() { - return sum; - } - - public double getSquareSum() { - return squareSum; - } - - public void insert(final long data) { - - count++; - final double dataDouble = data; - sum += dataDouble; - squareSum += dataDouble * dataDouble; - min = Math.min(data, min); - max = Math.max(data, max); - - } - - public void set(final long data) { - count = 1; - // final double dataDouble = data; - // sum = dataDouble; - // squareSum = dataDouble * dataDouble; - // max = data; - // min = data; - } - - public void merge(final RuntimeStatisticInformation statistics) { - - count += statistics.getCount(); - // sum += statistics.getSum(); - // squareSum += statistics.getSquareSum(); - // min = Math.min(statistics.getMin(), min); - // max = Math.max(statistics.getMax(), max); - - } - - @Override - public String toString() { - return count + ":" + min + ":" + max + ":" + sum + ":" + squareSum; - } - -} diff --git a/src/explorviz/hpc_monitoring/record/Trace.java b/src/explorviz/hpc_monitoring/record/Trace.java deleted file mode 100644 index 2f0856cffa99f7569ef5a84f81bf9dab0503cc04..0000000000000000000000000000000000000000 --- a/src/explorviz/hpc_monitoring/record/Trace.java +++ /dev/null @@ -1,89 +0,0 @@ -package explorviz.hpc_monitoring.record; - -import java.io.Serializable; -import java.util.Arrays; -import explorviz.hpc_monitoring.record.events.AbstractOperationEvent; - -public final class Trace implements Serializable, IRecord { - private static final long serialVersionUID = 8589405631073291022L; - - private final TraceMetadata traceMetadata; - private final AbstractOperationEvent[] traceEvents; - private final RuntimeStatisticInformation runtimeInformation; - - public Trace(final TraceMetadata traceMetadata, - final AbstractOperationEvent[] traceEvents) { - this.traceMetadata = traceMetadata; - this.traceEvents = traceEvents; - runtimeInformation = new RuntimeStatisticInformation(1); // TODO - } - - public TraceMetadata getTraceMetadata() { - return traceMetadata; - } - - public AbstractOperationEvent[] getTraceEvents() { - return traceEvents; - } - - @Override - public String toString() { - final StringBuilder sb = new StringBuilder(64); - sb.append(super.toString()); - sb.append("\n\tTrace: "); - sb.append(traceMetadata); - for (final AbstractOperationEvent traceEvent : traceEvents) { - sb.append("\n\t"); - sb.append(traceEvent.getClass().getSimpleName()); - sb.append(": "); - sb.append(traceEvent); - } - sb.append("\n\t"); - sb.append(runtimeInformation.getClass().getSimpleName()); - sb.append(": "); - sb.append(runtimeInformation); - sb.append('\n'); - return sb.toString(); - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = (prime * result) - + ((traceMetadata == null) ? 0 : traceMetadata.hashCode()); // NOCS - // (?:) - result = (prime * result) + Arrays.hashCode(traceEvents); - return result; - } - - @Override - public boolean equals(final Object obj) { - if (this == obj) { - return true; - } - if (obj == null) { - return false; - } - if (this.getClass() != obj.getClass()) { - return false; - } - final Trace other = (Trace) obj; - if (traceMetadata == null) { - if (other.traceMetadata != null) { - return false; - } - } - else if (!traceMetadata.equals(other.traceMetadata)) { - return false; - } - if (!Arrays.equals(traceEvents, other.traceEvents)) { - return false; - } - return true; - } - - public RuntimeStatisticInformation getRuntime() { - return runtimeInformation; - } -} diff --git a/src/explorviz/hpc_monitoring/record/TraceMetadata.java b/src/explorviz/hpc_monitoring/record/TraceMetadata.java deleted file mode 100644 index 7b1f8c723dd8ea5c71757915fefb2143eac953af..0000000000000000000000000000000000000000 --- a/src/explorviz/hpc_monitoring/record/TraceMetadata.java +++ /dev/null @@ -1,48 +0,0 @@ -package explorviz.hpc_monitoring.record; - -public class TraceMetadata implements IRecord { - public static final int BYTE_LENGTH = 8 + 4 + 8 + 4 + 4; - - public static final int CLAZZ_ID = 0; - - private final long traceId; - private final String hostname; - private final long parentTraceId; - private final int parentOrderId; - private final String application; - - public TraceMetadata(final long traceId, final String hostname, - final long parentTraceId, final int parentOrderId, - final String application) { - this.traceId = traceId; - this.hostname = hostname; - this.parentTraceId = parentTraceId; - this.parentOrderId = parentOrderId; - this.application = application; - } - - public long getLoggingTimestamp() { - throw new UnsupportedOperationException(); - } - - public long getTraceId() { - return traceId; - } - - public String getHostname() { - return hostname; - } - - public long getParentTraceId() { - return parentTraceId; - } - - public int getParentOrderId() { - return parentOrderId; - } - - public String getApplication() { - return application; - } - -} diff --git a/src/explorviz/hpc_monitoring/record/events/AbstractOperationEvent.java b/src/explorviz/hpc_monitoring/record/events/AbstractOperationEvent.java deleted file mode 100644 index 94580cfcb67f7643cae35941a5ff525e02a7eb28..0000000000000000000000000000000000000000 --- a/src/explorviz/hpc_monitoring/record/events/AbstractOperationEvent.java +++ /dev/null @@ -1,42 +0,0 @@ -package explorviz.hpc_monitoring.record.events; - -import explorviz.hpc_monitoring.record.IRecord; -import explorviz.hpc_monitoring.record.RuntimeStatisticInformation; - -public class AbstractOperationEvent implements IRecord { - private final long timestamp; - private final long traceId; - private final int orderIndex; - private final String operationSignature; - private final RuntimeStatisticInformation runtimeStatisticInformation; - - public AbstractOperationEvent(final long timestamp, final long traceId, - final int orderIndex, final String operationSignature) { - super(); - this.timestamp = timestamp; - this.traceId = traceId; - this.orderIndex = orderIndex; - this.operationSignature = operationSignature; - runtimeStatisticInformation = new RuntimeStatisticInformation(timestamp); - } - - public long getLoggingTimestamp() { - return timestamp; - } - - public long getTraceId() { - return traceId; - } - - public int getOrderIndex() { - return orderIndex; - } - - public String getOperationSignature() { - return operationSignature; - } - - public RuntimeStatisticInformation getRuntime() { - return runtimeStatisticInformation; - } -} diff --git a/src/explorviz/hpc_monitoring/record/events/normal/AfterFailedOperationEvent.java b/src/explorviz/hpc_monitoring/record/events/normal/AfterFailedOperationEvent.java deleted file mode 100644 index c6c2996a96a57307e441befe994f7c94b2d9e2e4..0000000000000000000000000000000000000000 --- a/src/explorviz/hpc_monitoring/record/events/normal/AfterFailedOperationEvent.java +++ /dev/null @@ -1,22 +0,0 @@ -package explorviz.hpc_monitoring.record.events.normal; - -import explorviz.hpc_monitoring.record.events.AbstractOperationEvent; - -public class AfterFailedOperationEvent extends AbstractOperationEvent { - public static final int BYTE_LENGTH = 8 + 8 + 4 + 4 + 4; - public static final int CLAZZ_ID = 2; - - private final String cause; - - public AfterFailedOperationEvent(final long timestamp, final long traceId, - final int orderIndex, final String operationSignature, - final String cause) { - super(timestamp, traceId, orderIndex, operationSignature); - - this.cause = cause; - } - - public String getCause() { - return cause; - } -} diff --git a/src/explorviz/hpc_monitoring/record/events/normal/AfterOperationEvent.java b/src/explorviz/hpc_monitoring/record/events/normal/AfterOperationEvent.java deleted file mode 100644 index c49ad89a130a762b442db0c396cf30a16b4ddd9e..0000000000000000000000000000000000000000 --- a/src/explorviz/hpc_monitoring/record/events/normal/AfterOperationEvent.java +++ /dev/null @@ -1,13 +0,0 @@ -package explorviz.hpc_monitoring.record.events.normal; - -import explorviz.hpc_monitoring.record.events.AbstractOperationEvent; - -public class AfterOperationEvent extends AbstractOperationEvent { - public static final int BYTE_LENGTH = 8 + 8 + 4 + 4; - public static final int CLAZZ_ID = 3; - - public AfterOperationEvent(final long timestamp, final long traceId, - final int orderIndex, final String operationSignature) { - super(timestamp, traceId, orderIndex, operationSignature); - } -} diff --git a/src/explorviz/hpc_monitoring/record/events/normal/BeforeOperationEvent.java b/src/explorviz/hpc_monitoring/record/events/normal/BeforeOperationEvent.java deleted file mode 100644 index ca971e5382c61318adde4c22caed8e9bbffceddb..0000000000000000000000000000000000000000 --- a/src/explorviz/hpc_monitoring/record/events/normal/BeforeOperationEvent.java +++ /dev/null @@ -1,13 +0,0 @@ -package explorviz.hpc_monitoring.record.events.normal; - -import explorviz.hpc_monitoring.record.events.AbstractOperationEvent; - -public class BeforeOperationEvent extends AbstractOperationEvent { - public static final int BYTE_LENGTH = 8 + 8 + 4 + 4; - public static final int CLAZZ_ID = 1; - - public BeforeOperationEvent(final long timestamp, final long traceId, - final int orderIndex, final String operationSignature) { - super(timestamp, traceId, orderIndex, operationSignature); - } -} diff --git a/src/explorviz/hpc_monitoring/record/events/remote/RemoteCallReceivedOperationEvent.java b/src/explorviz/hpc_monitoring/record/events/remote/RemoteCallReceivedOperationEvent.java deleted file mode 100644 index aea28222e7885dd28057a81416c43579e4b8a9d3..0000000000000000000000000000000000000000 --- a/src/explorviz/hpc_monitoring/record/events/remote/RemoteCallReceivedOperationEvent.java +++ /dev/null @@ -1,10 +0,0 @@ -package explorviz.hpc_monitoring.record.events.remote; - -import explorviz.hpc_monitoring.record.events.AbstractOperationEvent; - -public class RemoteCallReceivedOperationEvent extends AbstractOperationEvent { - public RemoteCallReceivedOperationEvent(final long timestamp, final long traceId, - final int orderIndex, final String operationSignature) { - super(timestamp, traceId, orderIndex, operationSignature); - } -} diff --git a/src/explorviz/hpc_monitoring/record/events/remote/RemoteCallSentOperationEvent.java b/src/explorviz/hpc_monitoring/record/events/remote/RemoteCallSentOperationEvent.java deleted file mode 100644 index f5f89b07fb99d437e51a4f9771b57257f7775f08..0000000000000000000000000000000000000000 --- a/src/explorviz/hpc_monitoring/record/events/remote/RemoteCallSentOperationEvent.java +++ /dev/null @@ -1,10 +0,0 @@ -package explorviz.hpc_monitoring.record.events.remote; - -import explorviz.hpc_monitoring.record.events.AbstractOperationEvent; - -public class RemoteCallSentOperationEvent extends AbstractOperationEvent { - public RemoteCallSentOperationEvent(final long timestamp, final long traceId, - final int orderIndex, final String operationSignature) { - super(timestamp, traceId, orderIndex, operationSignature); - } -} diff --git a/src/explorviz/worker/main/WorkerController.java b/src/explorviz/worker/main/WorkerController.java deleted file mode 100644 index bf0fda8d49080e2d9375ff0380ece94e44636ea1..0000000000000000000000000000000000000000 --- a/src/explorviz/worker/main/WorkerController.java +++ /dev/null @@ -1,11 +0,0 @@ -package explorviz.worker.main; - -import explorviz.hpc_monitoring.reader.TCPReader; - -public class WorkerController { - - public void start() { - final TCPReader tcpReader = new TCPReader(10133, null); - tcpReader.read(); - } -} diff --git a/src/explorviz/worker/main/WorkerStarter.java b/src/explorviz/worker/main/WorkerStarter.java index 3376029ff486be7460f6639ca0b60b11044328f1..983477824c09b92fd5f8e7fffeb4efdc1154d908 100644 --- a/src/explorviz/worker/main/WorkerStarter.java +++ b/src/explorviz/worker/main/WorkerStarter.java @@ -1,8 +1,11 @@ package explorviz.worker.main; +import explorviz.hpc_monitoring.reader.TCPReader; + public class WorkerStarter { - public static void main(String[] args) { - new WorkerController().start(); - } + public static void main(final String[] args) { + final TCPReader tcpReader = new TCPReader(10133, null); + tcpReader.read(); + } }