Commit Graph

1131 Commits

Author SHA1 Message Date
Srivats P
483f7fb4c5 Fix empty port stats when viewing rsvd ports only
This was a regression introduced in 1.3.0 as part of the port stats UX
improvement. The 'user' row was changed from the first (0) to the last,
but the proxy model continued to use a hard-coded value of 0 to check
for user to determine whether to show a port column or not.
2023-11-08 12:55:39 +05:30
Srivats P
d067019959 Bump to next dev version 1.4.0-dev 2023-11-08 10:44:51 +05:30
Srivats P
eb9d5eaf1a Bump version to 1.3.0 2023-10-19 10:50:25 +05:30
Srivats P
e677dc7d16 Fix div by 0 crash in stream timing stats (jitter) 2023-10-14 12:05:21 +05:30
Srivats P
ebe6aef62d Fix icon-only delegate
The delegate was still rendering display text. But we didn't realize
because the only place where this delegate was used was returning a
QVariant() for DisplayText role earlier. Once we started returning a
valid QString (for copy-paste purposes), this bug showed up.

This didn't work because we further delegate the actual painting to
the base QStyledItemDelegate which re-initializes option.features
from the item index values, so removing HasDisplay does not work.

The fix is to override the displayText() to return a null string.
2023-10-13 12:16:03 +05:30
Srivats P
1e8486991d Include state in port stats text copy to clipboard
The view uses an icon-only delegate for state to suppress the text
display
2023-10-11 13:07:02 +05:30
Srivats P
fff61d7773 Add assert version checks for upcoming 1.3.0 2023-10-11 12:57:25 +05:30
Srivats P
eb3331f74d Update copyright years in About 2023-10-11 12:57:05 +05:30
Srivats P
f3f553d149 Override RxStats filter if specified in drone.ini
This was added to work around any libpcap wrong BPF generation like #354 or
to workaround issues like #355 (stream stats with ICMPv6)
2023-10-03 11:41:57 +05:30
Srivats P
49cb7c40e0 Check and warn about stream stats for ICMP streams
Stream stats are not supportedd for ICMP packets
2023-10-03 11:39:46 +05:30
Srivats P
5581118e2f Work around faulty linux rx stats capture filter
libpcap has a bug on Linux which leads to incorrect BPF generation for our
capture filter. This commit changes the filter expression on Linux such that
correct BPF is generated.

Fixes #354
2023-10-03 10:39:03 +05:30
Srivats P
3bcd31a1ea Use IPv4AddrValidator for IPv4 protocol config UI 2023-07-17 16:10:07 +05:30
Srivats P
268fad0690 Include headers also when copying stream stats
This is for plain text copy format.

This also replaces any newlines in the header text with a space to maintain
formatting.
2023-06-26 18:08:49 +05:30
Srivats P
28b308ce6c Try and fit all stream stats column within window
* Resize columns to content (instead of using default width)
 * Use Kpps/Mpps for Pkt Rate with 3 decimal
 * Use 3 decimal places for bit-rates (is more logical because units change
   every 1000 anyway)
 * Use 2 decimal places for time interval

This just improves the chances of all columns fitting - but is not guaranteed
2023-06-26 17:03:47 +05:30
Srivats P
bfda96a888 Add jitter to Stream Stats in the GUI
These are the GUI side changes to the jitter server side changes committed
earlier.
2023-06-26 14:38:28 +05:30
Srivats P
a2734647b6 Fix stream timing clear for all GUIDs for a port
AbstractPort uses a value of UINT_MAX to signify 'all guids', but
StreamTiming uses 'invalid guid' value which are NOT the same value. But
UINT_MAX is guaranteed to be greater than invalid GUID - so instead of
equality we check for greater than comparison.
2023-06-26 13:03:25 +05:30
Srivats P
5eb2ad1979 Calculate per stream jitter using latency values
We calculate "average jitter".

The changes include only the server side, not the client/GUI side which will
be done in a future commit.
2023-06-26 13:01:11 +05:30
Srivats P
1fa84ec644 Use pkt-set delay instead of list's in intlvd mode
Since we now create an explicit packet set even for interleaved mode, we can
calculate and use the packet set delay instead of using the list loop delay.

With this change both sequential and interleaved mode do not use list loop
delay at all, but we still retain the code for that - in case we need to use
it later for some reason.
2023-06-22 11:45:22 +05:30
Srivats P
c044880f1a Fix inaccurate low tx rates (~1000pps) in seq mode
Creation of explicit packet sets had both a packet set delay and a list loop
delay set leading to lower than configured rate at tx. Earlier implicit
packet set always had set delay as 0 and only list loop delay was used.

Fix is to always set list loop delay to 0 in sequential mode as packet set
will have the correct delay set due to explicit packet sets.
2023-06-22 10:47:13 +05:30
Srivats P
2941c7ec22 Fix crash for top speed tx with ttag in seq mode
Crash was due to loopDelay being 0 in case of topSpeed. For ttags, we
recalculatue loopDelay based on max line rate and avg pkt size.

The problem doesn't exist in interleaved mode because minGap and duration
are non-zero in the top speed tx case.
2023-06-20 11:59:56 +05:30
Srivats P
ee45aaf0eb Change StreamTiming::TxRxKey format
The format now matches the ttag list format input in recordTxTime() making
that API a little more optimized.
2023-06-17 12:14:18 +05:30
Srivats P
5ec7010c51 Fix contention for port streamStats across threads
Tx/Rx stream stats related threads no longer have a direct reference to the
port's stream stats - instead they have their own copy that they keep and
return (in a reset-on-read fashion) when asked for. Each copy also has it's
own lock to prevent contention for read/update/clear.

PcapPort now fetches Tx(Transmitter) and Rx(Poller) stats on demand and
updates the port's stream stats - under protection of a lock.
2023-06-17 11:31:48 +05:30
Srivats P
bef0f1d162 Make stream timing recordTx/Rx APIs inline 2023-06-15 12:56:53 +05:30
Srivats P
598e6bf243 Merge changes made in base code for turbo/latency 2023-06-15 12:32:20 +05:30
Srivats P
63ed64a9d2 Fix extra whitespace in latency feature added code 2023-05-26 11:31:52 +05:30
Srivats P
8ef9da062d Comment out L4Cksum code from pcap tx thread
We are not rewriting L4Cksum for ttag packets at the moment. See
comment in packetsequence.h

Commenting out this code doesn't seem to observably improve tx
performance though.

The latency code seems to reduce stream stats max tx performance
by around 3 to 5%. Recovering this may be done separately as part
of overall performance optimzation of Tx code.
2023-05-26 11:31:52 +05:30
Srivats P
7fee90313e Don't use avgDelay in interleaved mode
The interleaved mode's single packet set MUST always have 0 delay
for accurate rate.

Before latency code, the interleaved packet set was added implicitly
and had 0 delay. Latency code added explicit packet set and used
avgDelay for the set. The avgDelay was needed for the original algo
used to determine when to send ttag packets. That algo is no longer
used (ttag markers are now explicitly configured by AbstractPort).

Turbo still needs avgDelay for other use, but changes will be made in
Turbo code for that.
2023-05-26 11:31:52 +05:30
Srivats P
bafdd948f8 Make win32 specific changes for per-stream latency
There are 2 changes -
1. Encode txPort in ttag packets and use it at TxTtagStats and
RxPcapStats to identify Tx and Rx packets respectively
2. Don't use pcap_sendqueue_transmit() if stream timing is in use -
since we can't modify TTAG packets inside that API
2023-05-26 11:31:52 +05:30
Srivats P
e138fa0d3d Fix windows build issues 2023-05-26 11:31:52 +05:30
Srivats P
8583299a1c Compile out timing debug prints
They can be compiled in if required
2023-05-26 11:31:52 +05:30
Srivats P
4ba98cc520 Fix latency timers not getting started/stopped
In a previous commit, we start/stop these timers based on number of
ports tracking stream stats triggered by RPCs. However, timers cannot
be triggered across threads (RPC thread and main thread in this case).

This fix uses a queued connection to post it to the other queue.
2023-05-26 11:31:52 +05:30
Srivats P
649fa03575 Fix tx ttag pcap filter capture filter syntax
The capture filter was not getting compiled earlier
2023-05-26 11:31:52 +05:30
Srivats P
650c098370 Use TtagTimeInterval to determine ttag markers
This is for interlaved mode; sequential mode was already using it
2023-05-26 11:31:52 +05:30
Srivats P
d375736a39 Don't use udiffTimeStamp() with struct timeval
It will fail to build for non-Linux platforms where TimeStamp is NOT timeval
2023-05-26 11:31:52 +05:30
Srivats P
976fc72de8 Retain seq as param for sendQueueTransmit for now
If and when we remove PacketSequence::ttagL4ChecksumOffset we will take a call
if we should revert back to passing seq->sendQueue instead of seq at that time
2023-05-26 11:31:52 +05:30
Srivats P
4426a51d0f Run stream latency timers only when required
Required => At least one port is tracking stream stats

Also changed some optimization FIXMEs as TODOs
2023-05-26 11:31:52 +05:30
Srivats P
3c6632b6a2 Remove comment about trying read-write lock
The stream timingHash is read by getStreamStats() while it is read/write
for processRecords(), the latter is a more frequent operation so there's
no real benefit of using a read-write lock instead of simple mutex.
2023-05-26 11:31:52 +05:30
Srivats P
d3be505a0c Make app QObject parent of StreamTiming singleton 2023-05-26 11:31:52 +05:30
Srivats P
70f1b6c6e6 Add thread name for PcapRxStats
PcapTxTtagStats thread name has also been shortened since names beyond 16
chars are truncated.
2023-05-26 11:31:52 +05:30
Srivats P
d65fea00d5 Change stream timing GC timer to CLOCK_REALTIME 2023-05-26 11:31:52 +05:30
Srivats P
0afc150264 Don't fix incorrect checksum for Ttag packets
See comments in code
2023-05-26 11:31:52 +05:30
Srivats P
6ba942d00f Remove PcapTxTtagStats::handle_ member
PcaptxTtagStats inherits from PcapSession which already includes a protected
handle_ member.

This removal was likely left off when PcapTxTtagStats started inheriting from
PcapSession.
2023-05-26 11:31:52 +05:30
Srivats P
4ee91c1bc2 Rework sequential mode build for new ttag algo
The previous commit changed the algo to determine which packets were Ttag'd,
but changes were done only for interleaved mode.

This commit adds the changes required for sequential mode.
2023-05-26 11:31:52 +05:30
Srivats P
aebb609e37 Change algo to infer next Ttag pkt (interleaved mode)
The algo works for the following cases of interleaved streams -
 * pktListDuration < ttagTimeInterval
 * pktListDuration > ttagTimeInterval
 * some streams have Ttag, some don't
    - first stream has Ttag
    - first stream does NOT have Ttag
 * no streams have Ttag

Changes for sequential mode are pending
2023-05-26 11:31:52 +05:30
Srivats P
7160f724cb Fix infinite loop in building interleaved streams
Incorrect timestamp comparison was leading to infinite loop
2023-05-26 11:31:52 +05:30
Srivats P
a48a11fe02 Add explicit packet set for interleaved streams
Interleaved mode used an implicitly added packet set in both base and Turbo
code. This has been chaned to use an explicit mode to keep things consistent.

Turbo code still has the implicit packet set related code - that needs to be
removed, once the explicit packet set code is validated and tested.
2023-05-26 11:31:52 +05:30
Srivats P
91a6efdeb7 Use qFrom/ToBigEndian instead of ntohs/htons
For consistency with rest of the code
2023-05-26 11:31:52 +05:30
Srivats P
bfdcee2baa Recompute L4 checksum on-the-fly for TTag packets 2023-05-26 11:31:52 +05:30
Srivats P
c2967b663d Calculate L4 checksum offset for TTag packets 2023-05-26 11:31:52 +05:30
Srivats P
70b5e60440 Rename delay as latency in Protobuf/RPC
The GUI uses the term 'latency', so it's better if the API alsos use the same
term instead of 'delay'
2023-05-26 11:31:52 +05:30