コード例 #1
0
ファイル: CounterStore.java プロジェクト: leihnwong/lazyctrl
 /**
  * This method can only be used to update packetRemote and flowmod counters NOTE: flowmod is
  * counted per switch and for controller, not per port/proto
  *
  * @param sw
  * @param m
  */
 public void updatePktRemoteFMCounterStore(IOFSwitch sw, OFMessage m) {
   List<ICounter> counters = this.getPktRemoteFMCounters(sw, m);
   if (counters != null) {
     for (ICounter c : counters) {
       c.increment();
     }
   }
   return;
 }
コード例 #2
0
ファイル: CounterStore.java プロジェクト: leihnwong/lazyctrl
  public void updatePacketInCounters(IOFSwitch sw, OFMessage m, Ethernet eth) {
    if (((OFPacketIn) m).getPacketData().length <= 0) {
      return;
    }

    List<ICounter> counters = this.getPacketInCounters(sw, m, eth);
    if (counters != null) {
      for (ICounter c : counters) {
        c.increment();
      }
    }
    return;
  }
コード例 #3
0
ファイル: CounterStore.java プロジェクト: leihnwong/lazyctrl
  @Override
  public void updateFlush() {
    Date date = new Date();
    Map<String, MutableInt> pktin_buffer = this.pktin_local_buffer.get();
    for (String key : pktin_buffer.keySet()) {
      MutableInt currval = pktin_buffer.get(key);
      int delta = currval.get();

      if (delta > 0) {
        List<ICounter> counters = this.pktinCounters.get(key);
        if (counters != null) {
          for (ICounter c : counters) {
            c.increment(date, delta);
          }
        }
      }
    }
    // We could do better "GC" of counters that have not been update "recently"
    pktin_buffer.clear();

    Map<String, MutableInt> pktout_buffer = this.pktout_local_buffer.get();
    for (String key : pktout_buffer.keySet()) {
      MutableInt currval = pktout_buffer.get(key);
      int delta = currval.get();

      if (delta > 0) {
        List<ICounter> counters = this.pktoutCounters.get(key);
        if (counters != null) {
          for (ICounter c : counters) {
            c.increment(date, delta);
          }
        }
      }
    }
    // We could do better "GC" of counters that have not been update "recently"
    pktout_buffer.clear();
  }