From e0bf173b39314f2ca6a9d624d7480089d34485fd Mon Sep 17 00:00:00 2001 From: Srivats P Date: Sat, 5 Nov 2016 19:53:01 +0530 Subject: [PATCH] sign: remove sign stats and remnants of signed streams --- client/portstatsmodel.cpp | 6 ------ client/portstatsmodel.h | 8 -------- common/protocol.proto | 15 --------------- server/abstractport.cpp | 19 ------------------- server/abstractport.h | 15 --------------- server/myservice.cpp | 12 ------------ server/pcaptransmitter.cpp | 5 ----- server/pcaptransmitter.h | 2 -- server/pcaptxstats.cpp | 16 ---------------- server/pcaptxstats.h | 3 --- 10 files changed, 101 deletions(-) diff --git a/client/portstatsmodel.cpp b/client/portstatsmodel.cpp index 3acd61d..f4eccc3 100644 --- a/client/portstatsmodel.cpp +++ b/client/portstatsmodel.cpp @@ -170,12 +170,6 @@ QVariant PortStatsModel::data(const QModelIndex &index, int role) const case e_STAT_BYTES_SENT_NIC: return stats.tx_bytes_nic(); #endif - // Sign Stats - case e_STAT_SIGN_FRAMES_RCVD: - return quint64(stats.sign().rx_pkts()); - case e_STAT_SIGN_FRAMES_SENT: - return quint64(stats.sign().tx_pkts()); - // TODO: Other sign stats case e_STAT_RX_DROPS : return quint64(stats.rx_drops()); case e_STAT_RX_ERRORS: return quint64(stats.rx_errors()); diff --git a/client/portstatsmodel.h b/client/portstatsmodel.h index bcd86b1..b4ab3c0 100644 --- a/client/portstatsmodel.h +++ b/client/portstatsmodel.h @@ -60,11 +60,6 @@ typedef enum { e_STAT_BYTES_SENT_NIC, #endif - // Sign Stats - e_STAT_SIGN_FRAMES_RCVD, - e_STAT_SIGN_FRAMES_SENT, - // TODO: Other sign stats - // Rx Errors e_STAT_RX_DROPS, e_STAT_RX_ERRORS, @@ -99,9 +94,6 @@ static QStringList PortStatName = (QStringList() << "Bytes Sent (NIC)" #endif - << "(Sign) Frames Received" - << "(Sign) Frames Sent" - << "Receive Drops" << "Receive Errors" << "Receive Fifo Errors" diff --git a/common/protocol.proto b/common/protocol.proto index a08307b..7a48f06 100644 --- a/common/protocol.proto +++ b/common/protocol.proto @@ -236,19 +236,6 @@ message PortState { optional bool is_capture_on = 3 [default = false]; } -message Stats { - // FIXME: change tag numbers? - optional uint64 rx_pkts = 11; - optional uint64 rx_bytes = 12; - optional uint64 rx_pps = 15; - optional uint64 rx_bps = 16; - - optional uint64 tx_pkts = 21; - optional uint64 tx_bytes = 22; - optional uint64 tx_pps = 25; - optional uint64 tx_bps = 26; -} - message PortStats { required PortId port_id = 1; @@ -273,8 +260,6 @@ message PortStats { optional uint64 rx_errors = 101; optional uint64 rx_fifo_errors = 102; optional uint64 rx_frame_errors = 103; - - optional Stats sign = 1000; } message PortStatsList { diff --git a/server/abstractport.cpp b/server/abstractport.cpp index 6f1c7c4..7762bf9 100644 --- a/server/abstractport.cpp +++ b/server/abstractport.cpp @@ -631,25 +631,6 @@ void AbstractPort::stats(PortStats *stats) stats->rxFrameErrors = (stats_.rxFrameErrors >= epochStats_.rxFrameErrors) ? stats_.rxFrameErrors - epochStats_.rxFrameErrors : stats_.rxFrameErrors + (maxStatsValue_ - epochStats_.rxFrameErrors); - - // Sign stats - stats->sign.rxPkts = (stats_.sign.rxPkts >= epochStats_.sign.rxPkts) ? - stats_.sign.rxPkts - epochStats_.sign.rxPkts : - stats_.sign.rxPkts + (maxStatsValue_ - epochStats_.sign.rxPkts); - stats->sign.rxBytes = (stats_.sign.rxBytes >= epochStats_.sign.rxBytes) ? - stats_.sign.rxBytes - epochStats_.sign.rxBytes : - stats_.sign.rxBytes + (maxStatsValue_ - epochStats_.sign.rxBytes); - stats->sign.rxPps = stats_.sign.rxPps; - stats->sign.rxBps = stats_.sign.rxBps; - - stats->sign.txPkts = (stats_.sign.txPkts >= epochStats_.sign.txPkts) ? - stats_.sign.txPkts - epochStats_.sign.txPkts : - stats_.sign.txPkts + (maxStatsValue_ - epochStats_.sign.txPkts); - stats->sign.txBytes = (stats_.sign.txBytes >= epochStats_.sign.txBytes) ? - stats_.sign.txBytes - epochStats_.sign.txBytes : - stats_.sign.txBytes + (maxStatsValue_ - epochStats_.sign.txBytes); - stats->sign.txPps = stats_.sign.txPps; - stats->sign.txBps = stats_.sign.txBps; } void AbstractPort::clearDeviceNeighbors() diff --git a/server/abstractport.h b/server/abstractport.h index a604bd2..7eb3996 100644 --- a/server/abstractport.h +++ b/server/abstractport.h @@ -36,19 +36,6 @@ class QIODevice; class AbstractPort { public: - struct Stats - { - quint64 rxPkts; - quint64 rxBytes; - quint64 rxPps; - quint64 rxBps; - - quint64 txPkts; - quint64 txBytes; - quint64 txPps; - quint64 txBps; - }; - struct PortStats { quint64 rxPkts; @@ -65,8 +52,6 @@ public: quint64 txBytes; quint64 txPps; quint64 txBps; - - Stats sign; }; enum Accuracy diff --git a/server/myservice.cpp b/server/myservice.cpp index 334853f..2240168 100644 --- a/server/myservice.cpp +++ b/server/myservice.cpp @@ -504,7 +504,6 @@ void MyService::getStats(::google::protobuf::RpcController* /*controller*/, AbstractPort::PortStats stats; OstProto::PortStats *s; OstProto::PortState *st; - OstProto::Stats *sign; portId = request->port_id(i).id(); if ((portId < 0) || (portId >= portInfo.size())) @@ -541,17 +540,6 @@ void MyService::getStats(::google::protobuf::RpcController* /*controller*/, s->set_rx_errors(stats.rxErrors); s->set_rx_fifo_errors(stats.rxFifoErrors); s->set_rx_frame_errors(stats.rxFrameErrors); - - sign = s->mutable_sign(); - sign->set_rx_pkts(stats.sign.rxPkts); - sign->set_rx_bytes(stats.sign.rxBytes); - sign->set_rx_pps(stats.sign.rxPps); - sign->set_rx_bps(stats.sign.rxBps); - - sign->set_tx_pkts(stats.sign.txPkts); - sign->set_tx_bytes(stats.sign.txBytes); - sign->set_tx_pps(stats.sign.txPps); - sign->set_tx_bps(stats.sign.txBps); } done->Run(); diff --git a/server/pcaptransmitter.cpp b/server/pcaptransmitter.cpp index 12df97d..a81ede9 100644 --- a/server/pcaptransmitter.cpp +++ b/server/pcaptransmitter.cpp @@ -78,11 +78,6 @@ void PcapTransmitter::useExternalStats(AbstractPort::PortStats *stats) txStats_.useExternalStats(stats); } -void PcapTransmitter::useSignedStreams(bool enable) -{ - txStats_.useSignedStreams(enable); -} - void PcapTransmitter::start() { txThread_.start(); diff --git a/server/pcaptransmitter.h b/server/pcaptransmitter.h index 83fd57f..3dc8eb9 100644 --- a/server/pcaptransmitter.h +++ b/server/pcaptransmitter.h @@ -43,8 +43,6 @@ public: void setHandle(pcap_t *handle); void useExternalStats(AbstractPort::PortStats *stats); - void useSignedStreams(bool enable); - void start(); void stop(); bool isRunning(); diff --git a/server/pcaptxstats.cpp b/server/pcaptxstats.cpp index 102df54..353ea9d 100644 --- a/server/pcaptxstats.cpp +++ b/server/pcaptxstats.cpp @@ -28,8 +28,6 @@ PcapTxStats::PcapTxStats() stats_ = new AbstractPort::PortStats; usingInternalStats_ = true; - usingSignedStreams_ = false; - stop_ = false; } @@ -52,11 +50,6 @@ void PcapTxStats::useExternalStats(AbstractPort::PortStats *stats) usingInternalStats_ = false; } -void PcapTxStats::useSignedStreams(bool enable) -{ - usingSignedStreams_ = enable; -} - void PcapTxStats::start() { QThread::start(); @@ -83,15 +76,6 @@ void PcapTxStats::run() stats_->txPkts = txThreadStats_->pkts; stats_->txBytes = txThreadStats_->bytes; - // XXX: If port uses signed streams, we assume that all packets - // sent by txThread are signed packets => this requires us to - // set sign tx stats equal to tx stats followed by a clear stats - // whenever this setting changes - if (usingSignedStreams_) { - stats_->sign.txPkts = txThreadStats_->pkts; - stats_->sign.txBytes = txThreadStats_->bytes; - } - if (stop_) break; QThread::msleep(1000); diff --git a/server/pcaptxstats.h b/server/pcaptxstats.h index 4025d57..ed134bb 100644 --- a/server/pcaptxstats.h +++ b/server/pcaptxstats.h @@ -36,8 +36,6 @@ public: void useExternalStats(AbstractPort::PortStats *stats); - void useSignedStreams(bool enable); - void start(); void stop(); private: @@ -48,7 +46,6 @@ private: bool usingInternalStats_; AbstractPort::PortStats *stats_; - volatile bool usingSignedStreams_; volatile bool stop_; };