aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGerald Combs <gerald@wireshark.org>2015-07-07 12:04:48 -0700
committerGerald Combs <gerald@wireshark.org>2015-07-07 23:17:51 +0000
commite93fa8a82dffd12d03d0ac4d8a71d83cf75f1eaa (patch)
treea6f44c1f4e385f70feb2a90d3b0992dfa922d08b
parent5ccd8afe9f3eb0956cd7dce994a677a8cfc9f4bf (diff)
Add ResponseTimeDelayDialog.
Change-Id: Ie1ea316643a3465763aec71f4a3ef4bf1a5ae639 Reviewed-on: https://code.wireshark.org/review/9548 Reviewed-by: Gerald Combs <gerald@wireshark.org>
-rw-r--r--epan/rtd_table.c6
-rw-r--r--epan/rtd_table.h20
-rw-r--r--ui/cli/tap-rtd.c2
-rw-r--r--ui/cli/tap-simple_stattable.c2
-rw-r--r--ui/gtk/response_time_delay_table.c4
-rw-r--r--ui/qt/CMakeLists.txt2
-rw-r--r--ui/qt/Makefile.common2
-rw-r--r--ui/qt/Wireshark.pro2
-rw-r--r--ui/qt/response_time_delay_dialog.cpp286
-rw-r--r--ui/qt/response_time_delay_dialog.h64
-rw-r--r--ui/qt/service_response_time_dialog.cpp26
-rw-r--r--ui/qt/service_response_time_dialog.h13
-rw-r--r--ui/qt/tap_parameter_dialog.cpp5
-rw-r--r--wireshark-qt.cpp18
14 files changed, 405 insertions, 47 deletions
diff --git a/epan/rtd_table.c b/epan/rtd_table.c
index d2aca8b097..1fe33d2b3a 100644
--- a/epan/rtd_table.c
+++ b/epan/rtd_table.c
@@ -57,6 +57,10 @@ tap_packet_cb get_rtd_packet_func(register_rtd_t* rtd)
return rtd->rtd_func;
}
+guint get_rtd_num_tables(register_rtd_t* rtd) {
+ return rtd->num_tables;
+}
+
const value_string* get_rtd_value_string(register_rtd_t* rtd)
{
return rtd->vs_type;
@@ -96,7 +100,7 @@ register_rtd_table(const int proto_id, const char* tap_listener, guint num_table
registered_rtd_tables = g_slist_insert_sorted(registered_rtd_tables, table, insert_sorted_by_table_name);
}
-void free_rtd_table(register_rtd_t* rtd _U_, rtd_stat_table* table, rtd_gui_free_cb gui_callback, void *callback_data)
+void free_rtd_table(rtd_stat_table* table, rtd_gui_free_cb gui_callback, void *callback_data)
{
guint i;
diff --git a/epan/rtd_table.h b/epan/rtd_table.h
index 267fe93254..da71636762 100644
--- a/epan/rtd_table.h
+++ b/epan/rtd_table.h
@@ -52,7 +52,7 @@ typedef struct _rtd_stat_table {
*/
typedef struct _rtd_data_t {
rtd_stat_table stat_table; /**< RTD table data */
- void *user_data; /**< "GUI" specifics (if necessary) */
+ void *user_data; /**< "GUI" specifics (GTK+ only) */
} rtd_data_t;
/** Structure for information about a registered service response table */
@@ -60,9 +60,9 @@ struct register_rtd;
typedef struct register_rtd register_rtd_t;
typedef void (*rtd_gui_init_cb)(rtd_stat_table* rtd, void* gui_data);
-typedef void (*rtd_gui_reset_cb)(rtd_stat_table* rtd, void* gui_data);
-typedef void (*rtd_gui_free_cb)(rtd_stat_table* rtd, void* gui_data);
-typedef void (*rtd_init_cb)(struct register_rtd* rtd, rtd_gui_init_cb gui_callback, void* gui_data);
+typedef void (*rtd_gui_reset_cb)(rtd_stat_table* rtd, void* gui_data); /* GTK+ only. */
+typedef void (*rtd_gui_free_cb)(rtd_stat_table* rtd, void* gui_data); /* GTK+ only. */
+typedef void (*rtd_init_cb)(struct register_rtd* rtd, rtd_gui_init_cb gui_callback, void* gui_data); /* GTK+ only. */
typedef void (*rtd_filter_check_cb)(const char *opt_arg, const char **filter, char** err);
/** Register the response time delay table.
@@ -84,7 +84,7 @@ WS_DLL_PUBLIC void register_rtd_table(const int proto_id, const char* tap_listen
*/
WS_DLL_PUBLIC int get_rtd_proto_id(register_rtd_t* rtd);
-/** Get string for register_tap_listener call. Typically just dissector name
+/** Get string for register_tap_listener call. Typically just dissector name
*
* @param rtd Registered RTD
* @return string for register_tap_listener call
@@ -98,6 +98,13 @@ WS_DLL_PUBLIC const char* get_rtd_tap_listener_name(register_rtd_t* rtd);
*/
WS_DLL_PUBLIC tap_packet_cb get_rtd_packet_func(register_rtd_t* rtd);
+/** Get the number of RTD tables
+ *
+ * @param rtd Registered RTD
+ * @return The number of registered tables.
+ */
+WS_DLL_PUBLIC guint get_rtd_num_tables(register_rtd_t* rtd);
+
/** Get value_string used for RTD
*
* @param rtd Registered RTD
@@ -114,12 +121,11 @@ WS_DLL_PUBLIC register_rtd_t* get_rtd_table_by_name(const char* name);
/** Free the RTD table data.
*
- * @param rtd Registered RTD
* @param table RTD stat table array
* @param gui_callback optional callback from GUI
* @param callback_data callback data needed for GUI
*/
-WS_DLL_PUBLIC void free_rtd_table(register_rtd_t* rtd, rtd_stat_table* table, rtd_gui_free_cb gui_callback, void *callback_data);
+WS_DLL_PUBLIC void free_rtd_table(rtd_stat_table* table, rtd_gui_free_cb gui_callback, void *callback_data);
/** Reset table data in the RTD.
*
diff --git a/ui/cli/tap-rtd.c b/ui/cli/tap-rtd.c
index a939817431..2e43286b62 100644
--- a/ui/cli/tap-rtd.c
+++ b/ui/cli/tap-rtd.c
@@ -115,7 +115,7 @@ init_rtd_tables(register_rtd_t* rtd, const char *filter)
error_string = register_tap_listener(get_rtd_tap_listener_name(rtd), &ui->rtd, filter, 0, NULL, get_rtd_packet_func(rtd), rtd_draw);
if (error_string) {
- free_rtd_table(rtd, &ui->rtd.stat_table, NULL, NULL);
+ free_rtd_table(&ui->rtd.stat_table, NULL, NULL);
fprintf(stderr, "tshark: Couldn't register srt tap: %s\n", error_string->str);
g_string_free(error_string, TRUE);
exit(1);
diff --git a/ui/cli/tap-simple_stattable.c b/ui/cli/tap-simple_stattable.c
index 29ffc73880..08edce0427 100644
--- a/ui/cli/tap-simple_stattable.c
+++ b/ui/cli/tap-simple_stattable.c
@@ -115,7 +115,7 @@ init_stat_table(new_stat_tap_ui *new_stat_tap, const char *filter)
error_string = register_tap_listener(new_stat_tap->tap_name, &ui->stats, filter, 0, NULL, new_stat_tap->packet_func, simple_draw);
if (error_string) {
-/* free_rtd_table(rtd, &ui->rtd.stat_table, NULL, NULL); */
+/* free_rtd_table(&ui->rtd.stat_table, NULL, NULL); */
fprintf(stderr, "tshark: Couldn't register tap: %s\n", error_string->str);
g_string_free(error_string, TRUE);
exit(1);
diff --git a/ui/gtk/response_time_delay_table.c b/ui/gtk/response_time_delay_table.c
index 7085d39ff9..26dc47d9f8 100644
--- a/ui/gtk/response_time_delay_table.c
+++ b/ui/gtk/response_time_delay_table.c
@@ -116,7 +116,7 @@ win_destroy_cb(GtkWindow *win _U_, gpointer data)
remove_tap_listener(&rr->data);
- free_rtd_table(rr->rtd, &rr->data.stat_table, NULL, NULL);
+ free_rtd_table(&rr->data.stat_table, NULL, NULL);
g_free(rr);
}
@@ -306,7 +306,7 @@ init_rtd_tables(register_rtd_t* rtd, const char *filter)
if(error_string){
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s", error_string->str);
g_string_free(error_string, TRUE);
- free_rtd_table(rr->rtd, &rr->data.stat_table, NULL, NULL);
+ free_rtd_table(&rr->data.stat_table, NULL, NULL);
g_free(rr);
return;
}
diff --git a/ui/qt/CMakeLists.txt b/ui/qt/CMakeLists.txt
index bb64a01df4..8dedded530 100644
--- a/ui/qt/CMakeLists.txt
+++ b/ui/qt/CMakeLists.txt
@@ -97,6 +97,7 @@ set(WIRESHARK_QT_HEADERS
qcustomplot.h
recent_file_status.h
related_packet_delegate.h
+ response_time_delay_dialog.h
rtp_stream_dialog.h
sctp_all_assocs_dialog.h
sctp_assoc_analyse_dialog.h
@@ -220,6 +221,7 @@ set(WIRESHARK_QT_SRC
qt_ui_utils.cpp
recent_file_status.cpp
related_packet_delegate.cpp
+ response_time_delay_dialog.cpp
rtp_stream_dialog.cpp
sctp_all_assocs_dialog.cpp
sctp_assoc_analyse_dialog.cpp
diff --git a/ui/qt/Makefile.common b/ui/qt/Makefile.common
index 1e89b4c94b..531fb3c6c0 100644
--- a/ui/qt/Makefile.common
+++ b/ui/qt/Makefile.common
@@ -206,6 +206,7 @@ MOC_HDRS = \
related_packet_delegate.h \
remote_capture_dialog.h \
remote_settings_dialog.h \
+ response_time_delay_dialog.h \
search_frame.h \
rtp_stream_dialog.h \
sctp_all_assocs_dialog.h \
@@ -433,6 +434,7 @@ WIRESHARK_QT_SRC = \
related_packet_delegate.cpp \
remote_capture_dialog.cpp \
remote_settings_dialog.cpp \
+ response_time_delay_dialog.cpp \
rtp_stream_dialog.cpp \
sctp_all_assocs_dialog.cpp \
sctp_assoc_analyse_dialog.cpp \
diff --git a/ui/qt/Wireshark.pro b/ui/qt/Wireshark.pro
index 72140d221e..a1b049801e 100644
--- a/ui/qt/Wireshark.pro
+++ b/ui/qt/Wireshark.pro
@@ -613,6 +613,7 @@ HEADERS += \
qcustomplot.h \
recent_file_status.h \
related_packet_delegate.h \
+ response_time_delay_dialog.h \
sequence_diagram.h \
sequence_dialog.h \
simple_dialog.h \
@@ -706,6 +707,7 @@ SOURCES += \
related_packet_delegate.cpp \
remote_capture_dialog.cpp \
remote_settings_dialog.cpp \
+ response_time_delay_dialog.cpp \
rtp_stream_dialog.cpp \
sctp_all_assocs_dialog.cpp \
sctp_assoc_analyse_dialog.cpp \
diff --git a/ui/qt/response_time_delay_dialog.cpp b/ui/qt/response_time_delay_dialog.cpp
new file mode 100644
index 0000000000..b9610fa4f3
--- /dev/null
+++ b/ui/qt/response_time_delay_dialog.cpp
@@ -0,0 +1,286 @@
+/* response_time_delay_dialog.cpp
+ *
+ * Wireshark - Network traffic analyzer
+ * By Gerald Combs <gerald@wireshark.org>
+ * Copyright 1998 Gerald Combs
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include "response_time_delay_dialog.h"
+
+#include "file.h"
+
+#include "epan/proto.h"
+#include "epan/rtd_table.h"
+
+#include <QMessageBox>
+#include <QTreeWidget>
+
+#include "qt_ui_utils.h"
+#include "wireshark_application.h"
+
+#include <QDebug>
+
+static QHash<const QString, register_rtd_t *> cfg_str_to_rtd_;
+
+extern "C" {
+static void
+rtd_init(const char *args, void*) {
+ QStringList args_l = QString(args).split(',');
+ if (args_l.length() > 1) {
+ QString rtd = QString("%1,%2").arg(args_l[0]).arg(args_l[1]);
+ QString filter;
+ if (args_l.length() > 2) {
+ filter = QStringList(args_l.mid(2)).join(",");
+ }
+ wsApp->emitTapParameterSignal(rtd, filter, NULL);
+ }
+}
+}
+
+void register_response_time_delay_tables(gpointer data, gpointer)
+{
+ register_rtd_t *rtd = (register_rtd_t*)data;
+ const char* short_name = proto_get_protocol_short_name(find_protocol_by_id(get_rtd_proto_id(rtd)));
+ const char *cfg_abbr = rtd_table_get_tap_string(rtd);
+
+ cfg_str_to_rtd_[cfg_abbr] = rtd;
+ TapParameterDialog::registerDialog(
+ short_name,
+ cfg_abbr,
+ REGISTER_STAT_GROUP_RESPONSE_TIME,
+ rtd_init,
+ ResponseTimeDelayDialog::createRtdDialog);
+}
+
+enum {
+ col_type_,
+ col_messages_,
+ col_min_srt_,
+ col_max_srt_,
+ col_avg_srt_,
+ col_min_frame_,
+ col_max_frame_,
+ col_open_requests,
+ col_discarded_reponses_,
+ col_repeated_requests_,
+ col_repeated_responses_
+};
+
+QStringList header_names_ = QStringList()
+ << "Type" << "Messages"
+ << "Min SRT" << "Max SRT" << "Avg SRT"
+ << "Min in Frame" << "Max in Frame"
+ << "Open Requests" << "Discarded Responses"
+ << "Repeated Requests" << "Repeated Responses";
+
+enum {
+ rtd_table_type_ = 1000,
+ rtd_time_stat_type_
+};
+
+class RtdTimeStatTreeWidgetItem : public QTreeWidgetItem
+{
+public:
+ RtdTimeStatTreeWidgetItem(QTreeWidget *parent, const QString type, const rtd_timestat *timestat) :
+ QTreeWidgetItem (parent, rtd_time_stat_type_),
+ type_(type),
+ timestat_(timestat)
+ {
+ setText(col_type_, type_);
+ setHidden(true);
+ }
+ void draw() {
+ setText(col_messages_, QString::number(timestat_->rtd->num));
+ setText(col_min_srt_, QString::number(nstime_to_sec(&timestat_->rtd->min), 'f', 6));
+ setText(col_max_srt_, QString::number(nstime_to_sec(&timestat_->rtd->max), 'f', 6));
+ setText(col_avg_srt_, QString::number(get_average(&timestat_->rtd->tot, timestat_->rtd->num) / 1000.0, 'f', 6));
+ setText(col_min_frame_, QString::number(timestat_->rtd->min_num));
+ setText(col_max_frame_, QString::number(timestat_->rtd->max_num));
+ setText(col_open_requests, QString::number(timestat_->open_req_num));
+ setText(col_discarded_reponses_, QString::number(timestat_->disc_rsp_num));
+ setText(col_repeated_requests_, QString::number(timestat_->req_dup_num));
+ setText(col_repeated_responses_, QString::number(timestat_->rsp_dup_num));
+
+ setHidden(timestat_->rtd->num < 1);
+ }
+ bool operator< (const QTreeWidgetItem &other) const
+ {
+ if (other.type() != rtd_time_stat_type_) return QTreeWidgetItem::operator< (other);
+ const RtdTimeStatTreeWidgetItem *other_row = static_cast<const RtdTimeStatTreeWidgetItem *>(&other);
+
+ switch (treeWidget()->sortColumn()) {
+ case col_messages_:
+ return timestat_->rtd->num < other_row->timestat_->rtd->num;
+ case col_min_srt_:
+ return nstime_cmp(&timestat_->rtd->min, &other_row->timestat_->rtd->min) < 0;
+ case col_max_srt_:
+ return nstime_cmp(&timestat_->rtd->max, &other_row->timestat_->rtd->max) < 0;
+ case col_avg_srt_:
+ {
+ double our_avg = get_average(&timestat_->rtd->tot, timestat_->rtd->num);
+ double other_avg = get_average(&other_row->timestat_->rtd->tot, other_row->timestat_->rtd->num);
+ return our_avg < other_avg;
+ }
+ case col_min_frame_:
+ return timestat_->rtd->min_num < other_row->timestat_->rtd->min_num;
+ case col_max_frame_:
+ return timestat_->rtd->max_num < other_row->timestat_->rtd->max_num;
+ case col_open_requests:
+ return timestat_->open_req_num < other_row->timestat_->open_req_num;
+ case col_discarded_reponses_:
+ return timestat_->disc_rsp_num < other_row->timestat_->disc_rsp_num;
+ case col_repeated_requests_:
+ return timestat_->req_dup_num < other_row->timestat_->req_dup_num;
+ case col_repeated_responses_:
+ return timestat_->rsp_dup_num < other_row->timestat_->rsp_dup_num;
+ default:
+ break;
+ }
+
+ return QTreeWidgetItem::operator< (other);
+ }
+ QList<QVariant> rowData() {
+ return QList<QVariant>() << type_ << timestat_->rtd->num
+ << nstime_to_sec(&timestat_->rtd->min) << nstime_to_sec(&timestat_->rtd->max)
+ << get_average(&timestat_->rtd->tot, timestat_->rtd->num) / 1000.0
+ << timestat_->rtd->min_num << timestat_->rtd->max_num
+ << timestat_->open_req_num << timestat_->disc_rsp_num
+ << timestat_->req_dup_num << timestat_->rsp_dup_num;
+ }
+
+private:
+ const QString type_;
+ const rtd_timestat *timestat_;
+};
+
+ResponseTimeDelayDialog::ResponseTimeDelayDialog(QWidget &parent, CaptureFile &cf, register_rtd *rtd, const QString filter, int help_topic) :
+ TapParameterDialog(parent, cf, help_topic),
+ rtd_(rtd)
+{
+ QString subtitle = QString("%1 Response Time Delay Statistics")
+ .arg(proto_get_protocol_short_name(find_protocol_by_id(get_rtd_proto_id(rtd))));
+ setWindowSubtitle(subtitle);
+
+ statsTreeWidget()->setHeaderLabels(header_names_);
+
+ for (int col = 0; col < statsTreeWidget()->columnCount(); col++) {
+ if (col == col_type_) continue;
+ statsTreeWidget()->headerItem()->setTextAlignment(col, Qt::AlignRight);
+ }
+
+ setDisplayFilter(filter);
+
+ if (!filter.isEmpty()) {
+ setDisplayFilter(filter);
+ }
+}
+
+TapParameterDialog *ResponseTimeDelayDialog::createRtdDialog(QWidget &parent, const QString cfg_str, const QString filter, CaptureFile &cf)
+{
+ if (!cfg_str_to_rtd_.contains(cfg_str)) {
+ // XXX MessageBox?
+ return NULL;
+ }
+
+ register_rtd_t *rtd = cfg_str_to_rtd_[cfg_str];
+
+ return new ResponseTimeDelayDialog(parent, cf, rtd, filter);
+}
+
+void ResponseTimeDelayDialog::addRtdTable(const _rtd_stat_table *rtd_table)
+{
+ for (unsigned i = 0; i < rtd_table->num_rtds; i++) {
+ const QString type = val_to_qstring(i, get_rtd_value_string(rtd_), "Other (%d)");
+ new RtdTimeStatTreeWidgetItem(statsTreeWidget(), type, &rtd_table->time_stats[i]);
+ }
+}
+
+void ResponseTimeDelayDialog::tapReset(void *rtdd_ptr)
+{
+ rtd_data_t *rtdd = (rtd_data_t*) rtdd_ptr;
+ ResponseTimeDelayDialog *rtd_dlg = static_cast<ResponseTimeDelayDialog *>(rtdd->user_data);
+ if (!rtd_dlg) return;
+
+ reset_rtd_table(&rtdd->stat_table, NULL, NULL);
+ rtd_dlg->statsTreeWidget()->clear();
+ rtd_dlg->addRtdTable(&rtdd->stat_table);
+}
+
+void ResponseTimeDelayDialog::tapDraw(void *rtdd_ptr)
+{
+ rtd_data_t *rtdd = (rtd_data_t*) rtdd_ptr;
+ ResponseTimeDelayDialog *rtd_dlg = static_cast<ResponseTimeDelayDialog *>(rtdd->user_data);
+ if (!rtd_dlg || !rtd_dlg->statsTreeWidget()) return;
+
+ QTreeWidgetItemIterator it(rtd_dlg->statsTreeWidget());
+ while (*it) {
+ if ((*it)->type() == rtd_time_stat_type_) {
+ RtdTimeStatTreeWidgetItem *rtd_ts_ti = static_cast<RtdTimeStatTreeWidgetItem *>((*it));
+ rtd_ts_ti->draw();
+ }
+ ++it;
+ }
+
+ for (int i = 0; i < rtd_dlg->statsTreeWidget()->columnCount() - 1; i++) {
+ rtd_dlg->statsTreeWidget()->resizeColumnToContents(i);
+ }
+}
+
+void ResponseTimeDelayDialog::fillTree()
+{
+ rtd_data_t rtd_data;
+ memset (&rtd_data, 0, sizeof(rtd_data));
+ rtd_table_dissector_init(rtd_, &rtd_data.stat_table, NULL, NULL);
+ rtd_data.user_data = this;
+
+ GString *error_string = register_tap_listener(get_rtd_tap_listener_name(rtd_),
+ &rtd_data,
+ displayFilter(),
+ 0,
+ tapReset,
+ get_rtd_packet_func(rtd_),
+ tapDraw);
+ if (error_string) {
+ QMessageBox::critical(this, tr("Failed to attach to tap \"%1\"").arg(get_rtd_tap_listener_name(rtd_)),
+ error_string->str);
+ g_string_free(error_string, TRUE);
+ free_rtd_table(&rtd_data.stat_table, NULL, NULL);
+ reject();
+ }
+
+ statsTreeWidget()->setSortingEnabled(false);
+
+ cf_retap_packets(cap_file_.capFile());
+
+ tapDraw(&rtd_data);
+
+ statsTreeWidget()->sortItems(col_type_, Qt::AscendingOrder);
+ statsTreeWidget()->setSortingEnabled(true);
+
+ remove_tap_listener(&rtd_data);
+ free_rtd_table(&rtd_data.stat_table, NULL, NULL);
+}
+
+QList<QVariant> ResponseTimeDelayDialog::treeItemData(QTreeWidgetItem *ti) const
+{
+ QList<QVariant> tid;
+ if (ti->type() == rtd_time_stat_type_) {
+ RtdTimeStatTreeWidgetItem *rtd_ts_ti = static_cast<RtdTimeStatTreeWidgetItem *>(ti);
+ tid << rtd_ts_ti->rowData();
+ }
+ return tid;
+}
diff --git a/ui/qt/response_time_delay_dialog.h b/ui/qt/response_time_delay_dialog.h
new file mode 100644
index 0000000000..38c52239ff
--- /dev/null
+++ b/ui/qt/response_time_delay_dialog.h
@@ -0,0 +1,64 @@
+/* response_time_delay_dialog.h
+ *
+ * Wireshark - Network traffic analyzer
+ * By Gerald Combs <gerald@wireshark.org>
+ * Copyright 1998 Gerald Combs
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef __RESPONSE_TIME_DELAY_DIALOG_H__
+#define __RESPONSE_TIME_DELAY_DIALOG_H__
+
+#include "tap_parameter_dialog.h"
+
+struct _rtd_stat_table;
+
+class ResponseTimeDelayDialog : public TapParameterDialog
+{
+ Q_OBJECT
+
+public:
+ ResponseTimeDelayDialog(QWidget &parent, CaptureFile &cf, struct register_rtd *rtd, const QString filter, int help_topic = 0);
+ static TapParameterDialog *createRtdDialog(QWidget &parent, const QString cfg_str, const QString filter, CaptureFile &cf);
+
+protected:
+ /** Add a response time delay table.
+ *
+ * @param rtd_table The table to add.
+ * @return A
+ */
+ // gtk:service_response_table.h:init_srt_table
+ void addRtdTable(const struct _rtd_stat_table *rtd_table);
+
+private:
+ struct register_rtd *rtd_;
+
+ // Callbacks for register_tap_listener
+ static void tapReset(void *rtdd_ptr);
+ static void tapDraw(void *rtdd_ptr);
+
+ virtual void fillTree();
+ virtual QList<QVariant> treeItemData(QTreeWidgetItem *ti) const;
+};
+
+/** Register function to register dissectors that support RTD.
+ *
+ * @param data register_rtd_t* representing dissetor RTD table
+ * @param user_data is unused
+ */
+void register_response_time_delay_tables(gpointer data, gpointer user_data);
+
+#endif // __RESPONSE_TIME_DELAY_DIALOG_H__
diff --git a/ui/qt/service_response_time_dialog.cpp b/ui/qt/service_response_time_dialog.cpp
index 33f0323f70..17aba9be5e 100644
--- a/ui/qt/service_response_time_dialog.cpp
+++ b/ui/qt/service_response_time_dialog.cpp
@@ -23,7 +23,6 @@
#include "file.h"
-#include <epan/timestats.h>
#include <epan/tap.h>
#include <ui/service_response_time.h>
@@ -34,12 +33,9 @@
#include <QTreeWidget>
#include <QTreeWidgetItemIterator>
-// To do:
-
static QHash<const QString, register_srt_t *> cfg_str_to_srt_;
extern "C" {
-// XXX Need to handle filters.
static void
srt_init(const char *args, void*) {
QStringList args_l = QString(args).split(',');
@@ -96,11 +92,7 @@ public:
setText(SRT_COLUMN_CALLS, QString::number(procedure_->stats.num));
setText(SRT_COLUMN_MIN, QString::number(nstime_to_sec(&procedure_->stats.min), 'f', 6));
setText(SRT_COLUMN_MAX, QString::number(nstime_to_sec(&procedure_->stats.max), 'f', 6));
- double avg_time = 0.0;
- if (procedure_->stats.num) {
- avg_time = nstime_to_sec(&procedure_->stats.min) / procedure_->stats.num;
- }
- setText(SRT_COLUMN_AVG, QString::number(avg_time, 'f', 6));
+ setText(SRT_COLUMN_AVG, QString::number(get_average(&procedure_->stats.tot, procedure_->stats.num) / 1000.0, 'f', 6));
setText(SRT_COLUMN_SUM, QString::number(nstime_to_sec(&procedure_->stats.tot), 'f', 6));
for (int col = 0; col < columnCount(); col++) {
@@ -127,8 +119,8 @@ public:
return nstime_cmp(&procedure_->stats.max, &other_row->procedure_->stats.max) < 0;
case SRT_COLUMN_AVG:
{
- double our_avg = nstime_to_msec(&procedure_->stats.tot) / procedure_->stats.num;
- double other_avg = nstime_to_msec(&other_row->procedure_->stats.tot) / other_row->procedure_->stats.num;
+ double our_avg = get_average(&procedure_->stats.tot, procedure_->stats.num);
+ double other_avg = get_average(&other_row->procedure_->stats.tot, other_row->procedure_->stats.num);
return our_avg < other_avg;
}
case SRT_COLUMN_SUM:
@@ -140,13 +132,10 @@ public:
return QTreeWidgetItem::operator< (other);
}
QList<QVariant> rowData() {
- double avg_time = 0.0;
- if (procedure_->stats.num) {
- avg_time = nstime_to_sec(&procedure_->stats.min) / procedure_->stats.num;
- }
return QList<QVariant>() << QString(procedure_->procedure) << procedure_->index << procedure_->stats.num
<< nstime_to_sec(&procedure_->stats.min) << nstime_to_sec(&procedure_->stats.max)
- << avg_time << nstime_to_sec(&procedure_->stats.tot);
+ << get_average(&procedure_->stats.tot, procedure_->stats.num) / 1000.0
+ << nstime_to_sec(&procedure_->stats.tot);
}
private:
const srt_procedure_t *procedure_;
@@ -264,10 +253,9 @@ TapParameterDialog *ServiceResponseTimeDialog::createSrtDialog(QWidget &parent,
return new ServiceResponseTimeDialog(parent, cf, srt, filter);
}
-QTreeWidgetItem *ServiceResponseTimeDialog::addSrtTable(const struct _srt_stat_table *srt_table)
+void ServiceResponseTimeDialog::addSrtTable(const struct _srt_stat_table *srt_table)
{
- SrtTableTreeWidgetItem *srtt_ti = new SrtTableTreeWidgetItem(statsTreeWidget(), srt_table);
- return srtt_ti;
+ new SrtTableTreeWidgetItem(statsTreeWidget(), srt_table);
}
void ServiceResponseTimeDialog::tapReset(void *srtd_ptr)
diff --git a/ui/qt/service_response_time_dialog.h b/ui/qt/service_response_time_dialog.h
index b7c7569bd3..39de1698b3 100644
--- a/ui/qt/service_response_time_dialog.h
+++ b/ui/qt/service_response_time_dialog.h
@@ -35,20 +35,19 @@ class ServiceResponseTimeDialog : public TapParameterDialog
public:
ServiceResponseTimeDialog(QWidget &parent, CaptureFile &cf, struct register_srt *srt, const QString filter, int help_topic = 0);
- static TapParameterDialog *createSrtDialog(QWidget &parent, const QString cfg_str, const QString arg, CaptureFile &cf);
+ static TapParameterDialog *createSrtDialog(QWidget &parent, const QString cfg_str, const QString filter, CaptureFile &cf);
protected:
- /** Add service response time table.
+ /** Add a service response time table.
*
* In the GTK+ UI "tables" are separate, tabbed widgets. In the Qt UI they are
* separate groups of QTreeWidgetItems.
*
- * @param title The table title (not shown if only one table).
- * @param num_procs Number of procedures.
- * @param filter_string filter string or QString().
+ * @param srt_table The table to add.
+ * @return A
*/
// gtk:service_response_table.h:init_srt_table
- QTreeWidgetItem *addSrtTable(const struct _srt_stat_table *srt_table);
+ void addSrtTable(const struct _srt_stat_table *srt_table);
private:
struct register_srt *srt_;
@@ -65,7 +64,7 @@ private slots:
void statsTreeWidgetItemChanged();
};
-/** Register function to register dissectors that support SRT for GTK.
+/** Register function to register dissectors that support SRT.
*
* @param data register_srt_t* representing dissetor SRT table
* @param user_data is unused
diff --git a/ui/qt/tap_parameter_dialog.cpp b/ui/qt/tap_parameter_dialog.cpp
index b5038d9a13..9bc6433c46 100644
--- a/ui/qt/tap_parameter_dialog.cpp
+++ b/ui/qt/tap_parameter_dialog.cpp
@@ -294,7 +294,10 @@ QByteArray TapParameterDialog::getTreeAsString(st_format_type format)
// Data
while (*it) {
QList<QVariant> tid = treeItemData((*it));
- if (tid.length() < 1) continue;
+ if (tid.length() < 1) {
+ ++it;
+ continue;
+ }
if (tid.length() < ui->statsTreeWidget->columnCount()) {
// Assume we have a header
diff --git a/wireshark-qt.cpp b/wireshark-qt.cpp
index 2abae5dc95..2dac07dc68 100644
--- a/wireshark-qt.cpp
+++ b/wireshark-qt.cpp
@@ -74,9 +74,11 @@
#include "file.h"
#include "color.h"
#include "color_filters.h"
-#include "ui/util.h"
#include "log.h"
+#include "epan/rtd_table.h"
+#include "epan/srt_table.h"
+
#include "ui/alert_box.h"
#include "ui/console.h"
#include "ui/iface_lists.h"
@@ -84,9 +86,14 @@
#include "ui/persfilepath_opt.h"
#include "ui/recent.h"
#include "ui/simple_dialog.h"
+#include "ui/util.h"
-#include "ui/qt/simple_dialog.h"
+#include "ui/qt/conversation_dialog.h"
+#include "ui/qt/endpoint_dialog.h"
#include "ui/qt/main_window.h"
+#include "ui/qt/response_time_delay_dialog.h"
+#include "ui/qt/service_response_time_dialog.h"
+#include "ui/qt/simple_dialog.h"
#include "ui/qt/splash_overlay.h"
#include "ui/qt/wireshark_application.h"
@@ -113,12 +120,6 @@
#include <QTextCodec>
#endif
-#include "ui/qt/conversation_dialog.h"
-#include "ui/qt/endpoint_dialog.h"
-
-#include "epan/srt_table.h"
-#include "ui/qt/service_response_time_dialog.h"
-
#if defined(HAVE_LIBPCAP) || defined(HAVE_EXTCAP)
capture_options global_capture_opts;
#endif
@@ -841,6 +842,7 @@ DIAG_ON(cast-qual)
conversation_table_set_gui_info(init_conversation_table);
hostlist_table_set_gui_info(init_endpoint_table);
srt_table_iterate_tables(register_service_response_tables, NULL);
+ rtd_table_iterate_tables(register_response_time_delay_tables, NULL);
if (ex_opt_count("read_format") > 0) {
in_file_type = open_info_name_to_type(ex_opt_get_next("read_format"));