LTE stats: trivial changes after review

Change-Id: Ibcb755440180fc761a547de55d14c3fdc32973de
Reviewed-on: https://code.wireshark.org/review/25024
Petri-Dish: Martin Mathieson <martin.r.mathieson@googlemail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
This commit is contained in:
Martin Mathieson 2017-12-27 23:38:42 +00:00 committed by Anders Broman
parent 538f0883f7
commit 25425839cf
3 changed files with 29 additions and 21 deletions

View File

@ -28,13 +28,12 @@
#include <epan/dissectors/packet-mac-lte.h>
#include <QFormLayout>
#include <QTreeWidget>
#include <QTreeWidgetItem>
#include <ui/qt/models/percent_bar_delegate.h>
#include <ui/qt/utils/qt_ui_utils.h>
#include "wireshark_application.h"
// TODO: have never tested in a live capture.
// Whole-UE headings.
enum {
@ -46,6 +45,7 @@ enum {
col_ul_bytes_,
col_ul_mb_s_,
col_ul_padding_percent_,
/* col_ul_crc_failed_, */
col_ul_retx_,
// DL-specific
col_dl_frames_,
@ -72,8 +72,8 @@ static double calculate_bw(const nstime_t *start_time, const nstime_t *stop_time
{
// Can only calculate bandwidth if have time delta
if (memcmp(start_time, stop_time, sizeof(nstime_t)) != 0) {
double elapsed_ms = (((double)stop_time->secs - (double)start_time->secs) * 1000) +
(((double)stop_time->nsecs - (double)start_time->nsecs) / 1000000);
double elapsed_ms = (((double)stop_time->secs - start_time->secs) * 1000) +
(((double)stop_time->nsecs - start_time->nsecs) / 1000000);
// Only really meaningful if have a few frames spread over time...
// For now at least avoid dividing by something very close to 0.0
@ -134,6 +134,8 @@ public:
void draw()
{
// Show current value of counter for each LCID.
// N.B. fields that are set as % using percent_bar_delegate.h
// for UE headings don't display here...
for (int n=0; n < 11; n++) {
setText(col_type_+n, QString("").sprintf("%u", lcids[n]));
}
@ -485,9 +487,9 @@ static const QStringList mac_whole_ue_row_labels = QStringList()
<< QObject::tr("DL ReTX");
static const QStringList mac_channel_counts_labels = QStringList()
<< QObject::tr("") << QObject::tr("CCCH") << QObject::tr("LCID 1") << QObject::tr("LCID 2")
<< QObject::tr("LCID 3") << QObject::tr("LCID 4") << QObject::tr("LCID 5")
<< QObject::tr("LCID 6")
<< QObject::tr("") << QObject::tr("CCCH")
<< QObject::tr("LCID 1") << QObject::tr("LCID 2") << QObject::tr("LCID 3")
<< QObject::tr("LCID 4") << QObject::tr("LCID 5") << QObject::tr("LCID 6")
<< QObject::tr("LCID 7") << QObject::tr("LCID 8") << QObject::tr("LCID 9")
<< QObject::tr("LCID 10")
// 'Blank out' UE-level fields
@ -712,7 +714,9 @@ void LteMacStatisticsDialog::clearCommonStats()
void LteMacStatisticsDialog::tapReset(void *ws_dlg_ptr)
{
LteMacStatisticsDialog *ws_dlg = static_cast<LteMacStatisticsDialog *>(ws_dlg_ptr);
if (!ws_dlg) return;
if (!ws_dlg) {
return;
}
ws_dlg->statsTreeWidget()->clear();
ws_dlg->clearCommonStats();
@ -720,6 +724,7 @@ void LteMacStatisticsDialog::tapReset(void *ws_dlg_ptr)
//---------------------------------------------------------------------------------------
// Process tap info from a new packet.
// Returns TRUE if a redraw is needed.
gboolean LteMacStatisticsDialog::tapPacket(void *ws_dlg_ptr, struct _packet_info *, epan_dissect *, const void *mac_lte_tap_info_ptr)
{
// Look up dialog and tap info.
@ -734,7 +739,7 @@ gboolean LteMacStatisticsDialog::tapPacket(void *ws_dlg_ptr, struct _packet_info
// Nothing more to do if tap entry isn't for a UE.
if ((mlt_info->rntiType != C_RNTI) && (mlt_info->rntiType != SPS_RNTI)) {
return TRUE;
return FALSE;
}
// Look for an existing UE to match this tap info.
@ -845,6 +850,7 @@ void LteMacStatisticsDialog::updateHeaderLabels()
// Whole-UE labels
statsTreeWidget()->setHeaderLabels(mac_whole_ue_row_labels);
} else if (statsTreeWidget()->selectedItems().count() > 0) {
// ULDL labels
switch (statsTreeWidget()->selectedItems()[0]->type()) {
case mac_ulsch_packet_count_row_type:
case mac_ulsch_byte_count_row_type:

View File

@ -71,7 +71,7 @@ private:
// Common stats.
mac_lte_common_stats commonStats_;
bool commonStatsCurrent_; // TODO: may not be worth it.
bool commonStatsCurrent_; // Set when changes have not yet been drawn
void updateCommonStats(const struct mac_lte_tap_info *mlt_info);
void drawCommonStats();
void clearCommonStats();

View File

@ -28,17 +28,14 @@
#include <epan/dissectors/packet-rlc-lte.h>
#include <QFormLayout>
#include <QTreeWidget>
#include <QTreeWidgetItem>
#include <QPushButton>
#include <ui/qt/utils/qt_ui_utils.h>
#include "wireshark_application.h"
#include "ui/recent.h"
// TODO: have lost the ability to filter on only UL or DL of a channel.
// - can we override the context menu inherited from TapParameterDialog?
// TODO: have never tested in a live capture.
enum {
col_ueid_,
@ -68,8 +65,8 @@ static double calculate_bw(const nstime_t *start_time, const nstime_t *stop_time
{
/* Can only calculate bandwidth if have time delta */
if (memcmp(start_time, stop_time, sizeof(nstime_t)) != 0) {
double elapsed_ms = (((double)stop_time->secs - (double)start_time->secs) * 1000) +
(((double)stop_time->nsecs - (double)start_time->nsecs) / 1000000);
double elapsed_ms = (((double)stop_time->secs - start_time->secs) * 1000) +
(((double)stop_time->nsecs - start_time->nsecs) / 1000000);
/* Only really meaningful if have a few frames spread over time...
For now at least avoid dividing by something very close to 0.0 */
@ -89,7 +86,6 @@ static double calculate_bw(const nstime_t *start_time, const nstime_t *stop_time
// Stats kept for one channel.
typedef struct rlc_channel_stats {
guint8 inUse;
guint8 rlcMode;
guint8 priority;
guint16 channelType;
@ -193,6 +189,7 @@ public:
if (tap_info->priority != 0) {
priority_ = tap_info->priority;
// TODO: update the column string!
}
if (tap_info->direction == DIRECTION_UPLINK) {
@ -235,7 +232,7 @@ public:
// Draw channel entry.
void draw() {
// Calculate bandwidth.
// Calculate bandwidths.
double UL_bw = calculate_bw(&stats_.UL_time_start,
&stats_.UL_time_stop,
stats_.UL_bytes);
@ -335,6 +332,7 @@ public:
QList<QVariant> rowData() const
{
// Don't output anything for channel entries when exporting to text.
return QList<QVariant>();
}
@ -524,7 +522,7 @@ public:
void draw() {
// Fixed fields only drawn once from constructor so don't redraw here.
/* Calculate bandwidths */
/* Calculate bandwidths. */
double UL_bw = calculate_bw(&stats_.UL_time_start,
&stats_.UL_time_stop,
stats_.UL_total_bytes);
@ -650,6 +648,7 @@ private:
// Only the first 3 columns headings differ between UE and channel rows.
static const QString ue_col_0_title_ = QObject::tr("UE Id");
static const QString ue_col_1_title_ = QObject::tr("");
static const QString ue_col_2_title_ = QObject::tr("");
@ -784,6 +783,7 @@ void LteRlcStatisticsDialog::tapReset(void *ws_dlg_ptr)
}
// Process the tap info from a dissected RLC PDU.
// Returns TRUE if a redraw is needed.
gboolean LteRlcStatisticsDialog::tapPacket(void *ws_dlg_ptr, struct _packet_info *, epan_dissect *, const void *rlc_lte_tap_info_ptr)
{
// Look up dialog.
@ -795,7 +795,7 @@ gboolean LteRlcStatisticsDialog::tapPacket(void *ws_dlg_ptr, struct _packet_info
ws_dlg->incFrameCount();
// Look for this UE (linear search...).
// Look for this UE (TODO: avoid linear search if have lots of UEs in capture...)
RlcUeTreeWidgetItem *ue_ti = NULL;
for (int i = 0; i < ws_dlg->statsTreeWidget()->topLevelItemCount(); i++) {
QTreeWidgetItem *ti = ws_dlg->statsTreeWidget()->topLevelItem(i);
@ -826,7 +826,9 @@ void LteRlcStatisticsDialog::tapDraw(void *ws_dlg_ptr)
{
// Look up UE.
LteRlcStatisticsDialog *ws_dlg = static_cast<LteRlcStatisticsDialog *>(ws_dlg_ptr);
if (!ws_dlg) return;
if (!ws_dlg) {
return;
}
// Draw each UE.
for (int i = 0; i < ws_dlg->statsTreeWidget()->topLevelItemCount(); i++) {