sign: remove sign stats and remnants of signed streams

This commit is contained in:
Srivats P 2016-11-05 19:53:01 +05:30
parent 1986845bae
commit e0bf173b39
10 changed files with 0 additions and 101 deletions

View File

@ -170,12 +170,6 @@ QVariant PortStatsModel::data(const QModelIndex &index, int role) const
case e_STAT_BYTES_SENT_NIC: case e_STAT_BYTES_SENT_NIC:
return stats.tx_bytes_nic(); return stats.tx_bytes_nic();
#endif #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_DROPS : return quint64(stats.rx_drops());
case e_STAT_RX_ERRORS: return quint64(stats.rx_errors()); case e_STAT_RX_ERRORS: return quint64(stats.rx_errors());

View File

@ -60,11 +60,6 @@ typedef enum {
e_STAT_BYTES_SENT_NIC, e_STAT_BYTES_SENT_NIC,
#endif #endif
// Sign Stats
e_STAT_SIGN_FRAMES_RCVD,
e_STAT_SIGN_FRAMES_SENT,
// TODO: Other sign stats
// Rx Errors // Rx Errors
e_STAT_RX_DROPS, e_STAT_RX_DROPS,
e_STAT_RX_ERRORS, e_STAT_RX_ERRORS,
@ -99,9 +94,6 @@ static QStringList PortStatName = (QStringList()
<< "Bytes Sent (NIC)" << "Bytes Sent (NIC)"
#endif #endif
<< "(Sign) Frames Received"
<< "(Sign) Frames Sent"
<< "Receive Drops" << "Receive Drops"
<< "Receive Errors" << "Receive Errors"
<< "Receive Fifo Errors" << "Receive Fifo Errors"

View File

@ -236,19 +236,6 @@ message PortState {
optional bool is_capture_on = 3 [default = false]; 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 { message PortStats {
required PortId port_id = 1; required PortId port_id = 1;
@ -273,8 +260,6 @@ message PortStats {
optional uint64 rx_errors = 101; optional uint64 rx_errors = 101;
optional uint64 rx_fifo_errors = 102; optional uint64 rx_fifo_errors = 102;
optional uint64 rx_frame_errors = 103; optional uint64 rx_frame_errors = 103;
optional Stats sign = 1000;
} }
message PortStatsList { message PortStatsList {

View File

@ -631,25 +631,6 @@ void AbstractPort::stats(PortStats *stats)
stats->rxFrameErrors = (stats_.rxFrameErrors >= epochStats_.rxFrameErrors) ? stats->rxFrameErrors = (stats_.rxFrameErrors >= epochStats_.rxFrameErrors) ?
stats_.rxFrameErrors - epochStats_.rxFrameErrors : stats_.rxFrameErrors - epochStats_.rxFrameErrors :
stats_.rxFrameErrors + (maxStatsValue_ - 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() void AbstractPort::clearDeviceNeighbors()

View File

@ -36,19 +36,6 @@ class QIODevice;
class AbstractPort class AbstractPort
{ {
public: public:
struct Stats
{
quint64 rxPkts;
quint64 rxBytes;
quint64 rxPps;
quint64 rxBps;
quint64 txPkts;
quint64 txBytes;
quint64 txPps;
quint64 txBps;
};
struct PortStats struct PortStats
{ {
quint64 rxPkts; quint64 rxPkts;
@ -65,8 +52,6 @@ public:
quint64 txBytes; quint64 txBytes;
quint64 txPps; quint64 txPps;
quint64 txBps; quint64 txBps;
Stats sign;
}; };
enum Accuracy enum Accuracy

View File

@ -504,7 +504,6 @@ void MyService::getStats(::google::protobuf::RpcController* /*controller*/,
AbstractPort::PortStats stats; AbstractPort::PortStats stats;
OstProto::PortStats *s; OstProto::PortStats *s;
OstProto::PortState *st; OstProto::PortState *st;
OstProto::Stats *sign;
portId = request->port_id(i).id(); portId = request->port_id(i).id();
if ((portId < 0) || (portId >= portInfo.size())) 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_errors(stats.rxErrors);
s->set_rx_fifo_errors(stats.rxFifoErrors); s->set_rx_fifo_errors(stats.rxFifoErrors);
s->set_rx_frame_errors(stats.rxFrameErrors); 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(); done->Run();

View File

@ -78,11 +78,6 @@ void PcapTransmitter::useExternalStats(AbstractPort::PortStats *stats)
txStats_.useExternalStats(stats); txStats_.useExternalStats(stats);
} }
void PcapTransmitter::useSignedStreams(bool enable)
{
txStats_.useSignedStreams(enable);
}
void PcapTransmitter::start() void PcapTransmitter::start()
{ {
txThread_.start(); txThread_.start();

View File

@ -43,8 +43,6 @@ public:
void setHandle(pcap_t *handle); void setHandle(pcap_t *handle);
void useExternalStats(AbstractPort::PortStats *stats); void useExternalStats(AbstractPort::PortStats *stats);
void useSignedStreams(bool enable);
void start(); void start();
void stop(); void stop();
bool isRunning(); bool isRunning();

View File

@ -28,8 +28,6 @@ PcapTxStats::PcapTxStats()
stats_ = new AbstractPort::PortStats; stats_ = new AbstractPort::PortStats;
usingInternalStats_ = true; usingInternalStats_ = true;
usingSignedStreams_ = false;
stop_ = false; stop_ = false;
} }
@ -52,11 +50,6 @@ void PcapTxStats::useExternalStats(AbstractPort::PortStats *stats)
usingInternalStats_ = false; usingInternalStats_ = false;
} }
void PcapTxStats::useSignedStreams(bool enable)
{
usingSignedStreams_ = enable;
}
void PcapTxStats::start() void PcapTxStats::start()
{ {
QThread::start(); QThread::start();
@ -83,15 +76,6 @@ void PcapTxStats::run()
stats_->txPkts = txThreadStats_->pkts; stats_->txPkts = txThreadStats_->pkts;
stats_->txBytes = txThreadStats_->bytes; 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_) if (stop_)
break; break;
QThread::msleep(1000); QThread::msleep(1000);

View File

@ -36,8 +36,6 @@ public:
void useExternalStats(AbstractPort::PortStats *stats); void useExternalStats(AbstractPort::PortStats *stats);
void useSignedStreams(bool enable);
void start(); void start();
void stop(); void stop();
private: private:
@ -48,7 +46,6 @@ private:
bool usingInternalStats_; bool usingInternalStats_;
AbstractPort::PortStats *stats_; AbstractPort::PortStats *stats_;
volatile bool usingSignedStreams_;
volatile bool stop_; volatile bool stop_;
}; };