use of com.cisco.trex.stateless.model.stats.FlowStat in project trex-stateless-gui by cisco-system-traffic-generator.
the class PGIDStatsStorage method handlePGIDStatsReceived.
private void handlePGIDStatsReceived(final WorkerStateEvent event) {
final PGIDStatsService service = (PGIDStatsService) event.getSource();
final PGIdStatsRPCResult receivedPGIDStats = service.getValue();
final double time = System.currentTimeMillis() / 1000.0;
final Map<String, FlowStat> flowStatMap = receivedPGIDStats.getFlowStats();
if (flowStatMap != null) {
processFlowStats(receivedPGIDStats.getFlowStats(), time);
}
final Map<String, LatencyStat> latencyStatMap = receivedPGIDStats.getLatency();
if (latencyStatMap != null) {
processLatencyStats(receivedPGIDStats.getLatency(), time);
}
handleStatsChanged();
}
use of com.cisco.trex.stateless.model.stats.FlowStat in project trex-stateless-gui by cisco-system-traffic-generator.
the class PGIDStatsStorage method processFlowStats.
private void processFlowStats(final Map<String, FlowStat> flowStatMap, final double time) {
synchronized (flowLock) {
final Set<Integer> unvisitedStreams = new HashSet<>(flowStatPointHistoryMap.keySet());
flowStatMap.forEach((final String pgID, final FlowStat flowStat) -> {
int intPGID;
try {
intPGID = Integer.valueOf(pgID);
} catch (NumberFormatException exc) {
return;
}
unvisitedStreams.remove(intPGID);
final FlowStatPoint statsFlowHistoryPoint = new FlowStatPoint(flowStat, time);
ArrayHistory<FlowStatPoint> history = flowStatPointHistoryMap.get(intPGID);
if (history == null) {
history = new ArrayHistory<>(HISTORY_SIZE);
flowStatPointHistoryMap.put(intPGID, history);
}
history.add(statsFlowHistoryPoint);
flowStatPointShadowMap.putIfAbsent(intPGID, statsFlowHistoryPoint);
});
unvisitedStreams.forEach((final Integer pgID) -> {
flowStatPointHistoryMap.remove(pgID);
flowStatPointShadowMap.remove(pgID);
});
}
}
Aggregations