summaryrefslogtreecommitdiff
path: root/ui/qt/packet_list_model.cpp
diff options
context:
space:
mode:
authorGerald Combs <gerald@wireshark.org>2016-07-11 15:40:03 -0700
committerGerald Combs <gerald@wireshark.org>2016-07-12 15:04:43 +0000
commit479caf15e7f57da098fd94b5f947ac45a6496663 (patch)
treefe87f6ed71aca3e4d117532918ed5ab538a79b09 /ui/qt/packet_list_model.cpp
parent3fe92ffabfa00d981797ef950af6eaa526617b9b (diff)
downloadwireshark-479caf15e7f57da098fd94b5f947ac45a6496663.tar.gz
Add resource usage logging.
Add log_resource_usage, which prints the current and elapsed user and system times. Add a usage example in packet_list_model.cpp. Change-Id: I747161c754a3731e540821715cc9bb10b3dc821d Reviewed-on: https://code.wireshark.org/review/16383 Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Gerald Combs <gerald@wireshark.org>
Diffstat (limited to 'ui/qt/packet_list_model.cpp')
-rw-r--r--ui/qt/packet_list_model.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/ui/qt/packet_list_model.cpp b/ui/qt/packet_list_model.cpp
index 4bbb63658d..26116b6549 100644
--- a/ui/qt/packet_list_model.cpp
+++ b/ui/qt/packet_list_model.cpp
@@ -44,6 +44,13 @@
#include <QModelIndex>
#include <QElapsedTimer>
+// Print timing information
+//#define DEBUG_PACKET_LIST_MODEL 1
+
+#ifdef DEBUG_PACKET_LIST_MODEL
+#include <wsutil/time_util.h>
+#endif
+
PacketListModel::PacketListModel(QObject *parent, capture_file *cf) :
QAbstractItemModel(parent),
max_row_height_(0),
@@ -603,6 +610,12 @@ gint PacketListModel::appendPacket(frame_data *fdata)
PacketListRecord *record = new PacketListRecord(fdata);
gint pos = -1;
+#ifdef DEBUG_PACKET_LIST_MODEL
+ if (fdata->num % 10000 == 1) {
+ log_resource_usage(fdata->num == 1, "%u packets", fdata->num);
+ }
+#endif
+
physical_rows_ << record;
if (fdata->flags.passed_dfilter || fdata->flags.ref_time) {