sign: Clear Port+Stream Stats on Clear(All) click
Although the RPC API provides separate APIs for clearing Port and Stream Stats, typical use case would be to clear both together
This commit is contained in:
parent
b622cc8e72
commit
eed4f8eb1d
@ -1578,13 +1578,14 @@ void PortGroup::clearPortStats(QList<uint> *portList)
|
|||||||
}
|
}
|
||||||
|
|
||||||
serviceStub->clearStats(controller, portIdList, ack,
|
serviceStub->clearStats(controller, portIdList, ack,
|
||||||
NewCallback(this, &PortGroup::processClearStatsAck, controller));
|
NewCallback(this, &PortGroup::processClearPortStatsAck,
|
||||||
|
controller));
|
||||||
}
|
}
|
||||||
_exit:
|
_exit:
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PortGroup::processClearStatsAck(PbRpcController *controller)
|
void PortGroup::processClearPortStatsAck(PbRpcController *controller)
|
||||||
{
|
{
|
||||||
qDebug("In %s", __FUNCTION__);
|
qDebug("In %s", __FUNCTION__);
|
||||||
|
|
||||||
@ -1594,6 +1595,38 @@ void PortGroup::processClearStatsAck(PbRpcController *controller)
|
|||||||
delete controller;
|
delete controller;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool PortGroup::clearStreamStats(QList<uint> *portList)
|
||||||
|
{
|
||||||
|
qDebug("In %s", __FUNCTION__);
|
||||||
|
|
||||||
|
if (state() != QAbstractSocket::ConnectedState)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
OstProto::StreamGuidList *guidList = new OstProto::StreamGuidList;
|
||||||
|
OstProto::Ack *ack = new OstProto::Ack;
|
||||||
|
PbRpcController *controller = new PbRpcController(guidList, ack);
|
||||||
|
|
||||||
|
if (portList == NULL)
|
||||||
|
guidList->mutable_port_id_list()->CopyFrom(*portIdList_);
|
||||||
|
else
|
||||||
|
for (int i = 0; i < portList->size(); i++)
|
||||||
|
guidList->mutable_port_id_list()->add_port_id()
|
||||||
|
->set_id(portList->at(i));
|
||||||
|
|
||||||
|
serviceStub->clearStreamStats(controller, guidList, ack,
|
||||||
|
NewCallback(this, &PortGroup::processClearStreamStatsAck,
|
||||||
|
controller));
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void PortGroup::processClearStreamStatsAck(PbRpcController *controller)
|
||||||
|
{
|
||||||
|
qDebug("In %s", __FUNCTION__);
|
||||||
|
|
||||||
|
delete controller;
|
||||||
|
}
|
||||||
|
|
||||||
bool PortGroup::getStreamStats(QList<uint> *portList)
|
bool PortGroup::getStreamStats(QList<uint> *portList)
|
||||||
{
|
{
|
||||||
qDebug("In %s", __FUNCTION__);
|
qDebug("In %s", __FUNCTION__);
|
||||||
|
@ -164,7 +164,9 @@ public:
|
|||||||
void getPortStats();
|
void getPortStats();
|
||||||
void processPortStatsList();
|
void processPortStatsList();
|
||||||
void clearPortStats(QList<uint> *portList = NULL);
|
void clearPortStats(QList<uint> *portList = NULL);
|
||||||
void processClearStatsAck(PbRpcController *controller);
|
void processClearPortStatsAck(PbRpcController *controller);
|
||||||
|
bool clearStreamStats(QList<uint> *portList = NULL);
|
||||||
|
void processClearStreamStatsAck(PbRpcController *controller);
|
||||||
bool getStreamStats(QList<uint> *portList = NULL);
|
bool getStreamStats(QList<uint> *portList = NULL);
|
||||||
void processStreamStatsList(PbRpcController *controller);
|
void processStreamStatsList(PbRpcController *controller);
|
||||||
|
|
||||||
|
@ -196,6 +196,8 @@ void PortStatsWindow::on_tbClear_clicked()
|
|||||||
{
|
{
|
||||||
pgl->portGroupByIndex(portList.at(i).portGroupId).
|
pgl->portGroupByIndex(portList.at(i).portGroupId).
|
||||||
clearPortStats(&portList[i].portList);
|
clearPortStats(&portList[i].portList);
|
||||||
|
pgl->portGroupByIndex(portList.at(i).portGroupId).
|
||||||
|
clearStreamStats(&portList[i].portList);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -222,6 +224,8 @@ void PortStatsWindow::on_tbClearAll_clicked()
|
|||||||
{
|
{
|
||||||
pgl->portGroupByIndex(portList.at(i).portGroupId)
|
pgl->portGroupByIndex(portList.at(i).portGroupId)
|
||||||
.clearPortStats(&portList[i].portList);
|
.clearPortStats(&portList[i].portList);
|
||||||
|
pgl->portGroupByIndex(portList.at(i).portGroupId)
|
||||||
|
.clearStreamStats(&portList[i].portList);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user