improved multithreaded buffer and jcstresstests
This commit is contained in:
parent
33e895da1d
commit
8d16e23383
25 changed files with 2024 additions and 1388 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
|
@ -33,3 +33,6 @@ build/
|
|||
|
||||
### Mac OS ###
|
||||
.DS_Store
|
||||
|
||||
### other
|
||||
*.bin.gz
|
||||
BIN
agent/hello.snap
Normal file
BIN
agent/hello.snap
Normal file
Binary file not shown.
|
|
@ -25,6 +25,11 @@
|
|||
<artifactId>jackson-databind</artifactId>
|
||||
<version>2.16.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.xerial.snappy</groupId>
|
||||
<artifactId>snappy-java</artifactId>
|
||||
<version>1.1.10.5</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.junit.jupiter</groupId>
|
||||
<artifactId>junit-jupiter</artifactId>
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ public class CircularBufferWriter implements AutoCloseable {
|
|||
// setup of native memory ringbuffer
|
||||
var arena = Arena.ofConfined();
|
||||
var ringbufferMemory = arena.allocate(32768);
|
||||
var buffer = new CircularByteBuffer(ringbufferMemory);
|
||||
var buffer = new SingleThreadCircularByteBuffer(ringbufferMemory);
|
||||
|
||||
arena = Arena.ofConfined();
|
||||
linker = Linker.nativeLinker();
|
||||
|
|
|
|||
|
|
@ -1,69 +1,52 @@
|
|||
package com.github.shautvast.exceptional;
|
||||
|
||||
import java.lang.foreign.MemorySegment;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.IntStream;
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
import java.util.concurrent.locks.Lock;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
|
||||
/**
|
||||
* Circular buffer for variable sized byte arrays. The indices for read and write
|
||||
* are also stored in the bytebuffer, making changes visible to any non-java process that is reading.
|
||||
*
|
||||
*
|
||||
* Written for a scenario with multiple concurrent writers, and a single reader in a non-java process
|
||||
* This class itself is Not Threadsafe! It relies on MPSCBufferWriter for multithreaded writes. This queues
|
||||
* byte arrays waiting to be stored in the circular buffer. MPSCBufferWriter starts the only
|
||||
* thread that is allowed to interact with the CircularByteBuffer.
|
||||
* ..
|
||||
* *Implementation note:*
|
||||
* The last 8 bytes are reserved for the reader and writer index. The actual capacity is always `bytebuffer.capacity -8`
|
||||
* Circular bytebuffer for variable length entries, that allows concurrent writing, using CAS.
|
||||
* Multi threaded reading is provided, but:
|
||||
* - mainly for testing the reliability of the buffer
|
||||
* - relies on a ReentrantLock, preventing multiple reads at the same read index
|
||||
*/
|
||||
@SuppressWarnings("StringTemplateMigration")
|
||||
public class CircularByteBuffer {
|
||||
|
||||
private int readStartPos;
|
||||
private int writeStartPos;
|
||||
private int capacity;
|
||||
private final AtomicLong readPosition;
|
||||
private final AtomicLong writePosition;
|
||||
final ByteBuffer data;
|
||||
private final int capacity;
|
||||
private final int readStartPos;
|
||||
private final int writeStartPos;
|
||||
private final Lock readLock = new ReentrantLock();
|
||||
|
||||
/**
|
||||
* Constructs a CircularByteBuffer with the specified capacity.
|
||||
* The buffer is backed by a byte array on the java-heap. Mainly there for test purposes.
|
||||
*
|
||||
* @param capacity the capacity of the CircularByteBuffer
|
||||
*/
|
||||
// TODO implement MemorySegment as backing buffer
|
||||
public CircularByteBuffer(int capacity) {
|
||||
this.data = ByteBuffer.allocate(capacity + 8); // 8 extra for the read and write index
|
||||
initIndices();
|
||||
if (capacity > Integer.MAX_VALUE - 8 || capacity < 0) {
|
||||
throw new IllegalArgumentException("illegal capacity: " + capacity);
|
||||
}
|
||||
this.capacity = capacity; //logical cap is bytebuffer cap - 8. extra space for the read and write pointers so that non-java processes can read it there
|
||||
this.data = ByteBuffer.allocate(capacity + 8);
|
||||
|
||||
/**
|
||||
* Constructs a CircularByteBuffer with the specified capacity. The buffer is backed by native memory
|
||||
* from the MemorySegment
|
||||
*/
|
||||
public CircularByteBuffer(MemorySegment memory) {
|
||||
if (memory.byteSize() > 0xfff7) {
|
||||
throw new IllegalArgumentException("Max memory size is 65527");
|
||||
}
|
||||
this.data = memory.asByteBuffer();
|
||||
initIndices();
|
||||
}
|
||||
readStartPos = capacity; // write values after logical capacity position
|
||||
writeStartPos = capacity + 4;
|
||||
|
||||
private void initIndices() {
|
||||
this.capacity = this.data.capacity() - 8;
|
||||
readStartPos = this.capacity; // write values after logical capacity position
|
||||
writeStartPos = this.capacity + 4;
|
||||
|
||||
this.data.putInt(readStartPos, 0);
|
||||
this.data.putInt(writeStartPos, 0);
|
||||
this.readPosition = new AtomicLong();
|
||||
this.writePosition = new AtomicLong();
|
||||
setReadIndex(0);
|
||||
setWriteIndex(0);
|
||||
}
|
||||
|
||||
public boolean put(byte[] bytes) {
|
||||
boolean updatePending = true;
|
||||
while (updatePending) {
|
||||
int oldwriteIndex = writePosition.intValue();
|
||||
int writeIndex = oldwriteIndex;
|
||||
int len = bytes.length;
|
||||
int remaining;
|
||||
// check capacity for bytes to insert
|
||||
int readIndex = getReadIndex();
|
||||
int writeIndex = getWriteIndex();
|
||||
int readIndex = readPosition.intValue();
|
||||
try {
|
||||
if (writeIndex >= readIndex) {
|
||||
remaining = capacity - writeIndex + readIndex;
|
||||
|
|
@ -105,29 +88,30 @@ public class CircularByteBuffer {
|
|||
writeIndex = 0;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
if (writePosition.compareAndSet(oldwriteIndex, writeIndex)) {
|
||||
this.data.putInt(writeStartPos, writePosition.intValue());
|
||||
updatePending = false;
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
} finally {
|
||||
setWriteIndex(writeIndex);
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* The reader side is provided, for reference and testability only.
|
||||
* In practice, the reader is implemented outside of java, see rustlib module
|
||||
*/
|
||||
public byte[] get() {
|
||||
int readIndex = getReadIndex();
|
||||
int writeIndex = getWriteIndex();
|
||||
readLock.lock();
|
||||
int readIndex = readPosition.intValue();
|
||||
int writeIndex = writePosition.intValue();
|
||||
if (readIndex == writeIndex) {
|
||||
return null;
|
||||
}
|
||||
|
||||
try {
|
||||
int remainingUntilEnd = capacity - readIndex;
|
||||
int len;
|
||||
if (remainingUntilEnd == 1) {
|
||||
|
|
@ -148,55 +132,35 @@ public class CircularByteBuffer {
|
|||
}
|
||||
byte[] result = new byte[len];
|
||||
if (len <= remainingUntilEnd) {
|
||||
setReadIndex(readIndex + len);
|
||||
readLock.unlock();
|
||||
this.data.get(readIndex, result);
|
||||
readIndex += len;
|
||||
} else {
|
||||
setReadIndex(len - remainingUntilEnd);
|
||||
readLock.unlock();
|
||||
this.data.get(readIndex, result, 0, remainingUntilEnd);
|
||||
readIndex = 0;
|
||||
this.data.get(readIndex, result, remainingUntilEnd, len - remainingUntilEnd);
|
||||
readIndex += len - remainingUntilEnd;
|
||||
this.data.get(0, result, remainingUntilEnd, len - remainingUntilEnd);
|
||||
}
|
||||
return result;
|
||||
} finally {
|
||||
setReadIndex(readIndex);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
int getWriteIndex() {
|
||||
return this.data.getInt(writeStartPos);
|
||||
|
||||
void setWriteIndex(int i) {
|
||||
writePosition.set(i);
|
||||
this.data.putInt(writeStartPos, writePosition.intValue());
|
||||
}
|
||||
|
||||
void setWriteIndex(int writeIndex) {
|
||||
this.data.putInt(writeStartPos, writeIndex);
|
||||
void setReadIndex(int i) {
|
||||
readPosition.set(i);
|
||||
this.data.putInt(readStartPos, readPosition.intValue());
|
||||
}
|
||||
|
||||
int getReadIndex() {
|
||||
return this.data.getInt(readStartPos);
|
||||
return readPosition.intValue();
|
||||
}
|
||||
|
||||
void setReadIndex(int readIndex) {
|
||||
this.data.putInt(readStartPos, readIndex);
|
||||
int getWriteIndex() {
|
||||
return writePosition.intValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "CircularByteBuffer {r=" + this.data.getInt(readStartPos) +
|
||||
", w=" +
|
||||
this.data.getInt(writeStartPos) +
|
||||
", data=" +
|
||||
bytesToString(this.data.array()) +
|
||||
"}";
|
||||
}
|
||||
|
||||
public static String bytesToString(byte[] bytes) {
|
||||
if (bytes == null) {
|
||||
return "null";
|
||||
}
|
||||
return IntStream.range(0, bytes.length)
|
||||
.map(x -> bytes[x])
|
||||
.mapToObj(Integer::toString)
|
||||
.collect(Collectors.joining(",", "[", "]"));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package com.github.shautvast.exceptional;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import org.xerial.snappy.Snappy;
|
||||
|
||||
@SuppressWarnings("unused") // this code is called from the instrumented code
|
||||
public class ExceptionLogger {
|
||||
|
|
@ -12,7 +13,7 @@ public class ExceptionLogger {
|
|||
// use json for now because of ease of integration
|
||||
// would compression be useful?? use snappy?
|
||||
if (throwable != null) {
|
||||
bufferWriter.put(objectMapper.writeValueAsBytes(throwable));
|
||||
bufferWriter.put(Snappy.compress(objectMapper.writeValueAsBytes(throwable)));
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
e.printStackTrace(System.err);
|
||||
|
|
|
|||
|
|
@ -0,0 +1,202 @@
|
|||
package com.github.shautvast.exceptional;
|
||||
|
||||
import java.lang.foreign.MemorySegment;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.IntStream;
|
||||
|
||||
/**
|
||||
* Single-threaded Circular buffer for variable sized byte arrays. The indices for read and write
|
||||
* are also stored in the bytebuffer, making changes visible to any non-java process that is reading.
|
||||
*
|
||||
*
|
||||
* Written for a scenario with multiple concurrent writers, and a single reader in a non-java process
|
||||
* This class relies on MPSCBufferWriter for multithreaded writes. This class queues
|
||||
* byte arrays waiting to be stored in the circular buffer. Effectively MPSCBufferWriter starts the only
|
||||
* thread that is allowed to interact with the CircularByteBuffer.
|
||||
* ..
|
||||
* *Implementation note:*
|
||||
* The last 8 bytes are reserved for the reader and writer index. The actual capacity is always `bytebuffer.capacity -8`
|
||||
*/
|
||||
@SuppressWarnings("StringTemplateMigration")
|
||||
public class SingleThreadCircularByteBuffer {
|
||||
|
||||
private int readStartPos;
|
||||
private int writeStartPos;
|
||||
private int capacity;
|
||||
final ByteBuffer data;
|
||||
|
||||
/**
|
||||
* Constructs a CircularByteBuffer with the specified capacity.
|
||||
* The buffer is backed by a byte array on the java-heap. Mainly there for test purposes.
|
||||
*
|
||||
* @param capacity the capacity of the CircularByteBuffer
|
||||
*/
|
||||
public SingleThreadCircularByteBuffer(int capacity) {
|
||||
this.data = ByteBuffer.allocate(capacity + 8); // 8 extra for the read and write index
|
||||
initIndices();
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a CircularByteBuffer with the specified capacity. The buffer is backed by native memory
|
||||
* from the MemorySegment
|
||||
*/
|
||||
public SingleThreadCircularByteBuffer(MemorySegment memory) {
|
||||
if (memory.byteSize() > 0xfff7) {
|
||||
throw new IllegalArgumentException("Max memory size is 65527");
|
||||
}
|
||||
this.data = memory.asByteBuffer();
|
||||
initIndices();
|
||||
}
|
||||
|
||||
private void initIndices() {
|
||||
this.capacity = this.data.capacity() - 8;
|
||||
readStartPos = this.capacity; // write values after logical capacity position
|
||||
writeStartPos = this.capacity + 4;
|
||||
|
||||
this.data.putInt(readStartPos, 0);
|
||||
this.data.putInt(writeStartPos, 0);
|
||||
}
|
||||
|
||||
public boolean put(byte[] bytes) {
|
||||
int len = bytes.length;
|
||||
int remaining;
|
||||
// check capacity for bytes to insert
|
||||
int readIndex = getReadIndex();
|
||||
int writeIndex = getWriteIndex();
|
||||
try {
|
||||
if (writeIndex >= readIndex) {
|
||||
remaining = capacity - writeIndex + readIndex;
|
||||
} else {
|
||||
remaining = readIndex - writeIndex;
|
||||
}
|
||||
if (remaining < len + 2) {
|
||||
return false;
|
||||
} else {
|
||||
int remainingUntilEnd = capacity - writeIndex;
|
||||
if (remainingUntilEnd < len + 2) {
|
||||
if (remainingUntilEnd > 1) {
|
||||
// we can write the length
|
||||
this.data.putShort(writeIndex, (short) len);
|
||||
writeIndex += 2;
|
||||
remainingUntilEnd -= 2;
|
||||
if (remainingUntilEnd > 0) {
|
||||
this.data.put(writeIndex, bytes, 0, remainingUntilEnd);
|
||||
}
|
||||
writeIndex = 0;
|
||||
this.data.put(writeIndex, bytes, remainingUntilEnd, len - remainingUntilEnd);
|
||||
writeIndex += len - remainingUntilEnd;
|
||||
} else {
|
||||
// we can write only one byte of the length
|
||||
this.data.put(writeIndex, (byte) (len >> 8));
|
||||
writeIndex = 0;
|
||||
this.data.put(writeIndex, (byte) (len & 0xff));
|
||||
writeIndex += 1;
|
||||
this.data.put(writeIndex, bytes);
|
||||
writeIndex += len;
|
||||
}
|
||||
} else {
|
||||
this.data.putShort(writeIndex, (short) len);
|
||||
writeIndex += 2;
|
||||
this.data.put(writeIndex, bytes);
|
||||
writeIndex += len;
|
||||
|
||||
if (writeIndex == this.capacity) {
|
||||
writeIndex = 0;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
} finally {
|
||||
setWriteIndex(writeIndex);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The reader side is provided, for reference and testability only.
|
||||
* In practice, the reader is implemented outside of java, see rustlib module
|
||||
*/
|
||||
public byte[] get() {
|
||||
int readIndex = getReadIndex();
|
||||
int writeIndex = getWriteIndex();
|
||||
if (readIndex == writeIndex) {
|
||||
return null;
|
||||
}
|
||||
|
||||
try {
|
||||
int remainingUntilEnd = capacity - readIndex;
|
||||
int len;
|
||||
if (remainingUntilEnd == 1) {
|
||||
byte high = this.data.get(readIndex);
|
||||
readIndex = 0;
|
||||
byte low = this.data.get(readIndex);
|
||||
readIndex += 1;
|
||||
len = high << 8 | low;
|
||||
remainingUntilEnd = len;
|
||||
} else if (remainingUntilEnd == 2) {
|
||||
len = this.data.getShort(readIndex);
|
||||
readIndex = 0;
|
||||
remainingUntilEnd = 0;
|
||||
} else {
|
||||
len = this.data.getShort(readIndex);
|
||||
readIndex += 2;
|
||||
remainingUntilEnd -= 2;
|
||||
}
|
||||
byte[] result = new byte[len];
|
||||
if (len <= remainingUntilEnd) {
|
||||
this.data.get(readIndex, result);
|
||||
readIndex += len;
|
||||
} else {
|
||||
this.data.get(readIndex, result, 0, remainingUntilEnd);
|
||||
readIndex = 0;
|
||||
this.data.get(readIndex, result, remainingUntilEnd, len - remainingUntilEnd);
|
||||
readIndex += len - remainingUntilEnd;
|
||||
}
|
||||
return result;
|
||||
} finally {
|
||||
setReadIndex(readIndex);
|
||||
}
|
||||
}
|
||||
|
||||
int getWriteIndex() {
|
||||
return this.data.getInt(writeStartPos);
|
||||
}
|
||||
|
||||
void setWriteIndex(int writeIndex) {
|
||||
this.data.putInt(writeStartPos, writeIndex);
|
||||
}
|
||||
|
||||
int getReadIndex() {
|
||||
return this.data.getInt(readStartPos);
|
||||
}
|
||||
|
||||
void setReadIndex(int readIndex) {
|
||||
this.data.putInt(readStartPos, readIndex);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "CircularByteBuffer {r=" + this.data.getInt(readStartPos) +
|
||||
", w=" +
|
||||
this.data.getInt(writeStartPos) +
|
||||
", data=" +
|
||||
bytesToString(this.data.array()) +
|
||||
"}";
|
||||
}
|
||||
|
||||
public static String bytesToString(byte[] bytes) {
|
||||
if (bytes == null) {
|
||||
return "null";
|
||||
}
|
||||
return IntStream.range(0, bytes.length)
|
||||
.map(x -> bytes[x])
|
||||
.mapToObj(Integer::toString)
|
||||
.collect(Collectors.joining(",", "[", "]"));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
package com.github.shautvast.exceptional;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.xerial.snappy.Snappy;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Paths;
|
||||
|
||||
class Compress {
|
||||
|
||||
@Test
|
||||
void compress() throws IOException {
|
||||
byte[] helloWorld = Snappy.compress("{\"cause\":null,\"stackTrace\":[{\"classLoaderName\":\"app\",\"moduleName\":null,\"moduleVersion\":null,\"methodName\":\"call\",\"fileName\":\"Main.java\",\"lineNumber\":17,\"className\":\"Main\",\"nativeMethod\":false},{\"classLoaderName\":\"app\",\"moduleName\":null,\"moduleVersion\":null,\"methodName\":\"main\",\"fileName\":\"Main.java\",\"lineNumber\":7,\"className\":\"Main\",\"nativeMethod\":false}],\"message\":\"5778\",\"suppressed\":[],\"localizedMessage\":\"5778\"}");
|
||||
Files.write(Paths.get("hello.snap"), helloWorld);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -8,7 +8,7 @@ class ExceptionLoggerTest {
|
|||
|
||||
@Test
|
||||
void test() throws InterruptedException {
|
||||
for (int i = 0; i < 10; i++) {
|
||||
for (int i = 0; i < 1; i++) {
|
||||
ExceptionLogger.log(new Throwable());
|
||||
}
|
||||
Thread.sleep(Duration.ofSeconds(1));
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import org.junit.jupiter.api.Test;
|
|||
import static java.nio.charset.StandardCharsets.UTF_8;
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
class CircularByteBufferTest {
|
||||
class SingleThreadCircularByteBuffer2Test {
|
||||
|
||||
@Test
|
||||
void testPutAndGet() {
|
||||
|
|
@ -20,7 +20,7 @@ class CircularByteBufferTest {
|
|||
@Test
|
||||
void testJustGet() {
|
||||
var buffer = new CircularByteBuffer(8);
|
||||
System.out.println(CircularByteBuffer.bytesToString(buffer.get()));
|
||||
System.out.println(SingleThreadCircularByteBuffer.bytesToString(buffer.get()));
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,133 @@
|
|||
package com.github.shautvast.exceptional;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static java.nio.charset.StandardCharsets.UTF_8;
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
class SingleThreadCircularByteBufferTest {
|
||||
|
||||
@Test
|
||||
void testPutAndGet() {
|
||||
var buffer = new SingleThreadCircularByteBuffer(9);
|
||||
byte[] bytes = "hello".getBytes(UTF_8);
|
||||
boolean written = buffer.put(bytes);
|
||||
assertTrue(written);
|
||||
assertArrayEquals(bytes, buffer.get());
|
||||
assertArrayEquals(new byte[]{0, 5, 104, 101, 108, 108, 111, 0, 0, 0, 0, 0, 7, 0, 0, 0, 7}, buffer.data.array());
|
||||
}
|
||||
|
||||
@Test
|
||||
void testJustGet() {
|
||||
var buffer = new SingleThreadCircularByteBuffer(8);
|
||||
System.out.println(SingleThreadCircularByteBuffer.bytesToString(buffer.get()));
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
void testPutFitsBeforeGet() {
|
||||
var buffer = new SingleThreadCircularByteBuffer(14);
|
||||
var bytes = "hello".getBytes(UTF_8);
|
||||
buffer.setWriteIndex(7);
|
||||
buffer.setReadIndex(7);
|
||||
buffer.put(bytes);
|
||||
assertArrayEquals(new byte[]{0, 0, 0, 0, 0, 0, 0, 0, 5, 104, 101, 108, 108, 111, 0, 0, 0, 7, 0, 0, 0, 0}, buffer.data.array());
|
||||
// buffer.setWriteIndex(0);
|
||||
// end of setup, situation where writeIndex < readIndex
|
||||
var written = buffer.put(bytes);
|
||||
assertTrue(written);
|
||||
assertArrayEquals(new byte[]{0, 5, 104, 101, 108, 108, 111, 0, 5, 104, 101, 108, 108, 111, 0, 0, 0, 7, 0, 0, 0, 7}, buffer.data.array());
|
||||
assertEquals(7, buffer.getReadIndex());
|
||||
assertEquals(7, buffer.getWriteIndex());
|
||||
}
|
||||
|
||||
@Test
|
||||
void testPutFitsNotBeforeGet() {
|
||||
var buffer = new SingleThreadCircularByteBuffer(13);
|
||||
var bytes = "hello".getBytes(UTF_8);
|
||||
buffer.setWriteIndex(6);
|
||||
buffer.setReadIndex(6);
|
||||
buffer.put(bytes);
|
||||
assertArrayEquals(new byte[]{0, 0, 0, 0, 0, 0, 0, 5, 104, 101, 108, 108, 111, 0, 0, 0, 6, 0, 0, 0, 0}, buffer.data.array());
|
||||
|
||||
// end of setup, situation where writeIndex < readIndex
|
||||
boolean written = buffer.put(bytes);
|
||||
assertFalse(written);
|
||||
assertArrayEquals(new byte[]{0, 0, 0, 0, 0, 0, 0, 5, 104, 101, 108, 108, 111, 0, 0, 0, 6, 0, 0, 0, 0}, buffer.data.array());
|
||||
}
|
||||
|
||||
@Test
|
||||
void testWrapAroundPutLenAndOneCharBeforeWrap() {
|
||||
var buffer = new SingleThreadCircularByteBuffer(9);
|
||||
var bytes = "hello".getBytes(UTF_8);
|
||||
buffer.setWriteIndex(6);
|
||||
buffer.setReadIndex(6);
|
||||
boolean written = buffer.put(bytes);
|
||||
assertTrue(written);
|
||||
assertArrayEquals(new byte[]{101, 108, 108, 111, 0, 0, 0, 5, 104, 0, 0, 0, 6, 0, 0, 0, 4}, buffer.data.array());
|
||||
assertArrayEquals(bytes, buffer.get());
|
||||
}
|
||||
|
||||
@Test
|
||||
void testWrapAroundPutLenBeforeWrap() {
|
||||
var buffer = new SingleThreadCircularByteBuffer(9);
|
||||
var bytes = "hello".getBytes(UTF_8);
|
||||
buffer.setWriteIndex(7);
|
||||
buffer.setReadIndex(7);
|
||||
var written = buffer.put(bytes);
|
||||
assertTrue(written);
|
||||
assertArrayEquals(new byte[]{104, 101, 108, 108, 111, 0, 0, 0, 5, 0, 0, 0, 7, 0, 0, 0, 5}, buffer.data.array());
|
||||
assertArrayEquals(bytes, buffer.get());
|
||||
}
|
||||
|
||||
@Test
|
||||
void testWrapAroundPutLenSplitBeforeWrap() {
|
||||
var buffer = new SingleThreadCircularByteBuffer(9);
|
||||
var bytes = "hello".getBytes(UTF_8);
|
||||
buffer.setWriteIndex(8);
|
||||
buffer.setReadIndex(8);
|
||||
var written = buffer.put(bytes);
|
||||
assertTrue(written);
|
||||
assertArrayEquals(new byte[]{5, 104, 101, 108, 108, 111, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 6}, buffer.data.array());
|
||||
assertArrayEquals(bytes, buffer.get());
|
||||
}
|
||||
|
||||
@Test
|
||||
void testNoFreeSpace() {
|
||||
var buffer = new SingleThreadCircularByteBuffer(9);
|
||||
var bytes = "hello".getBytes(UTF_8);
|
||||
boolean written1 = buffer.put(bytes);
|
||||
assertTrue(written1);
|
||||
boolean written2 = buffer.put(bytes);
|
||||
assertFalse(written2); // no space left
|
||||
}
|
||||
|
||||
@Test
|
||||
void testFreeSpaceReclaimed() {
|
||||
var buffer = new SingleThreadCircularByteBuffer(9);
|
||||
assertEquals(0, buffer.getReadIndex());
|
||||
assertEquals(0, buffer.getWriteIndex());
|
||||
|
||||
var bytes = "hello".getBytes(UTF_8);
|
||||
var written1 = buffer.put(bytes);
|
||||
assertTrue(written1);
|
||||
assertEquals(0, buffer.getReadIndex());
|
||||
assertEquals(7, buffer.getWriteIndex());
|
||||
|
||||
assertArrayEquals(bytes, buffer.get());
|
||||
assertEquals(7, buffer.getReadIndex());
|
||||
assertEquals(7, buffer.getWriteIndex());
|
||||
|
||||
var written2 = buffer.put(bytes);
|
||||
assertTrue(written2); // the read has freed space
|
||||
assertEquals(7, buffer.getReadIndex());
|
||||
assertEquals(5, buffer.getWriteIndex());
|
||||
|
||||
|
||||
assertArrayEquals(bytes, buffer.get());
|
||||
assertEquals(5, buffer.getReadIndex());
|
||||
assertEquals(5, buffer.getWriteIndex());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -14,7 +14,6 @@ pub async fn create_stacktrace(
|
|||
let new_post_db = stacktrace_repository::NewPostDb {
|
||||
stacktrace: data,
|
||||
};
|
||||
|
||||
let created_stacktrace = stacktrace_repository::insert(&state.pool, new_post_db)
|
||||
.await
|
||||
.map_err(StacktraceError::InfraError)?;
|
||||
|
|
|
|||
81
concurrency-test/pom.xml
Normal file
81
concurrency-test/pom.xml
Normal file
|
|
@ -0,0 +1,81 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>org.github.shautvast.exceptional</groupId>
|
||||
<artifactId>exceptional-parent</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>concurrency-test</artifactId>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>22</maven.compiler.source>
|
||||
<maven.compiler.target>22</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<jcstress.version>0.16</jcstress.version>
|
||||
<uberjar.name>jcstress</uberjar.name>
|
||||
</properties>
|
||||
<prerequisites>
|
||||
<maven>3.2</maven>
|
||||
</prerequisites>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.openjdk.jcstress</groupId>
|
||||
<artifactId>jcstress-core</artifactId>
|
||||
<version>${jcstress.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.github.shautvast.exceptional</groupId>
|
||||
<artifactId>exceptional-agent</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.8.0</version>
|
||||
<configuration>
|
||||
<compilerVersion>22</compilerVersion>
|
||||
<source>22</source>
|
||||
<target>22</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-shade-plugin</artifactId>
|
||||
<version>3.2.1</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>main</id>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>shade</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<finalName>${uberjar.name}</finalName>
|
||||
<transformers>
|
||||
<transformer
|
||||
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
|
||||
<mainClass>org.openjdk.jcstress.Main</mainClass>
|
||||
</transformer>
|
||||
<transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
|
||||
<resource>META-INF/TestList</resource>
|
||||
</transformer>
|
||||
</transformers>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
|
|
@ -0,0 +1,58 @@
|
|||
package org.github.shautvast.exceptional;
|
||||
|
||||
import com.github.shautvast.exceptional.CircularByteBuffer;
|
||||
import org.openjdk.jcstress.annotations.Actor;
|
||||
import org.openjdk.jcstress.annotations.JCStressTest;
|
||||
import org.openjdk.jcstress.annotations.Outcome;
|
||||
import org.openjdk.jcstress.annotations.State;
|
||||
import org.openjdk.jcstress.infra.results.I_Result;
|
||||
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
import static org.openjdk.jcstress.annotations.Expect.ACCEPTABLE;
|
||||
|
||||
/**
|
||||
* The circular buffer is put under stress to see if it fails basic expectations (what goes in
|
||||
* must come out
|
||||
*/
|
||||
@JCStressTest
|
||||
@Outcome(id = {"0", "1", "2147483647"}, expect = ACCEPTABLE, desc = "Value is correct, or not set")
|
||||
@State
|
||||
public class StressTest {
|
||||
private final CircularByteBuffer buffer = new CircularByteBuffer(100);
|
||||
private final AtomicInteger counter = new AtomicInteger(0);
|
||||
|
||||
@Actor
|
||||
public void actor1(I_Result r) {
|
||||
buffer.put(toBigEndianByteArray(counter.getAndSet(1)));
|
||||
byte[] bytes = buffer.get();
|
||||
if (bytes != null) {
|
||||
r.r1 = fromBigEndianByteArray(bytes);
|
||||
}
|
||||
}
|
||||
|
||||
@Actor
|
||||
public void actor2(I_Result r) {
|
||||
buffer.put(toBigEndianByteArray(counter.getAndSet(Integer.MAX_VALUE)));
|
||||
byte[] bytes = buffer.get();
|
||||
if (bytes != null) {
|
||||
r.r1 = fromBigEndianByteArray(bytes);
|
||||
}
|
||||
}
|
||||
|
||||
private static byte[] toBigEndianByteArray(int value) {
|
||||
return new byte[]{
|
||||
(byte) (value >> 24),
|
||||
(byte) (value >> 16),
|
||||
(byte) (value >> 8),
|
||||
(byte) value
|
||||
};
|
||||
}
|
||||
|
||||
private static int fromBigEndianByteArray(byte[] bytes) {
|
||||
return ((bytes[0] & 0xFF) << 24) |
|
||||
((bytes[1] & 0xFF) << 16) |
|
||||
((bytes[2] & 0xFF) << 8) |
|
||||
(bytes[3] & 0xFF);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,89 +0,0 @@
|
|||
/*
|
||||
* JACOB - CBOR implementation in Java.
|
||||
*
|
||||
* (C) Copyright - 2013 - J.W. Janssen <j.w.janssen@lxtreme.nl>
|
||||
*
|
||||
* Licensed under Apache License v2.0.
|
||||
*/
|
||||
package jacob;
|
||||
|
||||
/**
|
||||
* Constant values used by the CBOR format.
|
||||
*/
|
||||
public interface CborConstants {
|
||||
/** Major type 0: unsigned integers. */
|
||||
int TYPE_UNSIGNED_INTEGER = 0x00;
|
||||
/** Major type 1: negative integers. */
|
||||
int TYPE_NEGATIVE_INTEGER = 0x01;
|
||||
/** Major type 2: byte string. */
|
||||
int TYPE_BYTE_STRING = 0x02;
|
||||
/** Major type 3: text/UTF8 string. */
|
||||
int TYPE_TEXT_STRING = 0x03;
|
||||
/** Major type 4: array of items. */
|
||||
int TYPE_ARRAY = 0x04;
|
||||
/** Major type 5: map of pairs. */
|
||||
int TYPE_MAP = 0x05;
|
||||
/** Major type 6: semantic tags. */
|
||||
int TYPE_TAG = 0x06;
|
||||
/** Major type 7: floating point, simple data types. */
|
||||
int TYPE_FLOAT_SIMPLE = 0x07;
|
||||
|
||||
/** Denotes a one-byte value (uint8). */
|
||||
int ONE_BYTE = 0x18;
|
||||
/** Denotes a two-byte value (uint16). */
|
||||
int TWO_BYTES = 0x19;
|
||||
/** Denotes a four-byte value (uint32). */
|
||||
int FOUR_BYTES = 0x1a;
|
||||
/** Denotes a eight-byte value (uint64). */
|
||||
int EIGHT_BYTES = 0x1b;
|
||||
|
||||
/** The CBOR-encoded boolean <code>false</code> value (encoded as "simple value": {@link #MT_SIMPLE}). */
|
||||
int FALSE = 0x14;
|
||||
/** The CBOR-encoded boolean <code>true</code> value (encoded as "simple value": {@link #MT_SIMPLE}). */
|
||||
int TRUE = 0x15;
|
||||
/** The CBOR-encoded <code>null</code> value (encoded as "simple value": {@link #MT_SIMPLE}). */
|
||||
int NULL = 0x16;
|
||||
/** The CBOR-encoded "undefined" value (encoded as "simple value": {@link #MT_SIMPLE}). */
|
||||
int UNDEFINED = 0x17;
|
||||
/** Denotes a half-precision float (two-byte IEEE 754, see {@link #MT_FLOAT}). */
|
||||
int HALF_PRECISION_FLOAT = 0x19;
|
||||
/** Denotes a single-precision float (four-byte IEEE 754, see {@link #MT_FLOAT}). */
|
||||
int SINGLE_PRECISION_FLOAT = 0x1a;
|
||||
/** Denotes a double-precision float (eight-byte IEEE 754, see {@link #MT_FLOAT}). */
|
||||
int DOUBLE_PRECISION_FLOAT = 0x1b;
|
||||
/** The CBOR-encoded "break" stop code for unlimited arrays/maps. */
|
||||
int BREAK = 0x1f;
|
||||
|
||||
/** Semantic tag value describing date/time values in the standard format (UTF8 string, RFC3339). */
|
||||
int TAG_STANDARD_DATE_TIME = 0;
|
||||
/** Semantic tag value describing date/time values as Epoch timestamp (numeric, RFC3339). */
|
||||
int TAG_EPOCH_DATE_TIME = 1;
|
||||
/** Semantic tag value describing a positive big integer value (byte string). */
|
||||
int TAG_POSITIVE_BIGINT = 2;
|
||||
/** Semantic tag value describing a negative big integer value (byte string). */
|
||||
int TAG_NEGATIVE_BIGINT = 3;
|
||||
/** Semantic tag value describing a decimal fraction value (two-element array, base 10). */
|
||||
int TAG_DECIMAL_FRACTION = 4;
|
||||
/** Semantic tag value describing a big decimal value (two-element array, base 2). */
|
||||
int TAG_BIGDECIMAL = 5;
|
||||
/** Semantic tag value describing an expected conversion to base64url encoding. */
|
||||
int TAG_EXPECTED_BASE64_URL_ENCODED = 21;
|
||||
/** Semantic tag value describing an expected conversion to base64 encoding. */
|
||||
int TAG_EXPECTED_BASE64_ENCODED = 22;
|
||||
/** Semantic tag value describing an expected conversion to base16 encoding. */
|
||||
int TAG_EXPECTED_BASE16_ENCODED = 23;
|
||||
/** Semantic tag value describing an encoded CBOR data item (byte string). */
|
||||
int TAG_CBOR_ENCODED = 24;
|
||||
/** Semantic tag value describing an URL (UTF8 string). */
|
||||
int TAG_URI = 32;
|
||||
/** Semantic tag value describing a base64url encoded string (UTF8 string). */
|
||||
int TAG_BASE64_URL_ENCODED = 33;
|
||||
/** Semantic tag value describing a base64 encoded string (UTF8 string). */
|
||||
int TAG_BASE64_ENCODED = 34;
|
||||
/** Semantic tag value describing a regular expression string (UTF8 string, PCRE). */
|
||||
int TAG_REGEXP = 35;
|
||||
/** Semantic tag value describing a MIME message (UTF8 string, RFC2045). */
|
||||
int TAG_MIME_MESSAGE = 36;
|
||||
/** Semantic tag value describing CBOR content. */
|
||||
int TAG_CBOR_MARKER = 55799;
|
||||
}
|
||||
|
|
@ -1,498 +0,0 @@
|
|||
/*
|
||||
* JACOB - CBOR implementation in Java.
|
||||
*
|
||||
* (C) Copyright - 2013 - J.W. Janssen <j.w.janssen@lxtreme.nl>
|
||||
*/
|
||||
package jacob;
|
||||
|
||||
import static jacob.CborConstants.*;
|
||||
import static jacob.CborType.*;
|
||||
|
||||
import java.io.EOFException;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.PushbackInputStream;
|
||||
|
||||
/**
|
||||
* Provides a decoder capable of handling CBOR encoded data from a {@link InputStream}.
|
||||
*/
|
||||
public class CborDecoder {
|
||||
protected final PushbackInputStream m_is;
|
||||
|
||||
/**
|
||||
* Creates a new {@link CborDecoder} instance.
|
||||
*
|
||||
* @param is the actual input stream to read the CBOR-encoded data from, cannot be <code>null</code>.
|
||||
*/
|
||||
public CborDecoder(InputStream is) {
|
||||
if (is == null) {
|
||||
throw new IllegalArgumentException("InputStream cannot be null!");
|
||||
}
|
||||
m_is = (is instanceof PushbackInputStream) ? (PushbackInputStream) is : new PushbackInputStream(is);
|
||||
}
|
||||
|
||||
private static void fail(String msg, Object... args) throws IOException {
|
||||
throw new IOException(String.format(msg, args));
|
||||
}
|
||||
|
||||
private static String lengthToString(int len) {
|
||||
return (len < 0) ? "no payload" : (len == ONE_BYTE) ? "one byte" : (len == TWO_BYTES) ? "two bytes"
|
||||
: (len == FOUR_BYTES) ? "four bytes" : (len == EIGHT_BYTES) ? "eight bytes" : "(unknown)";
|
||||
}
|
||||
|
||||
/**
|
||||
* Peeks in the input stream for the upcoming type.
|
||||
*
|
||||
* @return the upcoming type in the stream, or <code>null</code> in case of an end-of-stream.
|
||||
* @throws IOException in case of I/O problems reading the CBOR-type from the underlying input stream.
|
||||
*/
|
||||
public CborType peekType() throws IOException {
|
||||
int p = m_is.read();
|
||||
if (p < 0) {
|
||||
// EOF, nothing to peek at...
|
||||
return null;
|
||||
}
|
||||
m_is.unread(p);
|
||||
return valueOf(p);
|
||||
}
|
||||
|
||||
/**
|
||||
* Prolog to reading an array value in CBOR format.
|
||||
*
|
||||
* @return the number of elements in the array to read, or <tt>-1</tt> in case of infinite-length arrays.
|
||||
* @throws IOException in case of I/O problems reading the CBOR-encoded value from the underlying input stream.
|
||||
*/
|
||||
public long readArrayLength() throws IOException {
|
||||
return readMajorTypeWithSize(TYPE_ARRAY);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads a boolean value in CBOR format.
|
||||
*
|
||||
* @return the read boolean.
|
||||
* @throws IOException in case of I/O problems reading the CBOR-encoded value from the underlying input stream.
|
||||
*/
|
||||
public boolean readBoolean() throws IOException {
|
||||
int b = readMajorType(TYPE_FLOAT_SIMPLE);
|
||||
if (b != FALSE && b != TRUE) {
|
||||
fail("Unexpected boolean value: %d!", b);
|
||||
}
|
||||
return b == TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads a "break"/stop value in CBOR format.
|
||||
*
|
||||
* @return always <code>null</code>.
|
||||
* @throws IOException in case of I/O problems reading the CBOR-encoded value from the underlying input stream.
|
||||
*/
|
||||
public Object readBreak() throws IOException {
|
||||
readMajorTypeExact(TYPE_FLOAT_SIMPLE, BREAK);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads a byte string value in CBOR format.
|
||||
*
|
||||
* @return the read byte string, never <code>null</code>. In case the encoded string has a length of <tt>0</tt>, an empty string is returned.
|
||||
* @throws IOException in case of I/O problems reading the CBOR-encoded value from the underlying input stream.
|
||||
*/
|
||||
public byte[] readByteString() throws IOException {
|
||||
long len = readMajorTypeWithSize(TYPE_BYTE_STRING);
|
||||
if (len < 0) {
|
||||
fail("Infinite-length byte strings not supported!");
|
||||
}
|
||||
if (len > Integer.MAX_VALUE) {
|
||||
fail("String length too long!");
|
||||
}
|
||||
return readFully(new byte[(int) len]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Prolog to reading a byte string value in CBOR format.
|
||||
*
|
||||
* @return the number of bytes in the string to read, or <tt>-1</tt> in case of infinite-length strings.
|
||||
* @throws IOException in case of I/O problems reading the CBOR-encoded value from the underlying input stream.
|
||||
*/
|
||||
public long readByteStringLength() throws IOException {
|
||||
return readMajorTypeWithSize(TYPE_BYTE_STRING);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads a double-precision float value in CBOR format.
|
||||
*
|
||||
* @return the read double value, values from {@link Float#MIN_VALUE} to {@link Float#MAX_VALUE} are supported.
|
||||
* @throws IOException in case of I/O problems reading the CBOR-encoded value from the underlying input stream.
|
||||
*/
|
||||
public double readDouble() throws IOException {
|
||||
readMajorTypeExact(TYPE_FLOAT_SIMPLE, DOUBLE_PRECISION_FLOAT);
|
||||
|
||||
return Double.longBitsToDouble(readUInt64());
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads a single-precision float value in CBOR format.
|
||||
*
|
||||
* @return the read float value, values from {@link Float#MIN_VALUE} to {@link Float#MAX_VALUE} are supported.
|
||||
* @throws IOException in case of I/O problems reading the CBOR-encoded value from the underlying input stream.
|
||||
*/
|
||||
public float readFloat() throws IOException {
|
||||
readMajorTypeExact(TYPE_FLOAT_SIMPLE, SINGLE_PRECISION_FLOAT);
|
||||
|
||||
return Float.intBitsToFloat((int) readUInt32());
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads a half-precision float value in CBOR format.
|
||||
*
|
||||
* @return the read half-precision float value, values from {@link Float#MIN_VALUE} to {@link Float#MAX_VALUE} are supported.
|
||||
* @throws IOException in case of I/O problems reading the CBOR-encoded value from the underlying input stream.
|
||||
*/
|
||||
public double readHalfPrecisionFloat() throws IOException {
|
||||
readMajorTypeExact(TYPE_FLOAT_SIMPLE, HALF_PRECISION_FLOAT);
|
||||
|
||||
int half = readUInt16();
|
||||
int exp = (half >> 10) & 0x1f;
|
||||
int mant = half & 0x3ff;
|
||||
|
||||
double val;
|
||||
if (exp == 0) {
|
||||
val = mant * Math.pow(2, -24);
|
||||
} else if (exp != 31) {
|
||||
val = (mant + 1024) * Math.pow(2, exp - 25);
|
||||
} else if (mant != 0) {
|
||||
val = Double.NaN;
|
||||
} else {
|
||||
val = Double.POSITIVE_INFINITY;
|
||||
}
|
||||
|
||||
return ((half & 0x8000) == 0) ? val : -val;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads a signed or unsigned integer value in CBOR format.
|
||||
*
|
||||
* @return the read integer value, values from {@link Long#MIN_VALUE} to {@link Long#MAX_VALUE} are supported.
|
||||
* @throws IOException in case of I/O problems reading the CBOR-encoded value from the underlying input stream.
|
||||
*/
|
||||
public long readInt() throws IOException {
|
||||
int ib = m_is.read();
|
||||
|
||||
// in case of negative integers, extends the sign to all bits; otherwise zero...
|
||||
long ui = expectIntegerType(ib);
|
||||
// in case of negative integers does a ones complement
|
||||
return ui ^ readUInt(ib & 0x1f, false /* breakAllowed */);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads a signed or unsigned 16-bit integer value in CBOR format.
|
||||
*
|
||||
* @read the small integer value, values from <tt>[-65536..65535]</tt> are supported.
|
||||
* @throws IOException in case of I/O problems reading the CBOR-encoded value from the underlying output stream.
|
||||
*/
|
||||
public int readInt16() throws IOException {
|
||||
int ib = m_is.read();
|
||||
|
||||
// in case of negative integers, extends the sign to all bits; otherwise zero...
|
||||
long ui = expectIntegerType(ib);
|
||||
// in case of negative integers does a ones complement
|
||||
return (int) (ui ^ readUIntExact(TWO_BYTES, ib & 0x1f));
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads a signed or unsigned 32-bit integer value in CBOR format.
|
||||
*
|
||||
* @read the small integer value, values in the range <tt>[-4294967296..4294967295]</tt> are supported.
|
||||
* @throws IOException in case of I/O problems reading the CBOR-encoded value from the underlying output stream.
|
||||
*/
|
||||
public long readInt32() throws IOException {
|
||||
int ib = m_is.read();
|
||||
|
||||
// in case of negative integers, extends the sign to all bits; otherwise zero...
|
||||
long ui = expectIntegerType(ib);
|
||||
// in case of negative integers does a ones complement
|
||||
return ui ^ readUIntExact(FOUR_BYTES, ib & 0x1f);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads a signed or unsigned 64-bit integer value in CBOR format.
|
||||
*
|
||||
* @read the small integer value, values from {@link Long#MIN_VALUE} to {@link Long#MAX_VALUE} are supported.
|
||||
* @throws IOException in case of I/O problems reading the CBOR-encoded value from the underlying output stream.
|
||||
*/
|
||||
public long readInt64() throws IOException {
|
||||
int ib = m_is.read();
|
||||
|
||||
// in case of negative integers, extends the sign to all bits; otherwise zero...
|
||||
long ui = expectIntegerType(ib);
|
||||
// in case of negative integers does a ones complement
|
||||
return ui ^ readUIntExact(EIGHT_BYTES, ib & 0x1f);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads a signed or unsigned 8-bit integer value in CBOR format.
|
||||
*
|
||||
* @read the small integer value, values in the range <tt>[-256..255]</tt> are supported.
|
||||
* @throws IOException in case of I/O problems reading the CBOR-encoded value from the underlying output stream.
|
||||
*/
|
||||
public int readInt8() throws IOException {
|
||||
int ib = m_is.read();
|
||||
|
||||
// in case of negative integers, extends the sign to all bits; otherwise zero...
|
||||
long ui = expectIntegerType(ib);
|
||||
// in case of negative integers does a ones complement
|
||||
return (int) (ui ^ readUIntExact(ONE_BYTE, ib & 0x1f));
|
||||
}
|
||||
|
||||
/**
|
||||
* Prolog to reading a map of key-value pairs in CBOR format.
|
||||
*
|
||||
* @return the number of entries in the map, >= 0.
|
||||
* @throws IOException in case of I/O problems reading the CBOR-encoded value from the underlying input stream.
|
||||
*/
|
||||
public long readMapLength() throws IOException {
|
||||
return readMajorTypeWithSize(TYPE_MAP);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads a <code>null</code>-value in CBOR format.
|
||||
*
|
||||
* @return always <code>null</code>.
|
||||
* @throws IOException in case of I/O problems reading the CBOR-encoded value from the underlying input stream.
|
||||
*/
|
||||
public Object readNull() throws IOException {
|
||||
readMajorTypeExact(TYPE_FLOAT_SIMPLE, NULL);
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads a single byte value in CBOR format.
|
||||
*
|
||||
* @return the read byte value.
|
||||
* @throws IOException in case of I/O problems reading the CBOR-encoded value from the underlying input stream.
|
||||
*/
|
||||
public byte readSimpleValue() throws IOException {
|
||||
readMajorTypeExact(TYPE_FLOAT_SIMPLE, ONE_BYTE);
|
||||
return (byte) readUInt8();
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads a signed or unsigned small (<= 23) integer value in CBOR format.
|
||||
*
|
||||
* @read the small integer value, values in the range <tt>[-24..23]</tt> are supported.
|
||||
* @throws IOException in case of I/O problems reading the CBOR-encoded value from the underlying output stream.
|
||||
*/
|
||||
public int readSmallInt() throws IOException {
|
||||
int ib = m_is.read();
|
||||
|
||||
// in case of negative integers, extends the sign to all bits; otherwise zero...
|
||||
long ui = expectIntegerType(ib);
|
||||
// in case of negative integers does a ones complement
|
||||
return (int) (ui ^ readUIntExact(-1, ib & 0x1f));
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads a semantic tag value in CBOR format.
|
||||
*
|
||||
* @return the read tag value.
|
||||
* @throws IOException in case of I/O problems reading the CBOR-encoded value from the underlying input stream.
|
||||
*/
|
||||
public long readTag() throws IOException {
|
||||
return readUInt(readMajorType(TYPE_TAG), false /* breakAllowed */);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads an UTF-8 encoded string value in CBOR format.
|
||||
*
|
||||
* @return the read UTF-8 encoded string, never <code>null</code>. In case the encoded string has a length of <tt>0</tt>, an empty string is returned.
|
||||
* @throws IOException in case of I/O problems reading the CBOR-encoded value from the underlying input stream.
|
||||
*/
|
||||
public String readTextString() throws IOException {
|
||||
long len = readMajorTypeWithSize(TYPE_TEXT_STRING);
|
||||
if (len < 0) {
|
||||
fail("Infinite-length text strings not supported!");
|
||||
}
|
||||
if (len > Integer.MAX_VALUE) {
|
||||
fail("String length too long!");
|
||||
}
|
||||
return new String(readFully(new byte[(int) len]), "UTF-8");
|
||||
}
|
||||
|
||||
/**
|
||||
* Prolog to reading an UTF-8 encoded string value in CBOR format.
|
||||
*
|
||||
* @return the length of the string to read, or <tt>-1</tt> in case of infinite-length strings.
|
||||
* @throws IOException in case of I/O problems reading the CBOR-encoded value from the underlying input stream.
|
||||
*/
|
||||
public long readTextStringLength() throws IOException {
|
||||
return readMajorTypeWithSize(TYPE_TEXT_STRING);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads an undefined value in CBOR format.
|
||||
*
|
||||
* @return always <code>null</code>.
|
||||
* @throws IOException in case of I/O problems reading the CBOR-encoded value from the underlying input stream.
|
||||
*/
|
||||
public Object readUndefined() throws IOException {
|
||||
readMajorTypeExact(TYPE_FLOAT_SIMPLE, UNDEFINED);
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads the next major type from the underlying input stream, and verifies whether it matches the given expectation.
|
||||
*
|
||||
* @param majorType the expected major type, cannot be <code>null</code> (unchecked).
|
||||
* @return either <tt>-1</tt> if the major type was an signed integer, or <tt>0</tt> otherwise.
|
||||
* @throws IOException in case of I/O problems reading the CBOR-encoded value from the underlying input stream.
|
||||
*/
|
||||
protected long expectIntegerType(int ib) throws IOException {
|
||||
int majorType = ((ib & 0xFF) >>> 5);
|
||||
if ((majorType != TYPE_UNSIGNED_INTEGER) && (majorType != TYPE_NEGATIVE_INTEGER)) {
|
||||
fail("Unexpected type: %s, expected type %s or %s!", getName(majorType), getName(TYPE_UNSIGNED_INTEGER),
|
||||
getName(TYPE_NEGATIVE_INTEGER));
|
||||
}
|
||||
return -majorType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads the next major type from the underlying input stream, and verifies whether it matches the given expectation.
|
||||
*
|
||||
* @param majorType the expected major type, cannot be <code>null</code> (unchecked).
|
||||
* @return the read subtype, or payload, of the read major type.
|
||||
* @throws IOException in case of I/O problems reading the CBOR-encoded value from the underlying input stream.
|
||||
*/
|
||||
protected int readMajorType(int majorType) throws IOException {
|
||||
int ib = m_is.read();
|
||||
if (majorType != ((ib >>> 5) & 0x07)) {
|
||||
fail("Unexpected type: %s, expected: %s!", getName(ib), getName(majorType));
|
||||
}
|
||||
return ib & 0x1F;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads the next major type from the underlying input stream, and verifies whether it matches the given expectations.
|
||||
*
|
||||
* @param majorType the expected major type, cannot be <code>null</code> (unchecked);
|
||||
* @param subtype the expected subtype.
|
||||
* @throws IOException in case of I/O problems reading the CBOR-encoded value from the underlying input stream.
|
||||
*/
|
||||
protected void readMajorTypeExact(int majorType, int subtype) throws IOException {
|
||||
int st = readMajorType(majorType);
|
||||
if ((st ^ subtype) != 0) {
|
||||
fail("Unexpected subtype: %d, expected: %d!", st, subtype);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads the next major type from the underlying input stream, verifies whether it matches the given expectation, and decodes the payload into a size.
|
||||
*
|
||||
* @param majorType the expected major type, cannot be <code>null</code> (unchecked).
|
||||
* @return the number of succeeding bytes, >= 0, or <tt>-1</tt> if an infinite-length type is read.
|
||||
* @throws IOException in case of I/O problems reading the CBOR-encoded value from the underlying input stream.
|
||||
*/
|
||||
protected long readMajorTypeWithSize(int majorType) throws IOException {
|
||||
return readUInt(readMajorType(majorType), true /* breakAllowed */);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads an unsigned integer with a given length-indicator.
|
||||
*
|
||||
* @param length the length indicator to use;
|
||||
* @return the read unsigned integer, as long value.
|
||||
* @throws IOException in case of I/O problems reading the unsigned integer from the underlying input stream.
|
||||
*/
|
||||
protected long readUInt(int length, boolean breakAllowed) throws IOException {
|
||||
long result = -1;
|
||||
if (length < ONE_BYTE) {
|
||||
result = length;
|
||||
} else if (length == ONE_BYTE) {
|
||||
result = readUInt8();
|
||||
} else if (length == TWO_BYTES) {
|
||||
result = readUInt16();
|
||||
} else if (length == FOUR_BYTES) {
|
||||
result = readUInt32();
|
||||
} else if (length == EIGHT_BYTES) {
|
||||
result = readUInt64();
|
||||
} else if (breakAllowed && length == BREAK) {
|
||||
return -1;
|
||||
}
|
||||
if (result < 0) {
|
||||
fail("Not well-formed CBOR integer found, invalid length: %d!", result);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads an unsigned 16-bit integer value
|
||||
*
|
||||
* @return value the read value, values from {@link Long#MIN_VALUE} to {@link Long#MAX_VALUE} are supported.
|
||||
* @throws IOException in case of I/O problems writing the CBOR-encoded value to the underlying output stream.
|
||||
*/
|
||||
protected int readUInt16() throws IOException {
|
||||
byte[] buf = readFully(new byte[2]);
|
||||
return (buf[0] & 0xFF) << 8 | (buf[1] & 0xFF);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads an unsigned 32-bit integer value
|
||||
*
|
||||
* @return value the read value, values from {@link Long#MIN_VALUE} to {@link Long#MAX_VALUE} are supported.
|
||||
* @throws IOException in case of I/O problems writing the CBOR-encoded value to the underlying output stream.
|
||||
*/
|
||||
protected long readUInt32() throws IOException {
|
||||
byte[] buf = readFully(new byte[4]);
|
||||
return ((buf[0] & 0xFF) << 24 | (buf[1] & 0xFF) << 16 | (buf[2] & 0xFF) << 8 | (buf[3] & 0xFF)) & 0xffffffffL;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads an unsigned 64-bit integer value
|
||||
*
|
||||
* @return value the read value, values from {@link Long#MIN_VALUE} to {@link Long#MAX_VALUE} are supported.
|
||||
* @throws IOException in case of I/O problems writing the CBOR-encoded value to the underlying output stream.
|
||||
*/
|
||||
protected long readUInt64() throws IOException {
|
||||
byte[] buf = readFully(new byte[8]);
|
||||
return (buf[0] & 0xFFL) << 56 | (buf[1] & 0xFFL) << 48 | (buf[2] & 0xFFL) << 40 | (buf[3] & 0xFFL) << 32 | //
|
||||
(buf[4] & 0xFFL) << 24 | (buf[5] & 0xFFL) << 16 | (buf[6] & 0xFFL) << 8 | (buf[7] & 0xFFL);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads an unsigned 8-bit integer value
|
||||
*
|
||||
* @return value the read value, values from {@link Long#MIN_VALUE} to {@link Long#MAX_VALUE} are supported.
|
||||
* @throws IOException in case of I/O problems writing the CBOR-encoded value to the underlying output stream.
|
||||
*/
|
||||
protected int readUInt8() throws IOException {
|
||||
return m_is.read() & 0xff;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads an unsigned integer with a given length-indicator.
|
||||
*
|
||||
* @param length the length indicator to use;
|
||||
* @return the read unsigned integer, as long value.
|
||||
* @throws IOException in case of I/O problems reading the unsigned integer from the underlying input stream.
|
||||
*/
|
||||
protected long readUIntExact(int expectedLength, int length) throws IOException {
|
||||
if (((expectedLength == -1) && (length >= ONE_BYTE)) || ((expectedLength >= 0) && (length != expectedLength))) {
|
||||
fail("Unexpected payload/length! Expected %s, but got %s.", lengthToString(expectedLength),
|
||||
lengthToString(length));
|
||||
}
|
||||
return readUInt(length, false /* breakAllowed */);
|
||||
}
|
||||
|
||||
private byte[] readFully(byte[] buf) throws IOException {
|
||||
int len = buf.length;
|
||||
int n = 0, off = 0;
|
||||
while (n < len) {
|
||||
int count = m_is.read(buf, off + n, len - n);
|
||||
if (count < 0) {
|
||||
throw new EOFException();
|
||||
}
|
||||
n += count;
|
||||
}
|
||||
return buf;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,488 +0,0 @@
|
|||
/*
|
||||
* JACOB - CBOR implementation in Java.
|
||||
*
|
||||
* (C) Copyright - 2013 - J.W. Janssen <j.w.janssen@lxtreme.nl>
|
||||
*
|
||||
* Licensed under Apache License v2.0.
|
||||
*/
|
||||
package jacob;
|
||||
|
||||
import static jacob.CborConstants.*;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
|
||||
/**
|
||||
* Provides an encoder capable of encoding data into CBOR format to a given {@link OutputStream}.
|
||||
*/
|
||||
public class CborEncoder {
|
||||
private static final int NEG_INT_MASK = TYPE_NEGATIVE_INTEGER << 5;
|
||||
|
||||
private final OutputStream m_os;
|
||||
|
||||
/**
|
||||
* Creates a new {@link CborEncoder} instance.
|
||||
*
|
||||
* @param os the actual output stream to write the CBOR-encoded data to, cannot be <code>null</code>.
|
||||
*/
|
||||
public CborEncoder(OutputStream os) {
|
||||
if (os == null) {
|
||||
throw new IllegalArgumentException("OutputStream cannot be null!");
|
||||
}
|
||||
m_os = os;
|
||||
}
|
||||
|
||||
/**
|
||||
* Interprets a given float-value as a half-precision float value and
|
||||
* converts it to its raw integer form, as defined in IEEE 754.
|
||||
* <p>
|
||||
* Taken from: <a href="http://stackoverflow.com/a/6162687/229140">this Stack Overflow answer</a>.
|
||||
* </p>
|
||||
*
|
||||
* @param fval the value to convert.
|
||||
* @return the raw integer representation of the given float value.
|
||||
*/
|
||||
static int halfPrecisionToRawIntBits(float fval) {
|
||||
int fbits = Float.floatToIntBits(fval);
|
||||
int sign = (fbits >>> 16) & 0x8000;
|
||||
int val = (fbits & 0x7fffffff) + 0x1000;
|
||||
|
||||
// might be or become NaN/Inf
|
||||
if (val >= 0x47800000) {
|
||||
if ((fbits & 0x7fffffff) >= 0x47800000) { // is or must become NaN/Inf
|
||||
if (val < 0x7f800000) {
|
||||
// was value but too large, make it +/-Inf
|
||||
return sign | 0x7c00;
|
||||
}
|
||||
return sign | 0x7c00 | (fbits & 0x007fffff) >>> 13; // keep NaN (and Inf) bits
|
||||
}
|
||||
return sign | 0x7bff; // unrounded not quite Inf
|
||||
}
|
||||
if (val >= 0x38800000) {
|
||||
// remains normalized value
|
||||
return sign | val - 0x38000000 >>> 13; // exp - 127 + 15
|
||||
}
|
||||
if (val < 0x33000000) {
|
||||
// too small for subnormal
|
||||
return sign; // becomes +/-0
|
||||
}
|
||||
|
||||
val = (fbits & 0x7fffffff) >>> 23;
|
||||
// add subnormal bit, round depending on cut off and div by 2^(1-(exp-127+15)) and >> 13 | exp=0
|
||||
return sign | ((fbits & 0x7fffff | 0x800000) + (0x800000 >>> val - 102) >>> 126 - val);
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes the start of an indefinite-length array.
|
||||
* <p>
|
||||
* After calling this method, one is expected to write the given number of array elements, which can be of any type. No length checks are performed.<br/>
|
||||
* After all array elements are written, one should write a single break value to end the array, see {@link #writeBreak()}.
|
||||
* </p>
|
||||
*
|
||||
* @throws IOException in case of I/O problems writing the CBOR-encoded value to the underlying output stream.
|
||||
*/
|
||||
public void writeArrayStart() throws IOException {
|
||||
writeSimpleType(TYPE_ARRAY, BREAK);
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes the start of a definite-length array.
|
||||
* <p>
|
||||
* After calling this method, one is expected to write the given number of array elements, which can be of any type. No length checks are performed.
|
||||
* </p>
|
||||
*
|
||||
* @param length the number of array elements to write, should >= 0.
|
||||
* @throws IllegalArgumentException in case the given length was negative;
|
||||
* @throws IOException in case of I/O problems writing the CBOR-encoded value to the underlying output stream.
|
||||
*/
|
||||
public void writeArrayStart(int length) throws IOException {
|
||||
if (length < 0) {
|
||||
throw new IllegalArgumentException("Invalid array-length!");
|
||||
}
|
||||
writeType(TYPE_ARRAY, length);
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes a boolean value in canonical CBOR format.
|
||||
*
|
||||
* @param value the boolean to write.
|
||||
* @throws IOException in case of I/O problems writing the CBOR-encoded value to the underlying output stream.
|
||||
*/
|
||||
public void writeBoolean(boolean value) throws IOException {
|
||||
writeSimpleType(TYPE_FLOAT_SIMPLE, value ? TRUE : FALSE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes a "break" stop-value in canonical CBOR format.
|
||||
*
|
||||
* @throws IOException in case of I/O problems writing the CBOR-encoded value to the underlying output stream.
|
||||
*/
|
||||
public void writeBreak() throws IOException {
|
||||
writeSimpleType(TYPE_FLOAT_SIMPLE, BREAK);
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes a byte string in canonical CBOR-format.
|
||||
*
|
||||
* @param value the byte string to write, can be <code>null</code> in which case a byte-string of length <tt>0</tt> is written.
|
||||
* @throws IOException in case of I/O problems writing the CBOR-encoded value to the underlying output stream.
|
||||
*/
|
||||
public void writeByteString(byte[] bytes) throws IOException {
|
||||
writeString(TYPE_BYTE_STRING, bytes);
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes the start of an indefinite-length byte string.
|
||||
* <p>
|
||||
* After calling this method, one is expected to write the given number of string parts. No length checks are performed.<br/>
|
||||
* After all string parts are written, one should write a single break value to end the string, see {@link #writeBreak()}.
|
||||
* </p>
|
||||
*
|
||||
* @throws IOException in case of I/O problems writing the CBOR-encoded value to the underlying output stream.
|
||||
*/
|
||||
public void writeByteStringStart() throws IOException {
|
||||
writeSimpleType(TYPE_BYTE_STRING, BREAK);
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes a double-precision float value in canonical CBOR format.
|
||||
*
|
||||
* @param value the value to write, values from {@link Double#MIN_VALUE} to {@link Double#MAX_VALUE} are supported.
|
||||
* @throws IOException in case of I/O problems writing the CBOR-encoded value to the underlying output stream.
|
||||
*/
|
||||
public void writeDouble(double value) throws IOException {
|
||||
writeUInt64(TYPE_FLOAT_SIMPLE << 5, Double.doubleToRawLongBits(value));
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes a single-precision float value in canonical CBOR format.
|
||||
*
|
||||
* @param value the value to write, values from {@link Float#MIN_VALUE} to {@link Float#MAX_VALUE} are supported.
|
||||
* @throws IOException in case of I/O problems writing the CBOR-encoded value to the underlying output stream.
|
||||
*/
|
||||
public void writeFloat(float value) throws IOException {
|
||||
writeUInt32(TYPE_FLOAT_SIMPLE << 5, Float.floatToRawIntBits(value));
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes a half-precision float value in canonical CBOR format.
|
||||
*
|
||||
* @param value the value to write, values from {@link Float#MIN_VALUE} to {@link Float#MAX_VALUE} are supported.
|
||||
* @throws IOException in case of I/O problems writing the CBOR-encoded value to the underlying output stream.
|
||||
*/
|
||||
public void writeHalfPrecisionFloat(float value) throws IOException {
|
||||
writeUInt16(TYPE_FLOAT_SIMPLE << 5, halfPrecisionToRawIntBits(value));
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes a signed or unsigned integer value in canonical CBOR format, that is, tries to encode it in a little bytes as possible..
|
||||
*
|
||||
* @param value the value to write, values from {@link Long#MIN_VALUE} to {@link Long#MAX_VALUE} are supported.
|
||||
* @throws IOException in case of I/O problems writing the CBOR-encoded value to the underlying output stream.
|
||||
*/
|
||||
public void writeInt(long value) throws IOException {
|
||||
// extends the sign over all bits...
|
||||
long sign = value >> 63;
|
||||
// in case value is negative, this bit should be set...
|
||||
int mt = (int) (sign & NEG_INT_MASK);
|
||||
// complement negative value...
|
||||
value = (sign ^ value);
|
||||
|
||||
writeUInt(mt, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes a signed or unsigned 16-bit integer value in CBOR format.
|
||||
*
|
||||
* @param value the value to write, values from <tt>[-65536..65535]</tt> are supported.
|
||||
* @throws IOException in case of I/O problems writing the CBOR-encoded value to the underlying output stream.
|
||||
*/
|
||||
public void writeInt16(int value) throws IOException {
|
||||
// extends the sign over all bits...
|
||||
int sign = value >> 31;
|
||||
// in case value is negative, this bit should be set...
|
||||
int mt = (int) (sign & NEG_INT_MASK);
|
||||
// complement negative value...
|
||||
writeUInt16(mt, (sign ^ value) & 0xffff);
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes a signed or unsigned 32-bit integer value in CBOR format.
|
||||
*
|
||||
* @param value the value to write, values in the range <tt>[-4294967296..4294967295]</tt> are supported.
|
||||
* @throws IOException in case of I/O problems writing the CBOR-encoded value to the underlying output stream.
|
||||
*/
|
||||
public void writeInt32(long value) throws IOException {
|
||||
// extends the sign over all bits...
|
||||
long sign = value >> 63;
|
||||
// in case value is negative, this bit should be set...
|
||||
int mt = (int) (sign & NEG_INT_MASK);
|
||||
// complement negative value...
|
||||
writeUInt32(mt, (int) ((sign ^ value) & 0xffffffffL));
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes a signed or unsigned 64-bit integer value in CBOR format.
|
||||
*
|
||||
* @param value the value to write, values from {@link Long#MIN_VALUE} to {@link Long#MAX_VALUE} are supported.
|
||||
* @throws IOException in case of I/O problems writing the CBOR-encoded value to the underlying output stream.
|
||||
*/
|
||||
public void writeInt64(long value) throws IOException {
|
||||
// extends the sign over all bits...
|
||||
long sign = value >> 63;
|
||||
// in case value is negative, this bit should be set...
|
||||
int mt = (int) (sign & NEG_INT_MASK);
|
||||
// complement negative value...
|
||||
writeUInt64(mt, sign ^ value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes a signed or unsigned 8-bit integer value in CBOR format.
|
||||
*
|
||||
* @param value the value to write, values in the range <tt>[-256..255]</tt> are supported.
|
||||
* @throws IOException in case of I/O problems writing the CBOR-encoded value to the underlying output stream.
|
||||
*/
|
||||
public void writeInt8(int value) throws IOException {
|
||||
// extends the sign over all bits...
|
||||
int sign = value >> 31;
|
||||
// in case value is negative, this bit should be set...
|
||||
int mt = (int) (sign & NEG_INT_MASK);
|
||||
// complement negative value...
|
||||
writeUInt8(mt, (sign ^ value) & 0xff);
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes the start of an indefinite-length map.
|
||||
* <p>
|
||||
* After calling this method, one is expected to write any number of map entries, as separate key and value. Keys and values can both be of any type. No length checks are performed.<br/>
|
||||
* After all map entries are written, one should write a single break value to end the map, see {@link #writeBreak()}.
|
||||
* </p>
|
||||
*
|
||||
* @throws IOException in case of I/O problems writing the CBOR-encoded value to the underlying output stream.
|
||||
*/
|
||||
public void writeMapStart() throws IOException {
|
||||
writeSimpleType(TYPE_MAP, BREAK);
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes the start of a finite-length map.
|
||||
* <p>
|
||||
* After calling this method, one is expected to write any number of map entries, as separate key and value. Keys and values can both be of any type. No length checks are performed.
|
||||
* </p>
|
||||
*
|
||||
* @param length the number of map entries to write, should >= 0.
|
||||
* @throws IllegalArgumentException in case the given length was negative;
|
||||
* @throws IOException in case of I/O problems writing the CBOR-encoded value to the underlying output stream.
|
||||
*/
|
||||
public void writeMapStart(int length) throws IOException {
|
||||
if (length < 0) {
|
||||
throw new IllegalArgumentException("Invalid length of map!");
|
||||
}
|
||||
writeType(TYPE_MAP, length);
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes a <code>null</code> value in canonical CBOR format.
|
||||
*
|
||||
* @throws IOException in case of I/O problems writing the CBOR-encoded value to the underlying output stream.
|
||||
*/
|
||||
public void writeNull() throws IOException {
|
||||
writeSimpleType(TYPE_FLOAT_SIMPLE, NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes a simple value, i.e., an "atom" or "constant" value in canonical CBOR format.
|
||||
*
|
||||
* @param value the (unsigned byte) value to write, values from <tt>32</tt> to <tt>255</tt> are supported (though not enforced).
|
||||
* @throws IOException in case of I/O problems writing the CBOR-encoded value to the underlying output stream.
|
||||
*/
|
||||
public void writeSimpleValue(byte simpleValue) throws IOException {
|
||||
// convert to unsigned value...
|
||||
int value = (simpleValue & 0xff);
|
||||
writeType(TYPE_FLOAT_SIMPLE, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes a signed or unsigned small (<= 23) integer value in CBOR format.
|
||||
*
|
||||
* @param value the value to write, values in the range <tt>[-24..23]</tt> are supported.
|
||||
* @throws IOException in case of I/O problems writing the CBOR-encoded value to the underlying output stream.
|
||||
*/
|
||||
public void writeSmallInt(int value) throws IOException {
|
||||
// extends the sign over all bits...
|
||||
int sign = value >> 31;
|
||||
// in case value is negative, this bit should be set...
|
||||
int mt = (int) (sign & NEG_INT_MASK);
|
||||
// complement negative value...
|
||||
value = Math.min(0x17, (sign ^ value));
|
||||
|
||||
m_os.write((int) (mt | value));
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes a semantic tag in canonical CBOR format.
|
||||
*
|
||||
* @param tag the tag to write, should >= 0.
|
||||
* @throws IllegalArgumentException in case the given tag was negative;
|
||||
* @throws IOException in case of I/O problems writing the CBOR-encoded value to the underlying output stream.
|
||||
*/
|
||||
public void writeTag(long tag) throws IOException {
|
||||
if (tag < 0) {
|
||||
throw new IllegalArgumentException("Invalid tag specification, cannot be negative!");
|
||||
}
|
||||
writeType(TYPE_TAG, tag);
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes an UTF-8 string in canonical CBOR-format.
|
||||
* <p>
|
||||
* Note that this method is <em>platform</em> specific, as the given string value will be encoded in a byte array
|
||||
* using the <em>platform</em> encoding! This means that the encoding must be standardized and known.
|
||||
* </p>
|
||||
*
|
||||
* @param value the UTF-8 string to write, can be <code>null</code> in which case an UTF-8 string of length <tt>0</tt> is written.
|
||||
* @throws IOException in case of I/O problems writing the CBOR-encoded value to the underlying output stream.
|
||||
*/
|
||||
public void writeTextString(String value) throws IOException {
|
||||
writeString(TYPE_TEXT_STRING, value == null ? null : value.getBytes("UTF-8"));
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes the start of an indefinite-length UTF-8 string.
|
||||
* <p>
|
||||
* After calling this method, one is expected to write the given number of string parts. No length checks are performed.<br/>
|
||||
* After all string parts are written, one should write a single break value to end the string, see {@link #writeBreak()}.
|
||||
* </p>
|
||||
*
|
||||
* @throws IOException in case of I/O problems writing the CBOR-encoded value to the underlying output stream.
|
||||
*/
|
||||
public void writeTextStringStart() throws IOException {
|
||||
writeSimpleType(TYPE_TEXT_STRING, BREAK);
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes an "undefined" value in canonical CBOR format.
|
||||
*
|
||||
* @throws IOException in case of I/O problems writing the CBOR-encoded value to the underlying output stream.
|
||||
*/
|
||||
public void writeUndefined() throws IOException {
|
||||
writeSimpleType(TYPE_FLOAT_SIMPLE, UNDEFINED);
|
||||
}
|
||||
|
||||
/**
|
||||
* Encodes and writes the major type and value as a simple type.
|
||||
*
|
||||
* @param majorType the major type of the value to write, denotes what semantics the written value has;
|
||||
* @param value the value to write, values from [0..31] are supported.
|
||||
* @throws IOException in case of I/O problems writing the CBOR-encoded value to the underlying output stream.
|
||||
*/
|
||||
protected void writeSimpleType(int majorType, int value) throws IOException {
|
||||
m_os.write((majorType << 5) | (value & 0x1f));
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes a byte string in canonical CBOR-format.
|
||||
*
|
||||
* @param majorType the major type of the string, should be either 0x40 or 0x60;
|
||||
* @param value the byte string to write, can be <code>null</code> in which case a byte-string of length <tt>0</tt> is written.
|
||||
* @throws IOException in case of I/O problems writing the CBOR-encoded value to the underlying output stream.
|
||||
*/
|
||||
protected void writeString(int majorType, byte[] bytes) throws IOException {
|
||||
int len = (bytes == null) ? 0 : bytes.length;
|
||||
writeType(majorType, len);
|
||||
for (int i = 0; i < len; i++) {
|
||||
m_os.write(bytes[i]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Encodes and writes the major type indicator with a given payload (length).
|
||||
*
|
||||
* @param majorType the major type of the value to write, denotes what semantics the written value has;
|
||||
* @param value the value to write, values from {@link Long#MIN_VALUE} to {@link Long#MAX_VALUE} are supported.
|
||||
* @throws IOException in case of I/O problems writing the CBOR-encoded value to the underlying output stream.
|
||||
*/
|
||||
protected void writeType(int majorType, long value) throws IOException {
|
||||
writeUInt((majorType << 5), value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Encodes and writes an unsigned integer value, that is, tries to encode it in a little bytes as possible.
|
||||
*
|
||||
* @param mt the major type of the value to write, denotes what semantics the written value has;
|
||||
* @param value the value to write, values from {@link Long#MIN_VALUE} to {@link Long#MAX_VALUE} are supported.
|
||||
* @throws IOException in case of I/O problems writing the CBOR-encoded value to the underlying output stream.
|
||||
*/
|
||||
protected void writeUInt(int mt, long value) throws IOException {
|
||||
if (value < 0x18L) {
|
||||
m_os.write((int) (mt | value));
|
||||
} else if (value < 0x100L) {
|
||||
writeUInt8(mt, (int) value);
|
||||
} else if (value < 0x10000L) {
|
||||
writeUInt16(mt, (int) value);
|
||||
} else if (value < 0x100000000L) {
|
||||
writeUInt32(mt, (int) value);
|
||||
} else {
|
||||
writeUInt64(mt, value);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Encodes and writes an unsigned 16-bit integer value
|
||||
*
|
||||
* @param mt the major type of the value to write, denotes what semantics the written value has;
|
||||
* @param value the value to write, values from {@link Long#MIN_VALUE} to {@link Long#MAX_VALUE} are supported.
|
||||
* @throws IOException in case of I/O problems writing the CBOR-encoded value to the underlying output stream.
|
||||
*/
|
||||
protected void writeUInt16(int mt, int value) throws IOException {
|
||||
m_os.write(mt | TWO_BYTES);
|
||||
m_os.write(value >> 8);
|
||||
m_os.write(value & 0xFF);
|
||||
}
|
||||
|
||||
/**
|
||||
* Encodes and writes an unsigned 32-bit integer value
|
||||
*
|
||||
* @param mt the major type of the value to write, denotes what semantics the written value has;
|
||||
* @param value the value to write, values from {@link Long#MIN_VALUE} to {@link Long#MAX_VALUE} are supported.
|
||||
* @throws IOException in case of I/O problems writing the CBOR-encoded value to the underlying output stream.
|
||||
*/
|
||||
protected void writeUInt32(int mt, int value) throws IOException {
|
||||
m_os.write(mt | FOUR_BYTES);
|
||||
m_os.write(value >> 24);
|
||||
m_os.write(value >> 16);
|
||||
m_os.write(value >> 8);
|
||||
m_os.write(value & 0xFF);
|
||||
}
|
||||
|
||||
/**
|
||||
* Encodes and writes an unsigned 64-bit integer value
|
||||
*
|
||||
* @param mt the major type of the value to write, denotes what semantics the written value has;
|
||||
* @param value the value to write, values from {@link Long#MIN_VALUE} to {@link Long#MAX_VALUE} are supported.
|
||||
* @throws IOException in case of I/O problems writing the CBOR-encoded value to the underlying output stream.
|
||||
*/
|
||||
protected void writeUInt64(int mt, long value) throws IOException {
|
||||
m_os.write(mt | EIGHT_BYTES);
|
||||
m_os.write((int) (value >> 56));
|
||||
m_os.write((int) (value >> 48));
|
||||
m_os.write((int) (value >> 40));
|
||||
m_os.write((int) (value >> 32));
|
||||
m_os.write((int) (value >> 24));
|
||||
m_os.write((int) (value >> 16));
|
||||
m_os.write((int) (value >> 8));
|
||||
m_os.write((int) (value & 0xFF));
|
||||
}
|
||||
|
||||
/**
|
||||
* Encodes and writes an unsigned 8-bit integer value
|
||||
*
|
||||
* @param mt the major type of the value to write, denotes what semantics the written value has;
|
||||
* @param value the value to write, values from {@link Long#MIN_VALUE} to {@link Long#MAX_VALUE} are supported.
|
||||
* @throws IOException in case of I/O problems writing the CBOR-encoded value to the underlying output stream.
|
||||
*/
|
||||
protected void writeUInt8(int mt, int value) throws IOException {
|
||||
m_os.write(mt | ONE_BYTE);
|
||||
m_os.write(value & 0xFF);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,142 +0,0 @@
|
|||
/*
|
||||
* JACOB - CBOR implementation in Java.
|
||||
*
|
||||
* (C) Copyright - 2013 - J.W. Janssen <j.w.janssen@lxtreme.nl>
|
||||
*
|
||||
* Licensed under Apache License v2.0.
|
||||
*/
|
||||
package jacob;
|
||||
|
||||
import static jacob.CborConstants.*;
|
||||
|
||||
/**
|
||||
* Represents the various major types in CBOR, along with their .
|
||||
* <p>
|
||||
* The major type is encoded in the upper three bits of each initial byte. The lower 5 bytes represent any additional information.
|
||||
* </p>
|
||||
*/
|
||||
public class CborType {
|
||||
private final int m_major;
|
||||
private final int m_additional;
|
||||
|
||||
private CborType(int major, int additional) {
|
||||
m_major = major;
|
||||
m_additional = additional;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a descriptive string for the given major type.
|
||||
*
|
||||
* @param mt the major type to return as string, values from [0..7] are supported.
|
||||
* @return the name of the given major type, as String, never <code>null</code>.
|
||||
* @throws IllegalArgumentException in case the given major type is not supported.
|
||||
*/
|
||||
public static String getName(int mt) {
|
||||
switch (mt) {
|
||||
case TYPE_ARRAY:
|
||||
return "array";
|
||||
case TYPE_BYTE_STRING:
|
||||
return "byte string";
|
||||
case TYPE_FLOAT_SIMPLE:
|
||||
return "float/simple value";
|
||||
case TYPE_MAP:
|
||||
return "map";
|
||||
case TYPE_NEGATIVE_INTEGER:
|
||||
return "negative integer";
|
||||
case TYPE_TAG:
|
||||
return "tag";
|
||||
case TYPE_TEXT_STRING:
|
||||
return "text string";
|
||||
case TYPE_UNSIGNED_INTEGER:
|
||||
return "unsigned integer";
|
||||
default:
|
||||
throw new IllegalArgumentException("Invalid major type: " + mt);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Decodes a given byte value to a {@link CborType} value.
|
||||
*
|
||||
* @param i the input byte (8-bit) to decode into a {@link CborType} instance.
|
||||
* @return a {@link CborType} instance, never <code>null</code>.
|
||||
*/
|
||||
public static CborType valueOf(int i) {
|
||||
return new CborType((i & 0xff) >>> 5, i & 0x1f);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
if (obj == null || getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
CborType other = (CborType) obj;
|
||||
return (m_major == other.m_major) && (m_additional == other.m_additional);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the additional information of this type, as integer value from [0..31].
|
||||
*/
|
||||
public int getAdditionalInfo() {
|
||||
return m_additional;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the major type, as integer value from [0..7].
|
||||
*/
|
||||
public int getMajorType() {
|
||||
return m_major;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + m_additional;
|
||||
result = prime * result + m_major;
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return <code>true</code> if this type allows for an infinite-length payload,
|
||||
* <code>false</code> if only definite-length payloads are allowed.
|
||||
*/
|
||||
public boolean isBreakAllowed() {
|
||||
return m_major == TYPE_ARRAY || m_major == TYPE_BYTE_STRING || m_major == TYPE_MAP
|
||||
|| m_major == TYPE_TEXT_STRING;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines whether the major type of a given {@link CborType} equals the major type of this {@link CborType}.
|
||||
*
|
||||
* @param other the {@link CborType} to compare against, cannot be <code>null</code>.
|
||||
* @return <code>true</code> if the given {@link CborType} is of the same major type as this {@link CborType}, <code>false</code> otherwise.
|
||||
* @throws IllegalArgumentException in case the given argument was <code>null</code>.
|
||||
*/
|
||||
public boolean isEqualType(CborType other) {
|
||||
if (other == null) {
|
||||
throw new IllegalArgumentException("Parameter cannot be null!");
|
||||
}
|
||||
return m_major == other.m_major;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines whether the major type of a given byte value (representing an encoded {@link CborType}) equals the major type of this {@link CborType}.
|
||||
*
|
||||
* @param encoded the encoded CBOR type to compare.
|
||||
* @return <code>true</code> if the given byte value represents the same major type as this {@link CborType}, <code>false</code> otherwise.
|
||||
*/
|
||||
public boolean isEqualType(int encoded) {
|
||||
return m_major == ((encoded & 0xff) >>> 5);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(getName(m_major)).append('(').append(m_additional).append(')');
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
2
pom.xml
2
pom.xml
|
|
@ -12,6 +12,8 @@
|
|||
<modules>
|
||||
<module>rustlib</module>
|
||||
<module>agent</module>
|
||||
<module>api</module>
|
||||
<module>concurrency-test</module>
|
||||
</modules>
|
||||
|
||||
</project>
|
||||
124
results/index.html
Normal file
124
results/index.html
Normal file
|
|
@ -0,0 +1,124 @@
|
|||
|
||||
<html>
|
||||
<head>
|
||||
<title>Java Concurrency Stress test report</title>
|
||||
<style type="text/css">
|
||||
* { font-family: Arial; }
|
||||
table { font-size: 9pt; }
|
||||
a { color: #000000; }
|
||||
.progress { padding: 0px; }
|
||||
.header { text-align: left; }
|
||||
.section1 { font-size: 12pt; background-color: #BDB76B; color: #000000; font-weight: bold;}
|
||||
.section2 { font-size: 12pt; background-color: #F0E68C; color: #000000; font-weight: bold;}
|
||||
.cell1 { background-color: #FAFAD2; }
|
||||
.cell2 { background-color: #EEE8AA; }
|
||||
.passedProgress { background-color: #00AA00; color: #FFFFFF; text-align: center; font-weight: bold; }
|
||||
.failedProgress { background-color: #FF0000; color: #FFFFFF; text-align: center; font-weight: bold; }
|
||||
.passed { color: #00AA00; text-align: center; font-weight: bold; }
|
||||
.failed { color: #FF0000; text-align: center; font-weight: bold; }
|
||||
.interesting { color: #0000FF; text-align: center; font-weight: bold; }
|
||||
.spec { color: #AAAA00; text-align: center; font-weight: bold; }
|
||||
.endResult { font-size: 48pt; text-align: center; font-weight: bold; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<table width="100%" cellspacing="20">
|
||||
<tr>
|
||||
<td>
|
||||
<p class="endResult passed">
|
||||
100%
|
||||
</p>
|
||||
<table width="100%" cellpadding="3" cellspacing="0">
|
||||
<tr><td width="100%" class="passedProgress"> </td></tr>
|
||||
<tr><td nowrap><b>Overall pass rate:</b> 1/1 </td></tr>
|
||||
</table>
|
||||
<br>
|
||||
</td>
|
||||
<td width=100>
|
||||
<table>
|
||||
<tr>
|
||||
<td nowrap>java.specification.name</td>
|
||||
<td nowrap>Java Platform API Specification</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap>java.specification.vendor</td>
|
||||
<td nowrap>Oracle Corporation</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap>java.specification.version</td>
|
||||
<td nowrap>22</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap>java.vendor</td>
|
||||
<td nowrap>Oracle Corporation</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap>java.version</td>
|
||||
<td nowrap>22</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap>java.vm.name</td>
|
||||
<td nowrap>OpenJDK 64-Bit Server VM</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap>java.vm.vendor</td>
|
||||
<td nowrap>Oracle Corporation</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap>java.vm.version</td>
|
||||
<td nowrap>22+36-2370</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap>os.arch</td>
|
||||
<td nowrap>aarch64</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap>os.name</td>
|
||||
<td nowrap>Mac OS X</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap>os.version</td>
|
||||
<td nowrap>14.6.1</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<hr>
|
||||
<h3>FAILED tests</h3>
|
||||
<p>Strong asserts were violated. Correct implementations should have no assert failures here.</p>
|
||||
<table cellspacing=0 cellpadding=3 width="100%">
|
||||
</table>
|
||||
None!
|
||||
<br>
|
||||
<br>
|
||||
<hr>
|
||||
<h3>ERROR tests</h3>
|
||||
<p>Tests break for some reason, other than failing the assert. Correct implementations should have none.</p>
|
||||
<table cellspacing=0 cellpadding=3 width="100%">
|
||||
</table>
|
||||
None!
|
||||
<br>
|
||||
<br>
|
||||
<hr>
|
||||
<h3>INTERESTING tests</h3>
|
||||
<p>Some interesting behaviors observed. This is for the plain curiosity.</p>
|
||||
<table cellspacing=0 cellpadding=3 width="100%">
|
||||
</table>
|
||||
None!
|
||||
<br>
|
||||
<br>
|
||||
<hr>
|
||||
<h3>All tests</h3>
|
||||
<p></p>
|
||||
<table cellspacing=0 cellpadding=3 width="100%">
|
||||
<tr class="cell2">
|
||||
<td> <a href="org.github.shautvast.exceptional.StressTest.html">org.github.shautvast.exceptional.StressTest</a></td>
|
||||
<td>10<sup>8</sup></td><td class="passed">PASSED</td>
|
||||
<td class="interesting"></td>
|
||||
<td class="passed"></td>
|
||||
</tr>
|
||||
</table>
|
||||
<br>
|
||||
</body>
|
||||
</html>
|
||||
568
results/org.github.shautvast.exceptional.ConstructorBasic.html
Normal file
568
results/org.github.shautvast.exceptional.ConstructorBasic.html
Normal file
|
|
@ -0,0 +1,568 @@
|
|||
|
||||
<html>
|
||||
<head>
|
||||
<title>Java Concurrency Stress test report</title>
|
||||
<style type="text/css">
|
||||
* { font-family: Arial; }
|
||||
table { font-size: 9pt; }
|
||||
a { color: #000000; }
|
||||
.progress { padding: 0px; }
|
||||
.header { text-align: left; }
|
||||
.section1 { font-size: 12pt; background-color: #BDB76B; color: #000000; font-weight: bold;}
|
||||
.section2 { font-size: 12pt; background-color: #F0E68C; color: #000000; font-weight: bold;}
|
||||
.cell1 { background-color: #FAFAD2; }
|
||||
.cell2 { background-color: #EEE8AA; }
|
||||
.passedProgress { background-color: #00AA00; color: #FFFFFF; text-align: center; font-weight: bold; }
|
||||
.failedProgress { background-color: #FF0000; color: #FFFFFF; text-align: center; font-weight: bold; }
|
||||
.passed { color: #00AA00; text-align: center; font-weight: bold; }
|
||||
.failed { color: #FF0000; text-align: center; font-weight: bold; }
|
||||
.interesting { color: #0000FF; text-align: center; font-weight: bold; }
|
||||
.spec { color: #AAAA00; text-align: center; font-weight: bold; }
|
||||
.endResult { font-size: 48pt; text-align: center; font-weight: bold; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1>org.github.shautvast.exceptional.StressTest</h1>
|
||||
<h3>Description and references</h3>
|
||||
<p>null</p>
|
||||
<h3>Environment</h3>
|
||||
<table>
|
||||
<tr>
|
||||
<td nowrap>java.specification.name</td>
|
||||
<td nowrap>Java Platform API Specification</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap>java.specification.vendor</td>
|
||||
<td nowrap>Oracle Corporation</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap>java.specification.version</td>
|
||||
<td nowrap>22</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap>java.vendor</td>
|
||||
<td nowrap>Oracle Corporation</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap>java.version</td>
|
||||
<td nowrap>22</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap>java.vm.name</td>
|
||||
<td nowrap>OpenJDK 64-Bit Server VM</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap>java.vm.vendor</td>
|
||||
<td nowrap>Oracle Corporation</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap>java.vm.version</td>
|
||||
<td nowrap>22+36-2370</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap>os.arch</td>
|
||||
<td nowrap>aarch64</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap>os.name</td>
|
||||
<td nowrap>Mac OS X</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap>os.version</td>
|
||||
<td nowrap>14.3.1</td>
|
||||
</tr>
|
||||
</table>
|
||||
<h3>Results</h3>
|
||||
<table cellpadding=5 border=1>
|
||||
<tr>
|
||||
<th>Compilation Mode</th>
|
||||
<th>Scheduling Class</th>
|
||||
<th>Java Options</th>
|
||||
<th>Status</th>
|
||||
<th colspan=1>Observed States</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th colspan=4></th>
|
||||
<th nowrap align='center'>0</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan=4></td>
|
||||
<td>Forbidden</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan=4></td>
|
||||
<td>No default case provided, assume Forbidden</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap valign=top width=10><pre>split
|
||||
actor1: Interpreter
|
||||
actor2: Interpreter
|
||||
</pre></td>
|
||||
<td nowrap valign=top width=10><pre> actor1: package group free, core group free
|
||||
actor2: package group free, core group free
|
||||
</pre></td>
|
||||
<td valign=top width=10>
|
||||
</td>
|
||||
<td align='center' bgColor='red '>FAILED</td>
|
||||
<td align='right' width='100.0%' bgColor=#ff0000>30902291</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap valign=top width=10><pre>split
|
||||
actor1: C1
|
||||
actor2: Interpreter
|
||||
</pre></td>
|
||||
<td nowrap valign=top width=10><pre> actor1: package group free, core group free
|
||||
actor2: package group free, core group free
|
||||
</pre></td>
|
||||
<td valign=top width=10>
|
||||
</td>
|
||||
<td align='center' bgColor='red '>FAILED</td>
|
||||
<td align='right' width='100.0%' bgColor=#ff0000>32448531</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap valign=top width=10><pre>split
|
||||
actor1: C2
|
||||
actor2: Interpreter
|
||||
</pre></td>
|
||||
<td nowrap valign=top width=10><pre> actor1: package group free, core group free
|
||||
actor2: package group free, core group free
|
||||
</pre></td>
|
||||
<td valign=top width=10>
|
||||
</td>
|
||||
<td align='center' bgColor='red '>FAILED</td>
|
||||
<td align='right' width='100.0%' bgColor=#ff0000>32417811</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap valign=top width=10><pre>split
|
||||
actor1: C2
|
||||
actor2: Interpreter
|
||||
</pre></td>
|
||||
<td nowrap valign=top width=10><pre> actor1: package group free, core group free
|
||||
actor2: package group free, core group free
|
||||
</pre></td>
|
||||
<td valign=top width=10>
|
||||
<pre>[-XX:+StressLCM, -XX:+StressGCM, -XX:+StressIGVN, -XX:+StressCCP, -XX:StressSeed=1042557900]</pre>
|
||||
</td>
|
||||
<td align='center' bgColor='red '>FAILED</td>
|
||||
<td align='right' width='100.0%' bgColor=#ff0000>32315411</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap valign=top width=10><pre>split
|
||||
actor1: C2
|
||||
actor2: Interpreter
|
||||
</pre></td>
|
||||
<td nowrap valign=top width=10><pre> actor1: package group free, core group free
|
||||
actor2: package group free, core group free
|
||||
</pre></td>
|
||||
<td valign=top width=10>
|
||||
<pre>[-XX:+StressLCM, -XX:+StressGCM, -XX:+StressIGVN, -XX:+StressCCP, -XX:StressSeed=1075505546]</pre>
|
||||
</td>
|
||||
<td align='center' bgColor='red '>FAILED</td>
|
||||
<td align='right' width='100.0%' bgColor=#ff0000>31045651</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap valign=top width=10><pre>split
|
||||
actor1: C2
|
||||
actor2: Interpreter
|
||||
</pre></td>
|
||||
<td nowrap valign=top width=10><pre> actor1: package group free, core group free
|
||||
actor2: package group free, core group free
|
||||
</pre></td>
|
||||
<td valign=top width=10>
|
||||
<pre>[-XX:+StressLCM, -XX:+StressGCM, -XX:+StressIGVN, -XX:+StressCCP, -XX:StressSeed=1297563461]</pre>
|
||||
</td>
|
||||
<td align='center' bgColor='red '>FAILED</td>
|
||||
<td align='right' width='100.0%' bgColor=#ff0000>31352851</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap valign=top width=10><pre>split
|
||||
actor1: C2
|
||||
actor2: Interpreter
|
||||
</pre></td>
|
||||
<td nowrap valign=top width=10><pre> actor1: package group free, core group free
|
||||
actor2: package group free, core group free
|
||||
</pre></td>
|
||||
<td valign=top width=10>
|
||||
<pre>[-XX:+StressLCM, -XX:+StressGCM, -XX:+StressIGVN, -XX:+StressCCP, -XX:StressSeed=341109036]</pre>
|
||||
</td>
|
||||
<td align='center' bgColor='red '>FAILED</td>
|
||||
<td align='right' width='100.0%' bgColor=#ff0000>32929811</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap valign=top width=10><pre>split
|
||||
actor1: C2
|
||||
actor2: Interpreter
|
||||
</pre></td>
|
||||
<td nowrap valign=top width=10><pre> actor1: package group free, core group free
|
||||
actor2: package group free, core group free
|
||||
</pre></td>
|
||||
<td valign=top width=10>
|
||||
<pre>[-XX:+StressLCM, -XX:+StressGCM, -XX:+StressIGVN, -XX:+StressCCP, -XX:StressSeed=743091320]</pre>
|
||||
</td>
|
||||
<td align='center' bgColor='red '>FAILED</td>
|
||||
<td align='right' width='100.0%' bgColor=#ff0000>30871571</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap valign=top width=10><pre>split
|
||||
actor1: Interpreter
|
||||
actor2: C1
|
||||
</pre></td>
|
||||
<td nowrap valign=top width=10><pre> actor1: package group free, core group free
|
||||
actor2: package group free, core group free
|
||||
</pre></td>
|
||||
<td valign=top width=10>
|
||||
</td>
|
||||
<td align='center' bgColor='red '>FAILED</td>
|
||||
<td align='right' width='100.0%' bgColor=#ff0000>38285331</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap valign=top width=10><pre>split
|
||||
actor1: C1
|
||||
actor2: C1
|
||||
</pre></td>
|
||||
<td nowrap valign=top width=10><pre> actor1: package group free, core group free
|
||||
actor2: package group free, core group free
|
||||
</pre></td>
|
||||
<td valign=top width=10>
|
||||
</td>
|
||||
<td align='center' bgColor='red '>FAILED</td>
|
||||
<td align='right' width='100.0%' bgColor=#ff0000>57024531</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap valign=top width=10><pre>split
|
||||
actor1: C2
|
||||
actor2: C1
|
||||
</pre></td>
|
||||
<td nowrap valign=top width=10><pre> actor1: package group free, core group free
|
||||
actor2: package group free, core group free
|
||||
</pre></td>
|
||||
<td valign=top width=10>
|
||||
</td>
|
||||
<td align='center' bgColor='red '>FAILED</td>
|
||||
<td align='right' width='100.0%' bgColor=#ff0000>65288211</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap valign=top width=10><pre>split
|
||||
actor1: C2
|
||||
actor2: C1
|
||||
</pre></td>
|
||||
<td nowrap valign=top width=10><pre> actor1: package group free, core group free
|
||||
actor2: package group free, core group free
|
||||
</pre></td>
|
||||
<td valign=top width=10>
|
||||
<pre>[-XX:+StressLCM, -XX:+StressGCM, -XX:+StressIGVN, -XX:+StressCCP, -XX:StressSeed=1475905266]</pre>
|
||||
</td>
|
||||
<td align='center' bgColor='red '>FAILED</td>
|
||||
<td align='right' width='100.0%' bgColor=#ff0000>64960531</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap valign=top width=10><pre>split
|
||||
actor1: C2
|
||||
actor2: C1
|
||||
</pre></td>
|
||||
<td nowrap valign=top width=10><pre> actor1: package group free, core group free
|
||||
actor2: package group free, core group free
|
||||
</pre></td>
|
||||
<td valign=top width=10>
|
||||
<pre>[-XX:+StressLCM, -XX:+StressGCM, -XX:+StressIGVN, -XX:+StressCCP, -XX:StressSeed=1751296682]</pre>
|
||||
</td>
|
||||
<td align='center' bgColor='red '>FAILED</td>
|
||||
<td align='right' width='100.0%' bgColor=#ff0000>66496531</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap valign=top width=10><pre>split
|
||||
actor1: C2
|
||||
actor2: C1
|
||||
</pre></td>
|
||||
<td nowrap valign=top width=10><pre> actor1: package group free, core group free
|
||||
actor2: package group free, core group free
|
||||
</pre></td>
|
||||
<td valign=top width=10>
|
||||
<pre>[-XX:+StressLCM, -XX:+StressGCM, -XX:+StressIGVN, -XX:+StressCCP, -XX:StressSeed=296131663]</pre>
|
||||
</td>
|
||||
<td align='center' bgColor='red '>FAILED</td>
|
||||
<td align='right' width='100.0%' bgColor=#ff0000>63107091</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap valign=top width=10><pre>split
|
||||
actor1: C2
|
||||
actor2: C1
|
||||
</pre></td>
|
||||
<td nowrap valign=top width=10><pre> actor1: package group free, core group free
|
||||
actor2: package group free, core group free
|
||||
</pre></td>
|
||||
<td valign=top width=10>
|
||||
<pre>[-XX:+StressLCM, -XX:+StressGCM, -XX:+StressIGVN, -XX:+StressCCP, -XX:StressSeed=604532419]</pre>
|
||||
</td>
|
||||
<td align='center' bgColor='red '>FAILED</td>
|
||||
<td align='right' width='100.0%' bgColor=#ff0000>60383251</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap valign=top width=10><pre>split
|
||||
actor1: C2
|
||||
actor2: C1
|
||||
</pre></td>
|
||||
<td nowrap valign=top width=10><pre> actor1: package group free, core group free
|
||||
actor2: package group free, core group free
|
||||
</pre></td>
|
||||
<td valign=top width=10>
|
||||
<pre>[-XX:+StressLCM, -XX:+StressGCM, -XX:+StressIGVN, -XX:+StressCCP, -XX:StressSeed=748857893]</pre>
|
||||
</td>
|
||||
<td align='center' bgColor='red '>FAILED</td>
|
||||
<td align='right' width='100.0%' bgColor=#ff0000>60332051</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap valign=top width=10><pre>split
|
||||
actor1: Interpreter
|
||||
actor2: C2
|
||||
</pre></td>
|
||||
<td nowrap valign=top width=10><pre> actor1: package group free, core group free
|
||||
actor2: package group free, core group free
|
||||
</pre></td>
|
||||
<td valign=top width=10>
|
||||
</td>
|
||||
<td align='center' bgColor='red '>FAILED</td>
|
||||
<td align='right' width='100.0%' bgColor=#ff0000>38797331</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap valign=top width=10><pre>split
|
||||
actor1: Interpreter
|
||||
actor2: C2
|
||||
</pre></td>
|
||||
<td nowrap valign=top width=10><pre> actor1: package group free, core group free
|
||||
actor2: package group free, core group free
|
||||
</pre></td>
|
||||
<td valign=top width=10>
|
||||
<pre>[-XX:+StressLCM, -XX:+StressGCM, -XX:+StressIGVN, -XX:+StressCCP, -XX:StressSeed=1665729567]</pre>
|
||||
</td>
|
||||
<td align='center' bgColor='red '>FAILED</td>
|
||||
<td align='right' width='100.0%' bgColor=#ff0000>38613011</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap valign=top width=10><pre>split
|
||||
actor1: Interpreter
|
||||
actor2: C2
|
||||
</pre></td>
|
||||
<td nowrap valign=top width=10><pre> actor1: package group free, core group free
|
||||
actor2: package group free, core group free
|
||||
</pre></td>
|
||||
<td valign=top width=10>
|
||||
<pre>[-XX:+StressLCM, -XX:+StressGCM, -XX:+StressIGVN, -XX:+StressCCP, -XX:StressSeed=1856278423]</pre>
|
||||
</td>
|
||||
<td align='center' bgColor='red '>FAILED</td>
|
||||
<td align='right' width='100.0%' bgColor=#ff0000>39002131</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap valign=top width=10><pre>split
|
||||
actor1: Interpreter
|
||||
actor2: C2
|
||||
</pre></td>
|
||||
<td nowrap valign=top width=10><pre> actor1: package group free, core group free
|
||||
actor2: package group free, core group free
|
||||
</pre></td>
|
||||
<td valign=top width=10>
|
||||
<pre>[-XX:+StressLCM, -XX:+StressGCM, -XX:+StressIGVN, -XX:+StressCCP, -XX:StressSeed=2102286780]</pre>
|
||||
</td>
|
||||
<td align='center' bgColor='red '>FAILED</td>
|
||||
<td align='right' width='100.0%' bgColor=#ff0000>37486611</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap valign=top width=10><pre>split
|
||||
actor1: Interpreter
|
||||
actor2: C2
|
||||
</pre></td>
|
||||
<td nowrap valign=top width=10><pre> actor1: package group free, core group free
|
||||
actor2: package group free, core group free
|
||||
</pre></td>
|
||||
<td valign=top width=10>
|
||||
<pre>[-XX:+StressLCM, -XX:+StressGCM, -XX:+StressIGVN, -XX:+StressCCP, -XX:StressSeed=346933759]</pre>
|
||||
</td>
|
||||
<td align='center' bgColor='red '>FAILED</td>
|
||||
<td align='right' width='100.0%' bgColor=#ff0000>39391251</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap valign=top width=10><pre>split
|
||||
actor1: Interpreter
|
||||
actor2: C2
|
||||
</pre></td>
|
||||
<td nowrap valign=top width=10><pre> actor1: package group free, core group free
|
||||
actor2: package group free, core group free
|
||||
</pre></td>
|
||||
<td valign=top width=10>
|
||||
<pre>[-XX:+StressLCM, -XX:+StressGCM, -XX:+StressIGVN, -XX:+StressCCP, -XX:StressSeed=906592642]</pre>
|
||||
</td>
|
||||
<td align='center' bgColor='red '>FAILED</td>
|
||||
<td align='right' width='100.0%' bgColor=#ff0000>37230611</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap valign=top width=10><pre>split
|
||||
actor1: C1
|
||||
actor2: C2
|
||||
</pre></td>
|
||||
<td nowrap valign=top width=10><pre> actor1: package group free, core group free
|
||||
actor2: package group free, core group free
|
||||
</pre></td>
|
||||
<td valign=top width=10>
|
||||
</td>
|
||||
<td align='center' bgColor='red '>FAILED</td>
|
||||
<td align='right' width='100.0%' bgColor=#ff0000>108470291</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap valign=top width=10><pre>split
|
||||
actor1: C1
|
||||
actor2: C2
|
||||
</pre></td>
|
||||
<td nowrap valign=top width=10><pre> actor1: package group free, core group free
|
||||
actor2: package group free, core group free
|
||||
</pre></td>
|
||||
<td valign=top width=10>
|
||||
<pre>[-XX:+StressLCM, -XX:+StressGCM, -XX:+StressIGVN, -XX:+StressCCP, -XX:StressSeed=1805276407]</pre>
|
||||
</td>
|
||||
<td align='center' bgColor='red '>FAILED</td>
|
||||
<td align='right' width='100.0%' bgColor=#ff0000>106893331</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap valign=top width=10><pre>split
|
||||
actor1: C1
|
||||
actor2: C2
|
||||
</pre></td>
|
||||
<td nowrap valign=top width=10><pre> actor1: package group free, core group free
|
||||
actor2: package group free, core group free
|
||||
</pre></td>
|
||||
<td valign=top width=10>
|
||||
<pre>[-XX:+StressLCM, -XX:+StressGCM, -XX:+StressIGVN, -XX:+StressCCP, -XX:StressSeed=2146860082]</pre>
|
||||
</td>
|
||||
<td align='center' bgColor='red '>FAILED</td>
|
||||
<td align='right' width='100.0%' bgColor=#ff0000>51945491</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap valign=top width=10><pre>split
|
||||
actor1: C1
|
||||
actor2: C2
|
||||
</pre></td>
|
||||
<td nowrap valign=top width=10><pre> actor1: package group free, core group free
|
||||
actor2: package group free, core group free
|
||||
</pre></td>
|
||||
<td valign=top width=10>
|
||||
<pre>[-XX:+StressLCM, -XX:+StressGCM, -XX:+StressIGVN, -XX:+StressCCP, -XX:StressSeed=263133163]</pre>
|
||||
</td>
|
||||
<td align='center' bgColor='red '>FAILED</td>
|
||||
<td align='right' width='100.0%' bgColor=#ff0000>55191571</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap valign=top width=10><pre>split
|
||||
actor1: C1
|
||||
actor2: C2
|
||||
</pre></td>
|
||||
<td nowrap valign=top width=10><pre> actor1: package group free, core group free
|
||||
actor2: package group free, core group free
|
||||
</pre></td>
|
||||
<td valign=top width=10>
|
||||
<pre>[-XX:+StressLCM, -XX:+StressGCM, -XX:+StressIGVN, -XX:+StressCCP, -XX:StressSeed=710335425]</pre>
|
||||
</td>
|
||||
<td align='center' bgColor='red '>FAILED</td>
|
||||
<td align='right' width='100.0%' bgColor=#ff0000>59256851</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap valign=top width=10><pre>split
|
||||
actor1: C1
|
||||
actor2: C2
|
||||
</pre></td>
|
||||
<td nowrap valign=top width=10><pre> actor1: package group free, core group free
|
||||
actor2: package group free, core group free
|
||||
</pre></td>
|
||||
<td valign=top width=10>
|
||||
<pre>[-XX:+StressLCM, -XX:+StressGCM, -XX:+StressIGVN, -XX:+StressCCP, -XX:StressSeed=823945074]</pre>
|
||||
</td>
|
||||
<td align='center' bgColor='red '>FAILED</td>
|
||||
<td align='right' width='100.0%' bgColor=#ff0000>54935571</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap valign=top width=10><pre>split
|
||||
actor1: C2
|
||||
actor2: C2
|
||||
</pre></td>
|
||||
<td nowrap valign=top width=10><pre> actor1: package group free, core group free
|
||||
actor2: package group free, core group free
|
||||
</pre></td>
|
||||
<td valign=top width=10>
|
||||
</td>
|
||||
<td align='center' bgColor='red '>FAILED</td>
|
||||
<td align='right' width='100.0%' bgColor=#ff0000>68554771</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap valign=top width=10><pre>split
|
||||
actor1: C2
|
||||
actor2: C2
|
||||
</pre></td>
|
||||
<td nowrap valign=top width=10><pre> actor1: package group free, core group free
|
||||
actor2: package group free, core group free
|
||||
</pre></td>
|
||||
<td valign=top width=10>
|
||||
<pre>[-XX:+StressLCM, -XX:+StressGCM, -XX:+StressIGVN, -XX:+StressCCP, -XX:StressSeed=1040062964]</pre>
|
||||
</td>
|
||||
<td align='center' bgColor='red '>FAILED</td>
|
||||
<td align='right' width='100.0%' bgColor=#ff0000>63219731</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap valign=top width=10><pre>split
|
||||
actor1: C2
|
||||
actor2: C2
|
||||
</pre></td>
|
||||
<td nowrap valign=top width=10><pre> actor1: package group free, core group free
|
||||
actor2: package group free, core group free
|
||||
</pre></td>
|
||||
<td valign=top width=10>
|
||||
<pre>[-XX:+StressLCM, -XX:+StressGCM, -XX:+StressIGVN, -XX:+StressCCP, -XX:StressSeed=1158731359]</pre>
|
||||
</td>
|
||||
<td align='center' bgColor='red '>FAILED</td>
|
||||
<td align='right' width='100.0%' bgColor=#ff0000>108142611</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap valign=top width=10><pre>split
|
||||
actor1: C2
|
||||
actor2: C2
|
||||
</pre></td>
|
||||
<td nowrap valign=top width=10><pre> actor1: package group free, core group free
|
||||
actor2: package group free, core group free
|
||||
</pre></td>
|
||||
<td valign=top width=10>
|
||||
<pre>[-XX:+StressLCM, -XX:+StressGCM, -XX:+StressIGVN, -XX:+StressCCP, -XX:StressSeed=1247680276]</pre>
|
||||
</td>
|
||||
<td align='center' bgColor='red '>FAILED</td>
|
||||
<td align='right' width='100.0%' bgColor=#ff0000>64458771</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap valign=top width=10><pre>split
|
||||
actor1: C2
|
||||
actor2: C2
|
||||
</pre></td>
|
||||
<td nowrap valign=top width=10><pre> actor1: package group free, core group free
|
||||
actor2: package group free, core group free
|
||||
</pre></td>
|
||||
<td valign=top width=10>
|
||||
<pre>[-XX:+StressLCM, -XX:+StressGCM, -XX:+StressIGVN, -XX:+StressCCP, -XX:StressSeed=486365934]</pre>
|
||||
</td>
|
||||
<td align='center' bgColor='red '>FAILED</td>
|
||||
<td align='right' width='100.0%' bgColor=#ff0000>64602131</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap valign=top width=10><pre>split
|
||||
actor1: C2
|
||||
actor2: C2
|
||||
</pre></td>
|
||||
<td nowrap valign=top width=10><pre> actor1: package group free, core group free
|
||||
actor2: package group free, core group free
|
||||
</pre></td>
|
||||
<td valign=top width=10>
|
||||
<pre>[-XX:+StressLCM, -XX:+StressGCM, -XX:+StressIGVN, -XX:+StressCCP, -XX:StressSeed=83544816]</pre>
|
||||
</td>
|
||||
<td align='center' bgColor='red '>FAILED</td>
|
||||
<td align='right' width='100.0%' bgColor=#ff0000>119826451</td>
|
||||
</tr>
|
||||
</table>
|
||||
<h3>Messages</h3>
|
||||
<h3>VM Output Streams</h3>
|
||||
<h3>VM Error Streams</h3>
|
||||
</body>
|
||||
</html>
|
||||
642
results/org.github.shautvast.exceptional.StressTest.html
Normal file
642
results/org.github.shautvast.exceptional.StressTest.html
Normal file
|
|
@ -0,0 +1,642 @@
|
|||
|
||||
<html>
|
||||
<head>
|
||||
<title>Java Concurrency Stress test report</title>
|
||||
<style type="text/css">
|
||||
* { font-family: Arial; }
|
||||
table { font-size: 9pt; }
|
||||
a { color: #000000; }
|
||||
.progress { padding: 0px; }
|
||||
.header { text-align: left; }
|
||||
.section1 { font-size: 12pt; background-color: #BDB76B; color: #000000; font-weight: bold;}
|
||||
.section2 { font-size: 12pt; background-color: #F0E68C; color: #000000; font-weight: bold;}
|
||||
.cell1 { background-color: #FAFAD2; }
|
||||
.cell2 { background-color: #EEE8AA; }
|
||||
.passedProgress { background-color: #00AA00; color: #FFFFFF; text-align: center; font-weight: bold; }
|
||||
.failedProgress { background-color: #FF0000; color: #FFFFFF; text-align: center; font-weight: bold; }
|
||||
.passed { color: #00AA00; text-align: center; font-weight: bold; }
|
||||
.failed { color: #FF0000; text-align: center; font-weight: bold; }
|
||||
.interesting { color: #0000FF; text-align: center; font-weight: bold; }
|
||||
.spec { color: #AAAA00; text-align: center; font-weight: bold; }
|
||||
.endResult { font-size: 48pt; text-align: center; font-weight: bold; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1>org.github.shautvast.exceptional.StressTest</h1>
|
||||
<h3>Description and references</h3>
|
||||
<p>null</p>
|
||||
<h3>Environment</h3>
|
||||
<table>
|
||||
<tr>
|
||||
<td nowrap>java.specification.name</td>
|
||||
<td nowrap>Java Platform API Specification</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap>java.specification.vendor</td>
|
||||
<td nowrap>Oracle Corporation</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap>java.specification.version</td>
|
||||
<td nowrap>22</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap>java.vendor</td>
|
||||
<td nowrap>Oracle Corporation</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap>java.version</td>
|
||||
<td nowrap>22</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap>java.vm.name</td>
|
||||
<td nowrap>OpenJDK 64-Bit Server VM</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap>java.vm.vendor</td>
|
||||
<td nowrap>Oracle Corporation</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap>java.vm.version</td>
|
||||
<td nowrap>22+36-2370</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap>os.arch</td>
|
||||
<td nowrap>aarch64</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap>os.name</td>
|
||||
<td nowrap>Mac OS X</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap>os.version</td>
|
||||
<td nowrap>14.6.1</td>
|
||||
</tr>
|
||||
</table>
|
||||
<h3>Results</h3>
|
||||
<table cellpadding=5 border=1>
|
||||
<tr>
|
||||
<th>Compilation Mode</th>
|
||||
<th>Scheduling Class</th>
|
||||
<th>Java Options</th>
|
||||
<th>Status</th>
|
||||
<th colspan=3>Observed States</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th colspan=4></th>
|
||||
<th nowrap align='center'>0</th>
|
||||
<th nowrap align='center'>1</th>
|
||||
<th nowrap align='center'>2147483647</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan=4></td>
|
||||
<td>Acceptable</td>
|
||||
<td>Acceptable</td>
|
||||
<td>Acceptable</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan=4></td>
|
||||
<td>Value is correct, or not set</td>
|
||||
<td>Value is correct, or not set</td>
|
||||
<td>Value is correct, or not set</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap valign=top width=10><pre>split
|
||||
actor1: Interpreter
|
||||
actor2: Interpreter
|
||||
</pre></td>
|
||||
<td nowrap valign=top width=10><pre> actor1: package group free, core group free
|
||||
actor2: package group free, core group free
|
||||
</pre></td>
|
||||
<td valign=top width=10>
|
||||
</td>
|
||||
<td align='center' bgColor='green '>OK</td>
|
||||
<td align='right' width='33.333333333333336%' bgColor=#00ff00>2507</td>
|
||||
<td align='right' width='33.333333333333336%' bgColor=#00ff00>6749513</td>
|
||||
<td align='right' width='33.333333333333336%' bgColor=#00ff00>6516991</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap valign=top width=10><pre>split
|
||||
actor1: C1
|
||||
actor2: Interpreter
|
||||
</pre></td>
|
||||
<td nowrap valign=top width=10><pre> actor1: package group free, core group free
|
||||
actor2: package group free, core group free
|
||||
</pre></td>
|
||||
<td valign=top width=10>
|
||||
</td>
|
||||
<td align='center' bgColor='green '>OK</td>
|
||||
<td align='right' width='33.333333333333336%' bgColor=#00ff00>9790</td>
|
||||
<td align='right' width='33.333333333333336%' bgColor=#00ff00>15272488</td>
|
||||
<td align='right' width='33.333333333333336%' bgColor=#00ff00>1939373</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap valign=top width=10><pre>split
|
||||
actor1: C2
|
||||
actor2: Interpreter
|
||||
</pre></td>
|
||||
<td nowrap valign=top width=10><pre> actor1: package group free, core group free
|
||||
actor2: package group free, core group free
|
||||
</pre></td>
|
||||
<td valign=top width=10>
|
||||
</td>
|
||||
<td align='center' bgColor='green '>OK</td>
|
||||
<td align='right' width='33.333333333333336%' bgColor=#00ff00>8541</td>
|
||||
<td align='right' width='33.333333333333336%' bgColor=#00ff00>13115500</td>
|
||||
<td align='right' width='33.333333333333336%' bgColor=#00ff00>2479690</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap valign=top width=10><pre>split
|
||||
actor1: C2
|
||||
actor2: Interpreter
|
||||
</pre></td>
|
||||
<td nowrap valign=top width=10><pre> actor1: package group free, core group free
|
||||
actor2: package group free, core group free
|
||||
</pre></td>
|
||||
<td valign=top width=10>
|
||||
<pre>[-XX:+StressLCM, -XX:+StressGCM, -XX:+StressIGVN, -XX:+StressCCP, -XX:StressSeed=1289469392]</pre>
|
||||
</td>
|
||||
<td align='center' bgColor='green '>OK</td>
|
||||
<td align='right' width='33.333333333333336%' bgColor=#00ff00>8960</td>
|
||||
<td align='right' width='33.333333333333336%' bgColor=#00ff00>12554400</td>
|
||||
<td align='right' width='33.333333333333336%' bgColor=#00ff00>2722931</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap valign=top width=10><pre>split
|
||||
actor1: C2
|
||||
actor2: Interpreter
|
||||
</pre></td>
|
||||
<td nowrap valign=top width=10><pre> actor1: package group free, core group free
|
||||
actor2: package group free, core group free
|
||||
</pre></td>
|
||||
<td valign=top width=10>
|
||||
<pre>[-XX:+StressLCM, -XX:+StressGCM, -XX:+StressIGVN, -XX:+StressCCP, -XX:StressSeed=1334196207]</pre>
|
||||
</td>
|
||||
<td align='center' bgColor='green '>OK</td>
|
||||
<td align='right' width='33.333333333333336%' bgColor=#00ff00>9474</td>
|
||||
<td align='right' width='33.333333333333336%' bgColor=#00ff00>12062665</td>
|
||||
<td align='right' width='33.333333333333336%' bgColor=#00ff00>2077512</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap valign=top width=10><pre>split
|
||||
actor1: C2
|
||||
actor2: Interpreter
|
||||
</pre></td>
|
||||
<td nowrap valign=top width=10><pre> actor1: package group free, core group free
|
||||
actor2: package group free, core group free
|
||||
</pre></td>
|
||||
<td valign=top width=10>
|
||||
<pre>[-XX:+StressLCM, -XX:+StressGCM, -XX:+StressIGVN, -XX:+StressCCP, -XX:StressSeed=1518137892]</pre>
|
||||
</td>
|
||||
<td align='center' bgColor='green '>OK</td>
|
||||
<td align='right' width='33.333333333333336%' bgColor=#00ff00>10866</td>
|
||||
<td align='right' width='33.333333333333336%' bgColor=#00ff00>12504654</td>
|
||||
<td align='right' width='33.333333333333336%' bgColor=#00ff00>2279251</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap valign=top width=10><pre>split
|
||||
actor1: C2
|
||||
actor2: Interpreter
|
||||
</pre></td>
|
||||
<td nowrap valign=top width=10><pre> actor1: package group free, core group free
|
||||
actor2: package group free, core group free
|
||||
</pre></td>
|
||||
<td valign=top width=10>
|
||||
<pre>[-XX:+StressLCM, -XX:+StressGCM, -XX:+StressIGVN, -XX:+StressCCP, -XX:StressSeed=165968267]</pre>
|
||||
</td>
|
||||
<td align='center' bgColor='green '>OK</td>
|
||||
<td align='right' width='33.333333333333336%' bgColor=#00ff00>8998</td>
|
||||
<td align='right' width='33.333333333333336%' bgColor=#00ff00>13327603</td>
|
||||
<td align='right' width='33.333333333333336%' bgColor=#00ff00>2338810</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap valign=top width=10><pre>split
|
||||
actor1: C2
|
||||
actor2: Interpreter
|
||||
</pre></td>
|
||||
<td nowrap valign=top width=10><pre> actor1: package group free, core group free
|
||||
actor2: package group free, core group free
|
||||
</pre></td>
|
||||
<td valign=top width=10>
|
||||
<pre>[-XX:+StressLCM, -XX:+StressGCM, -XX:+StressIGVN, -XX:+StressCCP, -XX:StressSeed=46553116]</pre>
|
||||
</td>
|
||||
<td align='center' bgColor='green '>OK</td>
|
||||
<td align='right' width='33.333333333333336%' bgColor=#00ff00>9363</td>
|
||||
<td align='right' width='33.333333333333336%' bgColor=#00ff00>10907789</td>
|
||||
<td align='right' width='33.333333333333336%' bgColor=#00ff00>2392819</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap valign=top width=10><pre>split
|
||||
actor1: Interpreter
|
||||
actor2: C1
|
||||
</pre></td>
|
||||
<td nowrap valign=top width=10><pre> actor1: package group free, core group free
|
||||
actor2: package group free, core group free
|
||||
</pre></td>
|
||||
<td valign=top width=10>
|
||||
</td>
|
||||
<td align='center' bgColor='green '>OK</td>
|
||||
<td align='right' width='33.333333333333336%' bgColor=#00ff00>8572</td>
|
||||
<td align='right' width='33.333333333333336%' bgColor=#00ff00>1805981</td>
|
||||
<td align='right' width='33.333333333333336%' bgColor=#00ff00>12345338</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap valign=top width=10><pre>split
|
||||
actor1: C1
|
||||
actor2: C1
|
||||
</pre></td>
|
||||
<td nowrap valign=top width=10><pre> actor1: package group free, core group free
|
||||
actor2: package group free, core group free
|
||||
</pre></td>
|
||||
<td valign=top width=10>
|
||||
</td>
|
||||
<td align='center' bgColor='green '>OK</td>
|
||||
<td align='right' width='33.333333333333336%' bgColor=#00ff00>6973</td>
|
||||
<td align='right' width='33.333333333333336%' bgColor=#00ff00>25429662</td>
|
||||
<td align='right' width='33.333333333333336%' bgColor=#00ff00>25136696</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap valign=top width=10><pre>split
|
||||
actor1: C2
|
||||
actor2: C1
|
||||
</pre></td>
|
||||
<td nowrap valign=top width=10><pre> actor1: package group free, core group free
|
||||
actor2: package group free, core group free
|
||||
</pre></td>
|
||||
<td valign=top width=10>
|
||||
</td>
|
||||
<td align='center' bgColor='green '>OK</td>
|
||||
<td align='right' width='33.333333333333336%' bgColor=#00ff00>10195</td>
|
||||
<td align='right' width='33.333333333333336%' bgColor=#00ff00>9814711</td>
|
||||
<td align='right' width='33.333333333333336%' bgColor=#00ff00>7908745</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap valign=top width=10><pre>split
|
||||
actor1: C2
|
||||
actor2: C1
|
||||
</pre></td>
|
||||
<td nowrap valign=top width=10><pre> actor1: package group free, core group free
|
||||
actor2: package group free, core group free
|
||||
</pre></td>
|
||||
<td valign=top width=10>
|
||||
<pre>[-XX:+StressLCM, -XX:+StressGCM, -XX:+StressIGVN, -XX:+StressCCP, -XX:StressSeed=1258498741]</pre>
|
||||
</td>
|
||||
<td align='center' bgColor='green '>OK</td>
|
||||
<td align='right' width='33.333333333333336%' bgColor=#00ff00>5194</td>
|
||||
<td align='right' width='33.333333333333336%' bgColor=#00ff00>10757506</td>
|
||||
<td align='right' width='33.333333333333336%' bgColor=#00ff00>9029191</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap valign=top width=10><pre>split
|
||||
actor1: C2
|
||||
actor2: C1
|
||||
</pre></td>
|
||||
<td nowrap valign=top width=10><pre> actor1: package group free, core group free
|
||||
actor2: package group free, core group free
|
||||
</pre></td>
|
||||
<td valign=top width=10>
|
||||
<pre>[-XX:+StressLCM, -XX:+StressGCM, -XX:+StressIGVN, -XX:+StressCCP, -XX:StressSeed=1265577250]</pre>
|
||||
</td>
|
||||
<td align='center' bgColor='green '>OK</td>
|
||||
<td align='right' width='33.333333333333336%' bgColor=#00ff00>7495</td>
|
||||
<td align='right' width='33.333333333333336%' bgColor=#00ff00>10976948</td>
|
||||
<td align='right' width='33.333333333333336%' bgColor=#00ff00>9350168</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap valign=top width=10><pre>split
|
||||
actor1: C2
|
||||
actor2: C1
|
||||
</pre></td>
|
||||
<td nowrap valign=top width=10><pre> actor1: package group free, core group free
|
||||
actor2: package group free, core group free
|
||||
</pre></td>
|
||||
<td valign=top width=10>
|
||||
<pre>[-XX:+StressLCM, -XX:+StressGCM, -XX:+StressIGVN, -XX:+StressCCP, -XX:StressSeed=1718364339]</pre>
|
||||
</td>
|
||||
<td align='center' bgColor='green '>OK</td>
|
||||
<td align='right' width='33.333333333333336%' bgColor=#00ff00>6800</td>
|
||||
<td align='right' width='33.333333333333336%' bgColor=#00ff00>9694008</td>
|
||||
<td align='right' width='33.333333333333336%' bgColor=#00ff00>7684683</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap valign=top width=10><pre>split
|
||||
actor1: C2
|
||||
actor2: C1
|
||||
</pre></td>
|
||||
<td nowrap valign=top width=10><pre> actor1: package group free, core group free
|
||||
actor2: package group free, core group free
|
||||
</pre></td>
|
||||
<td valign=top width=10>
|
||||
<pre>[-XX:+StressLCM, -XX:+StressGCM, -XX:+StressIGVN, -XX:+StressCCP, -XX:StressSeed=1986468010]</pre>
|
||||
</td>
|
||||
<td align='center' bgColor='green '>OK</td>
|
||||
<td align='right' width='33.333333333333336%' bgColor=#00ff00>6581</td>
|
||||
<td align='right' width='33.333333333333336%' bgColor=#00ff00>11133163</td>
|
||||
<td align='right' width='33.333333333333336%' bgColor=#00ff00>9307507</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap valign=top width=10><pre>split
|
||||
actor1: C2
|
||||
actor2: C1
|
||||
</pre></td>
|
||||
<td nowrap valign=top width=10><pre> actor1: package group free, core group free
|
||||
actor2: package group free, core group free
|
||||
</pre></td>
|
||||
<td valign=top width=10>
|
||||
<pre>[-XX:+StressLCM, -XX:+StressGCM, -XX:+StressIGVN, -XX:+StressCCP, -XX:StressSeed=988230546]</pre>
|
||||
</td>
|
||||
<td align='center' bgColor='green '>OK</td>
|
||||
<td align='right' width='33.333333333333336%' bgColor=#00ff00>7014</td>
|
||||
<td align='right' width='33.333333333333336%' bgColor=#00ff00>12201531</td>
|
||||
<td align='right' width='33.333333333333336%' bgColor=#00ff00>10419826</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap valign=top width=10><pre>split
|
||||
actor1: Interpreter
|
||||
actor2: C2
|
||||
</pre></td>
|
||||
<td nowrap valign=top width=10><pre> actor1: package group free, core group free
|
||||
actor2: package group free, core group free
|
||||
</pre></td>
|
||||
<td valign=top width=10>
|
||||
</td>
|
||||
<td align='center' bgColor='green '>OK</td>
|
||||
<td align='right' width='33.333333333333336%' bgColor=#00ff00>8329</td>
|
||||
<td align='right' width='33.333333333333336%' bgColor=#00ff00>2612383</td>
|
||||
<td align='right' width='33.333333333333336%' bgColor=#00ff00>11518699</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap valign=top width=10><pre>split
|
||||
actor1: Interpreter
|
||||
actor2: C2
|
||||
</pre></td>
|
||||
<td nowrap valign=top width=10><pre> actor1: package group free, core group free
|
||||
actor2: package group free, core group free
|
||||
</pre></td>
|
||||
<td valign=top width=10>
|
||||
<pre>[-XX:+StressLCM, -XX:+StressGCM, -XX:+StressIGVN, -XX:+StressCCP, -XX:StressSeed=1568282099]</pre>
|
||||
</td>
|
||||
<td align='center' bgColor='green '>OK</td>
|
||||
<td align='right' width='33.333333333333336%' bgColor=#00ff00>8851</td>
|
||||
<td align='right' width='33.333333333333336%' bgColor=#00ff00>2849650</td>
|
||||
<td align='right' width='33.333333333333336%' bgColor=#00ff00>13093390</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap valign=top width=10><pre>split
|
||||
actor1: Interpreter
|
||||
actor2: C2
|
||||
</pre></td>
|
||||
<td nowrap valign=top width=10><pre> actor1: package group free, core group free
|
||||
actor2: package group free, core group free
|
||||
</pre></td>
|
||||
<td valign=top width=10>
|
||||
<pre>[-XX:+StressLCM, -XX:+StressGCM, -XX:+StressIGVN, -XX:+StressCCP, -XX:StressSeed=1769721426]</pre>
|
||||
</td>
|
||||
<td align='center' bgColor='green '>OK</td>
|
||||
<td align='right' width='33.333333333333336%' bgColor=#00ff00>9957</td>
|
||||
<td align='right' width='33.333333333333336%' bgColor=#00ff00>2238775</td>
|
||||
<td align='right' width='33.333333333333336%' bgColor=#00ff00>12586999</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap valign=top width=10><pre>split
|
||||
actor1: Interpreter
|
||||
actor2: C2
|
||||
</pre></td>
|
||||
<td nowrap valign=top width=10><pre> actor1: package group free, core group free
|
||||
actor2: package group free, core group free
|
||||
</pre></td>
|
||||
<td valign=top width=10>
|
||||
<pre>[-XX:+StressLCM, -XX:+StressGCM, -XX:+StressIGVN, -XX:+StressCCP, -XX:StressSeed=485149037]</pre>
|
||||
</td>
|
||||
<td align='center' bgColor='green '>OK</td>
|
||||
<td align='right' width='33.333333333333336%' bgColor=#00ff00>11301</td>
|
||||
<td align='right' width='33.333333333333336%' bgColor=#00ff00>2525467</td>
|
||||
<td align='right' width='33.333333333333336%' bgColor=#00ff00>14111443</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap valign=top width=10><pre>split
|
||||
actor1: Interpreter
|
||||
actor2: C2
|
||||
</pre></td>
|
||||
<td nowrap valign=top width=10><pre> actor1: package group free, core group free
|
||||
actor2: package group free, core group free
|
||||
</pre></td>
|
||||
<td valign=top width=10>
|
||||
<pre>[-XX:+StressLCM, -XX:+StressGCM, -XX:+StressIGVN, -XX:+StressCCP, -XX:StressSeed=646649906]</pre>
|
||||
</td>
|
||||
<td align='center' bgColor='green '>OK</td>
|
||||
<td align='right' width='33.333333333333336%' bgColor=#00ff00>9357</td>
|
||||
<td align='right' width='33.333333333333336%' bgColor=#00ff00>2649745</td>
|
||||
<td align='right' width='33.333333333333336%' bgColor=#00ff00>11592949</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap valign=top width=10><pre>split
|
||||
actor1: Interpreter
|
||||
actor2: C2
|
||||
</pre></td>
|
||||
<td nowrap valign=top width=10><pre> actor1: package group free, core group free
|
||||
actor2: package group free, core group free
|
||||
</pre></td>
|
||||
<td valign=top width=10>
|
||||
<pre>[-XX:+StressLCM, -XX:+StressGCM, -XX:+StressIGVN, -XX:+StressCCP, -XX:StressSeed=732333148]</pre>
|
||||
</td>
|
||||
<td align='center' bgColor='green '>OK</td>
|
||||
<td align='right' width='33.333333333333336%' bgColor=#00ff00>11606</td>
|
||||
<td align='right' width='33.333333333333336%' bgColor=#00ff00>2530883</td>
|
||||
<td align='right' width='33.333333333333336%' bgColor=#00ff00>11474042</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap valign=top width=10><pre>split
|
||||
actor1: C1
|
||||
actor2: C2
|
||||
</pre></td>
|
||||
<td nowrap valign=top width=10><pre> actor1: package group free, core group free
|
||||
actor2: package group free, core group free
|
||||
</pre></td>
|
||||
<td valign=top width=10>
|
||||
</td>
|
||||
<td align='center' bgColor='green '>OK</td>
|
||||
<td align='right' width='33.333333333333336%' bgColor=#00ff00>8659</td>
|
||||
<td align='right' width='33.333333333333336%' bgColor=#00ff00>7350026</td>
|
||||
<td align='right' width='33.333333333333336%' bgColor=#00ff00>8859446</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap valign=top width=10><pre>split
|
||||
actor1: C1
|
||||
actor2: C2
|
||||
</pre></td>
|
||||
<td nowrap valign=top width=10><pre> actor1: package group free, core group free
|
||||
actor2: package group free, core group free
|
||||
</pre></td>
|
||||
<td valign=top width=10>
|
||||
<pre>[-XX:+StressLCM, -XX:+StressGCM, -XX:+StressIGVN, -XX:+StressCCP, -XX:StressSeed=1330574674]</pre>
|
||||
</td>
|
||||
<td align='center' bgColor='green '>OK</td>
|
||||
<td align='right' width='33.333333333333336%' bgColor=#00ff00>7955</td>
|
||||
<td align='right' width='33.333333333333336%' bgColor=#00ff00>7425003</td>
|
||||
<td align='right' width='33.333333333333336%' bgColor=#00ff00>8815893</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap valign=top width=10><pre>split
|
||||
actor1: C1
|
||||
actor2: C2
|
||||
</pre></td>
|
||||
<td nowrap valign=top width=10><pre> actor1: package group free, core group free
|
||||
actor2: package group free, core group free
|
||||
</pre></td>
|
||||
<td valign=top width=10>
|
||||
<pre>[-XX:+StressLCM, -XX:+StressGCM, -XX:+StressIGVN, -XX:+StressCCP, -XX:StressSeed=537320790]</pre>
|
||||
</td>
|
||||
<td align='center' bgColor='green '>OK</td>
|
||||
<td align='right' width='33.333333333333336%' bgColor=#00ff00>6375</td>
|
||||
<td align='right' width='33.333333333333336%' bgColor=#00ff00>8337756</td>
|
||||
<td align='right' width='33.333333333333336%' bgColor=#00ff00>9256400</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap valign=top width=10><pre>split
|
||||
actor1: C1
|
||||
actor2: C2
|
||||
</pre></td>
|
||||
<td nowrap valign=top width=10><pre> actor1: package group free, core group free
|
||||
actor2: package group free, core group free
|
||||
</pre></td>
|
||||
<td valign=top width=10>
|
||||
<pre>[-XX:+StressLCM, -XX:+StressGCM, -XX:+StressIGVN, -XX:+StressCCP, -XX:StressSeed=590941573]</pre>
|
||||
</td>
|
||||
<td align='center' bgColor='green '>OK</td>
|
||||
<td align='right' width='33.333333333333336%' bgColor=#00ff00>6029</td>
|
||||
<td align='right' width='33.333333333333336%' bgColor=#00ff00>18121364</td>
|
||||
<td align='right' width='33.333333333333336%' bgColor=#00ff00>17812978</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap valign=top width=10><pre>split
|
||||
actor1: C1
|
||||
actor2: C2
|
||||
</pre></td>
|
||||
<td nowrap valign=top width=10><pre> actor1: package group free, core group free
|
||||
actor2: package group free, core group free
|
||||
</pre></td>
|
||||
<td valign=top width=10>
|
||||
<pre>[-XX:+StressLCM, -XX:+StressGCM, -XX:+StressIGVN, -XX:+StressCCP, -XX:StressSeed=783986298]</pre>
|
||||
</td>
|
||||
<td align='center' bgColor='green '>OK</td>
|
||||
<td align='right' width='33.333333333333336%' bgColor=#00ff00>6417</td>
|
||||
<td align='right' width='33.333333333333336%' bgColor=#00ff00>9953222</td>
|
||||
<td align='right' width='33.333333333333336%' bgColor=#00ff00>11071292</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap valign=top width=10><pre>split
|
||||
actor1: C1
|
||||
actor2: C2
|
||||
</pre></td>
|
||||
<td nowrap valign=top width=10><pre> actor1: package group free, core group free
|
||||
actor2: package group free, core group free
|
||||
</pre></td>
|
||||
<td valign=top width=10>
|
||||
<pre>[-XX:+StressLCM, -XX:+StressGCM, -XX:+StressIGVN, -XX:+StressCCP, -XX:StressSeed=972835668]</pre>
|
||||
</td>
|
||||
<td align='center' bgColor='green '>OK</td>
|
||||
<td align='right' width='33.333333333333336%' bgColor=#00ff00>5315</td>
|
||||
<td align='right' width='33.333333333333336%' bgColor=#00ff00>8176412</td>
|
||||
<td align='right' width='33.333333333333336%' bgColor=#00ff00>9439284</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap valign=top width=10><pre>split
|
||||
actor1: C2
|
||||
actor2: C2
|
||||
</pre></td>
|
||||
<td nowrap valign=top width=10><pre> actor1: package group free, core group free
|
||||
actor2: package group free, core group free
|
||||
</pre></td>
|
||||
<td valign=top width=10>
|
||||
</td>
|
||||
<td align='center' bgColor='green '>OK</td>
|
||||
<td align='right' width='33.333333333333336%' bgColor=#00ff00>12682</td>
|
||||
<td align='right' width='33.333333333333336%' bgColor=#00ff00>7997829</td>
|
||||
<td align='right' width='33.333333333333336%' bgColor=#00ff00>7992580</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap valign=top width=10><pre>split
|
||||
actor1: C2
|
||||
actor2: C2
|
||||
</pre></td>
|
||||
<td nowrap valign=top width=10><pre> actor1: package group free, core group free
|
||||
actor2: package group free, core group free
|
||||
</pre></td>
|
||||
<td valign=top width=10>
|
||||
<pre>[-XX:+StressLCM, -XX:+StressGCM, -XX:+StressIGVN, -XX:+StressCCP, -XX:StressSeed=146296887]</pre>
|
||||
</td>
|
||||
<td align='center' bgColor='green '>OK</td>
|
||||
<td align='right' width='33.333333333333336%' bgColor=#00ff00>4508</td>
|
||||
<td align='right' width='33.333333333333336%' bgColor=#00ff00>7992238</td>
|
||||
<td align='right' width='33.333333333333336%' bgColor=#00ff00>8088265</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap valign=top width=10><pre>split
|
||||
actor1: C2
|
||||
actor2: C2
|
||||
</pre></td>
|
||||
<td nowrap valign=top width=10><pre> actor1: package group free, core group free
|
||||
actor2: package group free, core group free
|
||||
</pre></td>
|
||||
<td valign=top width=10>
|
||||
<pre>[-XX:+StressLCM, -XX:+StressGCM, -XX:+StressIGVN, -XX:+StressCCP, -XX:StressSeed=1475645167]</pre>
|
||||
</td>
|
||||
<td align='center' bgColor='green '>OK</td>
|
||||
<td align='right' width='33.333333333333336%' bgColor=#00ff00>2388</td>
|
||||
<td align='right' width='33.333333333333336%' bgColor=#00ff00>12140630</td>
|
||||
<td align='right' width='33.333333333333336%' bgColor=#00ff00>11959913</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap valign=top width=10><pre>split
|
||||
actor1: C2
|
||||
actor2: C2
|
||||
</pre></td>
|
||||
<td nowrap valign=top width=10><pre> actor1: package group free, core group free
|
||||
actor2: package group free, core group free
|
||||
</pre></td>
|
||||
<td valign=top width=10>
|
||||
<pre>[-XX:+StressLCM, -XX:+StressGCM, -XX:+StressIGVN, -XX:+StressCCP, -XX:StressSeed=1786164078]</pre>
|
||||
</td>
|
||||
<td align='center' bgColor='green '>OK</td>
|
||||
<td align='right' width='33.333333333333336%' bgColor=#00ff00>3627</td>
|
||||
<td align='right' width='33.333333333333336%' bgColor=#00ff00>7904462</td>
|
||||
<td align='right' width='33.333333333333336%' bgColor=#00ff00>7890202</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap valign=top width=10><pre>split
|
||||
actor1: C2
|
||||
actor2: C2
|
||||
</pre></td>
|
||||
<td nowrap valign=top width=10><pre> actor1: package group free, core group free
|
||||
actor2: package group free, core group free
|
||||
</pre></td>
|
||||
<td valign=top width=10>
|
||||
<pre>[-XX:+StressLCM, -XX:+StressGCM, -XX:+StressIGVN, -XX:+StressCCP, -XX:StressSeed=1936754903]</pre>
|
||||
</td>
|
||||
<td align='center' bgColor='green '>OK</td>
|
||||
<td align='right' width='33.333333333333336%' bgColor=#00ff00>1405</td>
|
||||
<td align='right' width='33.333333333333336%' bgColor=#00ff00>12159084</td>
|
||||
<td align='right' width='33.333333333333336%' bgColor=#00ff00>11840042</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap valign=top width=10><pre>split
|
||||
actor1: C2
|
||||
actor2: C2
|
||||
</pre></td>
|
||||
<td nowrap valign=top width=10><pre> actor1: package group free, core group free
|
||||
actor2: package group free, core group free
|
||||
</pre></td>
|
||||
<td valign=top width=10>
|
||||
<pre>[-XX:+StressLCM, -XX:+StressGCM, -XX:+StressIGVN, -XX:+StressCCP, -XX:StressSeed=439637539]</pre>
|
||||
</td>
|
||||
<td align='center' bgColor='green '>OK</td>
|
||||
<td align='right' width='33.333333333333336%' bgColor=#00ff00>3778</td>
|
||||
<td align='right' width='33.333333333333336%' bgColor=#00ff00>8417441</td>
|
||||
<td align='right' width='33.333333333333336%' bgColor=#00ff00>8206512</td>
|
||||
</tr>
|
||||
</table>
|
||||
<h3>Messages</h3>
|
||||
<h3>VM Output Streams</h3>
|
||||
<h3>VM Error Streams</h3>
|
||||
</body>
|
||||
</html>
|
||||
28
rustlib/Cargo.lock
generated
28
rustlib/Cargo.lock
generated
|
|
@ -272,6 +272,12 @@ dependencies = [
|
|||
"slab",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gcc"
|
||||
version = "0.3.55"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8f5f3913fa0bfe7ee1fd8248b6b9f42a5af4b9d65ec2dd2c3c26132b950ecfc2"
|
||||
|
||||
[[package]]
|
||||
name = "getrandom"
|
||||
version = "0.2.15"
|
||||
|
|
@ -849,6 +855,7 @@ dependencies = [
|
|||
"chrono",
|
||||
"crossbeam-channel",
|
||||
"reqwest",
|
||||
"snappy",
|
||||
"tracing",
|
||||
"tracing-subscriber",
|
||||
]
|
||||
|
|
@ -998,6 +1005,27 @@ version = "1.13.2"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67"
|
||||
|
||||
[[package]]
|
||||
name = "snappy"
|
||||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b570b1d39e2fcb136a07e46d15a1fe962ba71c151e4d8d6888f59f1fcd185bb1"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"snappy-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "snappy-sys"
|
||||
version = "0.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9f873053ef085548b0b924db3aa2ce38d9389fb3be353bf7fcec4ababc99a307"
|
||||
dependencies = [
|
||||
"gcc",
|
||||
"libc",
|
||||
"pkg-config",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "socket2"
|
||||
version = "0.5.7"
|
||||
|
|
|
|||
|
|
@ -14,3 +14,4 @@ reqwest = { version = "0.12", features = ["blocking"]}
|
|||
tracing = "0.1"
|
||||
tracing-subscriber = { version = "0.3", features = ["env-filter"] }
|
||||
crossbeam-channel = "0.5"
|
||||
snappy = "0.4"
|
||||
|
|
@ -12,7 +12,7 @@ use reqwest::blocking::Client; // can I use non-blocking here?
|
|||
// why not just add it to the function
|
||||
const CAPACITY: isize = 32760;
|
||||
const READ: isize = 32760;
|
||||
static CHANNEL: OnceLock<(Sender<String>, Receiver<String>)> = OnceLock::new();
|
||||
static CHANNEL: OnceLock<(Sender<Vec<u8>>, Receiver<Vec<u8>>)> = OnceLock::new();
|
||||
static HANDLE: OnceLock<JoinHandle<()>> = OnceLock::new();
|
||||
|
||||
/// Reads the data from the bytebuffer in the caller thread and sends the data to a background
|
||||
|
|
@ -37,6 +37,20 @@ pub unsafe extern "C" fn buffer_updated(buffer: *mut c_char) {
|
|||
loop {
|
||||
let maybe_job = receiver.recv();
|
||||
if let Ok(data) = maybe_job {
|
||||
let data = String::from_utf8(snappy::uncompress(&data).unwrap()).unwrap();
|
||||
_ = http_client
|
||||
.post("http://localhost:3000/api/stacktraces")
|
||||
.body(data)
|
||||
.send();
|
||||
}
|
||||
}
|
||||
});
|
||||
thread::spawn(move || {
|
||||
let http_client = Client::new();
|
||||
loop {
|
||||
let maybe_job = receiver.recv();
|
||||
if let Ok(data) = maybe_job {
|
||||
let data = String::from_utf8(snappy::uncompress(&data).unwrap()).unwrap();
|
||||
_ = http_client
|
||||
.post("http://localhost:3000/api/stacktraces")
|
||||
.body(data)
|
||||
|
|
@ -74,27 +88,26 @@ pub unsafe extern "C" fn buffer_updated(buffer: *mut c_char) {
|
|||
// must copy to maintain it safely once read from the buffer
|
||||
// can safely skip checks for len and utf8
|
||||
if len <= remaining {
|
||||
let s = std::str::from_utf8_unchecked(slice::from_raw_parts(
|
||||
let s = slice::from_raw_parts(
|
||||
buffer.offset(read_pos).cast::<u8>(),
|
||||
len as usize,
|
||||
)).to_owned();
|
||||
).to_owned();
|
||||
let send_result = sender.send_timeout(s, Duration::from_secs(10));
|
||||
if send_result.is_err() {
|
||||
println!("overflow detected, discarding");
|
||||
}
|
||||
read_pos += len;
|
||||
} else {
|
||||
let s1 = std::str::from_utf8_unchecked(slice::from_raw_parts(
|
||||
let mut s = slice::from_raw_parts(
|
||||
buffer.offset(read_pos).cast::<u8>(),
|
||||
remaining as usize,
|
||||
));
|
||||
let s2 = std::str::from_utf8_unchecked(slice::from_raw_parts(
|
||||
).to_owned();
|
||||
let s2 = slice::from_raw_parts(
|
||||
buffer.cast::<u8>(),
|
||||
(len - remaining) as usize,
|
||||
));
|
||||
let mut s = String::with_capacity(len as usize);
|
||||
s.push_str(s1);
|
||||
s.push_str(s2);
|
||||
);
|
||||
s.append(&mut s2.to_owned());
|
||||
|
||||
let send_result = sender.send_timeout(s, Duration::from_secs(10));
|
||||
if send_result.is_err() {
|
||||
println!("overflow detected, discarding");
|
||||
|
|
@ -138,3 +151,14 @@ fn put_u32(s: *mut c_char, pos: isize, value: u32) {
|
|||
*s.offset(pos + 3) = bytes[3] as c_char;
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
#[test]
|
||||
fn read_snap() {
|
||||
let bytes = std::fs::read("/Users/Shautvast/dev/exceptional/agent/hello.snap").unwrap();
|
||||
let uncompressed = snappy::uncompress(&bytes).unwrap();
|
||||
let uncompressed = String::from_utf8(uncompressed).unwrap();
|
||||
println!("{}", uncompressed);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue