diff options
author | Gerald Combs <gerald@wireshark.org> | 2013-09-07 03:51:27 +0000 |
---|---|---|
committer | Gerald Combs <gerald@wireshark.org> | 2013-09-07 03:51:27 +0000 |
commit | 2dca89e7a333698bf4418d6f4d3a51b95baebe3f (patch) | |
tree | 1bb65e2f1f5883a213313395896f21225598b17f | |
parent | f9a9753d01277e355d6ac91017b9e329ade32f5d (diff) |
Only add data points to the throughput graph if our time window has
advanced. Add a reset button.
svn path=/trunk/; revision=51811
-rw-r--r-- | ui/qt/tcp_stream_dialog.cpp | 20 | ||||
-rw-r--r-- | ui/qt/tcp_stream_dialog.h | 1 | ||||
-rw-r--r-- | ui/qt/tcp_stream_dialog.ui | 10 |
3 files changed, 28 insertions, 3 deletions
diff --git a/ui/qt/tcp_stream_dialog.cpp b/ui/qt/tcp_stream_dialog.cpp index f8e8e30992..76b7a17064 100644 --- a/ui/qt/tcp_stream_dialog.cpp +++ b/ui/qt/tcp_stream_dialog.cpp @@ -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. diff --git a/ui/qt/tcp_stream_dialog.h b/ui/qt/tcp_stream_dialog.h index 26e73972f1..45ee68bc25 100644 --- a/ui/qt/tcp_stream_dialog.h +++ b/ui/qt/tcp_stream_dialog.h @@ -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 diff --git a/ui/qt/tcp_stream_dialog.ui b/ui/qt/tcp_stream_dialog.ui index fb37550ea3..ac78761918 100644 --- a/ui/qt/tcp_stream_dialog.ui +++ b/ui/qt/tcp_stream_dialog.ui @@ -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> |