use of com.baidu.hugegraph.computer.core.receiver.MessageStat in project hugegraph-computer by hugegraph.
the class SuperstepStatTest method testEquals.
@Test
public void testEquals() {
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 stat2 = new SuperstepStat();
stat2.increase(partitionStat);
stat2.increase(partitionStat);
SuperstepStat stat3 = new SuperstepStat();
Assert.assertEquals(stat1, stat2);
Assert.assertNotEquals(stat1, stat3);
Assert.assertNotEquals(stat1, new Object());
stat1.inactivate();
Assert.assertFalse(stat1.active());
Assert.assertNotEquals(stat1, stat2);
}
use of com.baidu.hugegraph.computer.core.receiver.MessageStat in project hugegraph-computer by hugegraph.
the class SuperstepStatTest method testActive.
@Test
public void testActive() {
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);
stat.increase(partitionStat);
Assert.assertTrue(stat.active());
stat.inactivate();
Assert.assertFalse(stat.active());
}
use of com.baidu.hugegraph.computer.core.receiver.MessageStat in project hugegraph-computer by hugegraph.
the class SuperstepStatTest method testHashCode.
@Test
public void testHashCode() {
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 stat2 = new SuperstepStat();
stat2.increase(partitionStat);
stat2.increase(partitionStat);
SuperstepStat stat3 = new SuperstepStat();
Assert.assertEquals(stat1.hashCode(), stat2.hashCode());
Assert.assertNotEquals(stat1.hashCode(), stat3.hashCode());
}
use of com.baidu.hugegraph.computer.core.receiver.MessageStat in project hugegraph-computer by hugegraph.
the class SuperstepStatTest method testIncreaseWorkerStat.
@Test
public void testIncreaseWorkerStat() {
SuperstepStat stat = new SuperstepStat();
PartitionStat partitionStat1 = new PartitionStat(1, 4L, 3L, 2L);
partitionStat1.mergeSendMessageStat(new MessageStat(5L, 6L));
partitionStat1.mergeRecvMessageStat(new MessageStat(7L, 8L));
PartitionStat partitionStat2 = new PartitionStat(2, 14L, 13L, 12L);
partitionStat2.mergeSendMessageStat(new MessageStat(15L, 16L));
partitionStat2.mergeRecvMessageStat(new MessageStat(17L, 18L));
WorkerStat workerStat = new WorkerStat();
workerStat.add(partitionStat1);
workerStat.add(partitionStat2);
stat.increase(workerStat);
Assert.assertEquals(18, stat.vertexCount());
Assert.assertEquals(16, stat.edgeCount());
Assert.assertEquals(14L, stat.finishedVertexCount());
Assert.assertEquals(20L, stat.messageSendCount());
Assert.assertEquals(22L, stat.messageSendBytes());
Assert.assertEquals(24L, stat.messageRecvCount());
Assert.assertEquals(26L, stat.messageRecvBytes());
}
use of com.baidu.hugegraph.computer.core.receiver.MessageStat in project hugegraph-computer by hugegraph.
the class SuperstepStatTest method testIncreasePartitionStat.
@Test
public void testIncreasePartitionStat() {
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);
stat.increase(partitionStat);
Assert.assertEquals(partitionStat.vertexCount() * 2L, stat.vertexCount());
Assert.assertEquals(partitionStat.edgeCount() * 2L, stat.edgeCount());
Assert.assertEquals(partitionStat.finishedVertexCount() * 2L, stat.finishedVertexCount());
Assert.assertEquals(partitionStat.messageSendCount() * 2L, stat.messageSendCount());
Assert.assertEquals(partitionStat.messageSendBytes() * 2L, stat.messageSendBytes());
Assert.assertEquals(partitionStat.messageRecvCount() * 2L, stat.messageRecvCount());
Assert.assertEquals(partitionStat.messageRecvBytes() * 2L, stat.messageRecvBytes());
}
Aggregations