Search in sources :

Example 1 with FlowStat

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();
}
Also used : PGIdStatsRPCResult(com.cisco.trex.stateless.model.stats.PGIdStatsRPCResult) FlowStat(com.cisco.trex.stateless.model.stats.FlowStat) PGIDStatsService(com.exalttech.trex.ui.views.services.PGIDStatsService) LatencyStat(com.cisco.trex.stateless.model.stats.LatencyStat)

Example 2 with FlowStat

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);
        });
    }
}
Also used : FlowStat(com.cisco.trex.stateless.model.stats.FlowStat) FlowStatPoint(com.exalttech.trex.ui.models.stats.FlowStatPoint) FlowStatPoint(com.exalttech.trex.ui.models.stats.FlowStatPoint) LatencyStatPoint(com.exalttech.trex.ui.models.stats.LatencyStatPoint)

Aggregations

FlowStat (com.cisco.trex.stateless.model.stats.FlowStat)2 LatencyStat (com.cisco.trex.stateless.model.stats.LatencyStat)1 PGIdStatsRPCResult (com.cisco.trex.stateless.model.stats.PGIdStatsRPCResult)1 FlowStatPoint (com.exalttech.trex.ui.models.stats.FlowStatPoint)1 LatencyStatPoint (com.exalttech.trex.ui.models.stats.LatencyStatPoint)1 PGIDStatsService (com.exalttech.trex.ui.views.services.PGIDStatsService)1