use of com.hazelcast.simulator.worker.performance.PerformanceStats in project hazelcast-simulator by hazelcast.
the class PerformanceStatsCollectorTest method testCalculatePerformanceStats_differentTests.
@Test
public void testCalculatePerformanceStats_differentTests() {
PerformanceStats a1w1Stats = new PerformanceStats(100, 10, 100.0, 50, 100, 200);
PerformanceStats a1w2Stats = new PerformanceStats(200, 20, 200.0, 60, 110, 210);
update(a1w1, TEST_CASE_ID_1, a1w1Stats);
update(a1w2, TEST_CASE_ID_2, a1w2Stats);
PerformanceStats a2w1Stats = new PerformanceStats(300, 30, 300.0, 70, 120, 220);
PerformanceStats a2w2Stats = new PerformanceStats(400, 40, 400.0, 80, 120, 230);
update(a2w1, TEST_CASE_ID_1, a2w1Stats);
update(a2w2, TEST_CASE_ID_2, a2w2Stats);
PerformanceStats totalStats = new PerformanceStats();
Map<SimulatorAddress, PerformanceStats> agentStats = new HashMap<SimulatorAddress, PerformanceStats>();
performanceStatsCollector.calculatePerformanceStats(TEST_CASE_ID_1, totalStats, agentStats);
assertEquals(2, agentStats.size());
assertPerfStatEquals(a1w1Stats, agentStats.get(a1));
assertPerfStatEquals(a2w1Stats, agentStats.get(a2));
assertPerfStatEquals(aggregateAll(a1w1Stats, a2w1Stats), totalStats);
}
use of com.hazelcast.simulator.worker.performance.PerformanceStats in project hazelcast-simulator by hazelcast.
the class PerformanceStatsCollectorTest method testGet_onEmptyContainer.
@Test
public void testGet_onEmptyContainer() {
PerformanceStats performanceStats = emptyPerformanceStatsCollector.get(TEST_CASE_ID_1, true);
assertTrue(performanceStats.isEmpty());
}
use of com.hazelcast.simulator.worker.performance.PerformanceStats in project hazelcast-simulator by hazelcast.
the class PerformanceStatsCollectorTest method testGet.
@Test
public void testGet() {
update(a1w1, TEST_CASE_ID_1, new PerformanceStats(1000, 200, 500, 1900.0d, 1800, 2500));
update(a1w1, TEST_CASE_ID_1, new PerformanceStats(1500, 150, 550, 1600.0d, 1700, 2400));
update(a2w1, TEST_CASE_ID_1, new PerformanceStats(800, 100, 300, 2200.0d, 2400, 2800));
PerformanceStats performanceStats = performanceStatsCollector.get(TEST_CASE_ID_1, true);
assertFalse(performanceStats.isEmpty());
assertEquals(2300, performanceStats.getOperationCount());
assertEquals(300.0, performanceStats.getIntervalThroughput(), ASSERT_EQUALS_DELTA);
assertEquals(850.0, performanceStats.getTotalThroughput(), ASSERT_EQUALS_DELTA);
assertEquals(2400, performanceStats.getIntervalLatency999PercentileNanos());
assertEquals(2200.0d, performanceStats.getIntervalLatencyAvgNanos(), 0.001);
assertEquals(2800, performanceStats.getIntervalLatencyMaxNanos());
}
use of com.hazelcast.simulator.worker.performance.PerformanceStats in project hazelcast-simulator by hazelcast.
the class PerformanceStatsCollectorTest method testCalculatePerformanceStats.
@Test
public void testCalculatePerformanceStats() {
PerformanceStats a1w1Stats = new PerformanceStats(100, 10, 100.0, 50, 100, 200);
PerformanceStats a1w2Stats = new PerformanceStats(200, 20, 200.0, 60, 110, 210);
update(a1w1, TEST_CASE_ID_1, a1w1Stats);
update(a1w2, TEST_CASE_ID_1, a1w2Stats);
PerformanceStats a2w1Stats = new PerformanceStats(300, 30, 300.0, 70, 120, 220);
PerformanceStats a2w2Stats = new PerformanceStats(400, 40, 400.0, 80, 120, 230);
update(a2w1, TEST_CASE_ID_1, a2w1Stats);
update(a2w2, TEST_CASE_ID_1, a2w2Stats);
PerformanceStats totalStats = new PerformanceStats();
Map<SimulatorAddress, PerformanceStats> agentStats = new HashMap<SimulatorAddress, PerformanceStats>();
performanceStatsCollector.calculatePerformanceStats(TEST_CASE_ID_1, totalStats, agentStats);
assertEquals(2, agentStats.size());
assertPerfStatEquals(aggregateAll(a1w1Stats, a1w2Stats), agentStats.get(a1));
assertPerfStatEquals(aggregateAll(a2w1Stats, a2w2Stats), agentStats.get(a2));
assertPerfStatEquals(aggregateAll(a1w1Stats, a1w2Stats, a2w1Stats, a2w2Stats), totalStats);
}
use of com.hazelcast.simulator.worker.performance.PerformanceStats in project hazelcast-simulator by hazelcast.
the class PerformanceStatsCollectorTest method testCalculatePerformanceStats_onEmptyContainer.
@Test
public void testCalculatePerformanceStats_onEmptyContainer() {
PerformanceStats totalPerformanceStats = new PerformanceStats();
Map<SimulatorAddress, PerformanceStats> agentPerformanceStatsMap = new HashMap<SimulatorAddress, PerformanceStats>();
emptyPerformanceStatsCollector.calculatePerformanceStats("foo", totalPerformanceStats, agentPerformanceStatsMap);
assertEquals(0, agentPerformanceStatsMap.size());
assertTrue(totalPerformanceStats.isEmpty());
}
Aggregations