use of com.baidu.hugegraph.computer.core.receiver.MessageStat in project hugegraph-computer by hugegraph.
the class SuperstepStatTest method testReadWrite.
@Test
public void testReadWrite() throws IOException {
SuperstepStat stat1 = new SuperstepStat();
PartitionStat partitionStat = new PartitionStat(1, 4L, 3L, 2L);
partitionStat.mergeSendMessageStat(new MessageStat(5L, 6L));
partitionStat.mergeRecvMessageStat(new MessageStat(7L, 8L));
stat1.increase(partitionStat);
stat1.increase(partitionStat);
SuperstepStat stat1ReadObj = new SuperstepStat();
UnitTestBase.assertEqualAfterWriteAndRead(stat1, stat1ReadObj);
}
use of com.baidu.hugegraph.computer.core.receiver.MessageStat in project hugegraph-computer by hugegraph.
the class SuperstepStatTest method testToString.
@Test
public void testToString() {
SuperstepStat stat = new SuperstepStat();
PartitionStat partitionStat = new PartitionStat(1, 4L, 3L, 2L);
partitionStat.mergeSendMessageStat(new MessageStat(5L, 6L));
partitionStat.mergeRecvMessageStat(new MessageStat(7L, 8L));
stat.increase(partitionStat);
String str = "SuperstepStat{\"vertexCount\":4,\"edgeCount\":3,\"" + "finishedVertexCount\":2,\"messageSendCount\":5,\"" + "messageSendBytes\":6,\"messageRecvCount\":7,\"" + "messageRecvBytes\":8,\"active\":true}";
Assert.assertEquals(str, stat.toString());
}
use of com.baidu.hugegraph.computer.core.receiver.MessageStat in project hugegraph-computer by hugegraph.
the class PartitionStatTest method testHashCode.
@Test
public void testHashCode() {
PartitionStat stat1 = new PartitionStat(0, 1L, 2L, 0L);
PartitionStat stat2 = new PartitionStat(1, 4L, 3L, 2L);
stat2.mergeSendMessageStat(new MessageStat(5L, 6L));
stat2.mergeRecvMessageStat(new MessageStat(7L, 8L));
Assert.assertEquals(Integer.hashCode(0), stat1.hashCode());
Assert.assertEquals(Integer.hashCode(1), stat2.hashCode());
}
use of com.baidu.hugegraph.computer.core.receiver.MessageStat in project hugegraph-computer by hugegraph.
the class PartitionStatTest method testConstructor.
@Test
public void testConstructor() {
PartitionStat stat1 = new PartitionStat();
Assert.assertEquals(0, stat1.partitionId());
Assert.assertEquals(0L, stat1.vertexCount());
Assert.assertEquals(0L, stat1.edgeCount());
Assert.assertEquals(0L, stat1.finishedVertexCount());
Assert.assertEquals(0L, stat1.messageSendCount());
Assert.assertEquals(0L, stat1.messageSendBytes());
Assert.assertEquals(0L, stat1.messageRecvCount());
Assert.assertEquals(0L, stat1.messageRecvBytes());
PartitionStat stat2 = new PartitionStat(1, 4L, 3L, 2L);
stat2.mergeSendMessageStat(new MessageStat(5L, 6L));
stat2.mergeRecvMessageStat(new MessageStat(7L, 8L));
Assert.assertEquals(1, stat2.partitionId());
Assert.assertEquals(4L, stat2.vertexCount());
Assert.assertEquals(3L, stat2.edgeCount());
Assert.assertEquals(2L, stat2.finishedVertexCount());
Assert.assertEquals(5L, stat2.messageSendCount());
Assert.assertEquals(6L, stat2.messageSendBytes());
Assert.assertEquals(7L, stat2.messageRecvCount());
Assert.assertEquals(8L, stat2.messageRecvBytes());
}
use of com.baidu.hugegraph.computer.core.receiver.MessageStat in project hugegraph-computer by hugegraph.
the class WorkerStatTest method testToString.
@Test
public void testToString() {
PartitionStat stat1 = new PartitionStat(0, 1L, 2L, 0L);
PartitionStat stat2 = new PartitionStat(1, 4L, 3L, 2L);
stat2.mergeSendMessageStat(new MessageStat(5L, 6L));
stat2.mergeRecvMessageStat(new MessageStat(7L, 8L));
WorkerStat workerStat = new WorkerStat();
workerStat.add(stat1);
workerStat.add(stat2);
String str = "WorkerStat{\"workerId\":0," + "\"partitionStats\":[{\"partitionId\":0," + "\"vertexCount\":1,\"edgeCount\":2,\"" + "finishedVertexCount\":0," + "\"messageSendCount\":0,\"messageSendBytes\":0," + "\"messageRecvCount\":0,\"messageRecvBytes\":0}," + "{\"partitionId\":1,\"vertexCount\":4," + "\"edgeCount\":3,\"finishedVertexCount\":2," + "\"messageSendCount\":5,\"messageSendBytes\":6," + "\"messageRecvCount\":7,\"messageRecvBytes\":8}]}";
Assert.assertEquals(str, workerStat.toString());
}
Aggregations