Only add data points to the throughput graph if our time window has
advanced. Add a reset button. svn path=/trunk/; revision=51811
This commit is contained in:
parent
f9a9753d01
commit
2dca89e7a3
|
@ -344,7 +344,7 @@ void TCPStreamDialog::initializeThroughput()
|
|||
return;
|
||||
}
|
||||
|
||||
QVector<double> rel_time, seg_len, tput;
|
||||
QVector<double> rel_time, seg_len, tput_time, tput;
|
||||
struct segment *oldest_seg = graph_.segments;
|
||||
#ifndef MA_1_SECOND
|
||||
int i = 1;
|
||||
|
@ -381,10 +381,19 @@ void TCPStreamDialog::initializeThroughput()
|
|||
|
||||
rel_time.append(rt_val);
|
||||
seg_len.append(seg->th_seglen);
|
||||
tput.append(av_tput);
|
||||
|
||||
// Add a data point only if our time window has advanced. Otherwise
|
||||
// update the most recent point. (We might want to show a warning
|
||||
// for out-of-order packets.)
|
||||
if (tput_time.size() > 0 && rt_val <= tput_time.last()) {
|
||||
tput[tput.size() - 1] = av_tput;
|
||||
} else {
|
||||
tput.append(av_tput);
|
||||
tput_time.append(rt_val);
|
||||
}
|
||||
}
|
||||
sp->graph(0)->setData(rel_time, seg_len);
|
||||
sp->graph(1)->setData(rel_time, tput);
|
||||
sp->graph(1)->setData(tput_time, tput);
|
||||
|
||||
sp->yAxis->setLabel(tr("Segment length (B)"));
|
||||
|
||||
|
@ -538,6 +547,11 @@ void TCPStreamDialog::on_graphTypeComboBox_currentIndexChanged(int index)
|
|||
fillGraph();
|
||||
}
|
||||
|
||||
void TCPStreamDialog::on_resetButton_clicked()
|
||||
{
|
||||
resetAxes();
|
||||
}
|
||||
|
||||
void TCPStreamDialog::setCaptureFile(capture_file *cf)
|
||||
{
|
||||
if (!cf) { // We only want to know when the file closes.
|
||||
|
|
|
@ -87,6 +87,7 @@ private slots:
|
|||
void transformYRange(const QCPRange &y_range1);
|
||||
void on_buttonBox_accepted();
|
||||
void on_graphTypeComboBox_currentIndexChanged(int index);
|
||||
void on_resetButton_clicked();
|
||||
};
|
||||
|
||||
#endif // TCP_STREAM_DIALOG_H
|
||||
|
|
|
@ -79,6 +79,16 @@
|
|||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="resetButton">
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Reset the graph to its initial state.</p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Reset</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
|
|
Loading…
Reference in New Issue