Commit Graph

1096 Commits

Author SHA1 Message Date
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
Srivats P
5540253e61 Fix StreamTiming TxRxKey
makeKey was incorrect by mistake
2023-05-26 11:31:52 +05:30
Srivats P
8ecbe78ddd GUI changes to display avg latency
At this time we only show per-guid latency aggregated across all ports
2023-05-26 11:31:52 +05:30
Srivats P
3e3b5144aa Process pending before fetching streamTiming delay 2023-05-26 11:31:52 +05:30
Srivats P
596df69519 Fix MacOS build break by removing unused member
PcapTxTtagStats::lastPcapStats_ was unused because debugStats() was moved to
PcapSession, but removing this member var was left out
2023-05-26 11:31:52 +05:30
Srivats P
680f6eb89f Fix streamTiming garbage collection infinite loop 2023-05-26 11:31:52 +05:30
Srivats P
1b18149aaa Delete PcapTxTtagSession::debugStats
debugStats() was moved to base class PcapSession earlier, but removing it
from here was missed out
2023-05-26 11:31:52 +05:30
Srivats P
bf749847e0 Rename PcapRxStats::id_ as PcapRxStats::portId_
Better code clarity
2023-05-26 11:31:52 +05:30
Srivats P
ab713ce043 Integrate StreamTiming with the code
Bugs found during integration were fixed and minor code improvements were made
such as using consts, const params, renaming members etc.
2023-05-26 11:31:52 +05:30
Srivats P
fc2d8408fa Change StreamTiming::timing_ from QList to QHash
Using QList meant we need to know the port count in the constructor - which is
difficult to know because StreamTiming is designed as a singleton
2023-05-26 11:31:52 +05:30
Srivats P
39c8d6f5f3 Add initial cut of StreamTiming class
This singleton class will keep track of Ttag timing across all ports and GUIDs.

A bunch of FIXMEs/TODOs are pending for this class implementation; also this
class has not been hooked up to the rest of the code yet.
2023-05-26 11:31:52 +05:30
Srivats P
219ad576ad Fix another MacOS build break
Break was due to following warnings (being promoted to errors) -
 * id_ private member was unused
 * tv_usec is int on MacOS (but long on Linux)
2023-05-26 11:31:52 +05:30
Srivats P
3060701386 Move debugStats() from PcapRx to base PcapSession
With this change, other classes that use PcapSession as base can also
use debugStats(), if required
2023-05-26 11:31:52 +05:30
Srivats P
47325c38b0 Ignore failures when stopping stream stats tracking
Stop everything irrespective of any failures
2023-05-26 11:31:52 +05:30
Srivats P
21ce331c43 Create a Tx Ttag tracker thread
For now we are just debug printing timestamp with T-TagId and GUID. We
need to store this tuple and compare when we Rx the same - this will be
in a upcoming commit.
2023-05-26 11:31:52 +05:30
Srivats P
fd2fae711b Fix MacOS build break
For some reason udiffTimeStamp is not defined for MacOS. To be investigated
later.
2023-05-26 11:31:52 +05:30
Srivats P
2d998b3708 Add an incrementing tag id to T-Tag packets 2023-05-26 11:31:52 +05:30
Srivats P
f65aed7bb0 Add infra to update L4 checksum for T-Tag packets
Pending
 * Calculate L4 checksum offset instead of hardcoded value
 * Recalculate packet L4 checksum instead of using 0 value
2023-05-26 11:31:52 +05:30
Srivats P
fdf8c77350 Change T-Tag on the fly 2023-05-26 11:31:52 +05:30
Srivats P
429eff123d Don't create implicit packet sets for Tx
As part of Turbo changes, we made changes to create explicit packet
sets, but for the base code we continued creating implicit packet
sets for some cases. With this change we don't create any implicit
packet set.

This change needs to be tested thoroughly for multiple cases.
2023-05-26 11:31:52 +05:30
Srivats P
3c98900092 Reduce vertical whitespace in sendQueueTransmit() 2023-05-26 11:31:52 +05:30
Srivats P
159cd7c0da Add T-Tag placeholder in sign protocol 2023-05-26 11:31:52 +05:30
Srivats P
46b148b62b Reformat TxThread/run {} to use less vertical space 2023-05-26 11:31:52 +05:30
Srivats P
f29d31d38a Update comments about implict packetset 2023-05-26 11:31:52 +05:30
Srivats P
1056b8d170 Fix werror warning about 0 being signed by default 2023-05-26 11:31:52 +05:30
Srivats P
4a4de23d8a Replace Donate button with Github Sponsors button 2023-05-09 18:27:15 +05:30
Srivats P
425e4ef261 Rename port stats names to begin with send/receive
This will hopefully make it quicker and easier for the user to find
the stats item of interest.
2023-03-04 15:31:24 +05:30
Srivats P
d950432bc9 Move port stats hidden rows to the end
This avoids having to recalculate row indices
2023-03-04 10:49:35 +05:30
Srivats P
9849973562 Visually group related port stats
A horizontal line is drawn between groups
2023-03-04 09:57:56 +05:30
Srivats P
4f6749f16d Set alternate colors for port stats row headers
All 'sent' rows including the row header have the alt color, and
the 'recv' rows including the row header has the base color. This
change should make it easier to quickly distinguish sent/recv rows
2023-03-03 17:37:43 +05:30
Srivats P
8dbd01622c Make sent/recv order consistent for port stats
Also remove sent/recv byte rates as we have bit rates and that
should be sufficient
2023-03-03 14:14:08 +05:30
Srivats P
2f3add63d8 ostinato -[hv] should output to stdout 2023-02-24 15:15:59 +05:30
Srivats P
7b7ede351b Fix build break with stream stats fix
The fix was validated with Windows, but not on Linux. This commit fixes
the build break for non-windows platforms.
2023-02-09 15:06:34 +05:30
Srivats P
c70811eaa4 Fix spurious stream stats drops
The problem happens for bidirectional flows. The sequence of events is
as follows when you start Tx on Ports p1, p2 with the current code -

1. Clear stream stats on p1
2. Start tx on p1
3. Clear stream stats on p2
4. Start tx on p2

By the time #3 is executed, it may have already rx packets from p1 which
are being incorrectly cleared, this will cause these number of packets
to show up as dropped instead - incorrectly.

The fix is to change the order like this -

1. Clear stream stats on p1
2. Clear stream stats on p2
3. Start tx on p1
4. Start tx on p2

Unidirectional flows will not see this problem - as long as startTx is
done only on the Tx port and not the Rx port.

This bug is a regression caused due to the code changes introduced for the
stream stats rates feature implemented in 1.2.0
2023-02-08 16:34:03 +05:30
Srivats P
e2369c02bc Fix value for str/bytes field when save as Python
Protobuf string type should be treated as a Python unicode string usable
in both Python 2.x and Python 3.x. Since we are now using unicode strings,
force encoding as utf-8.

Protobuf bytes type should be treated as a Python byte string. Use hex
values in byte literal even for printable characters, for a better UX.

escapeString() is no longer being used, but has been retained in the
code.
2022-12-28 19:30:50 +05:30
Srivats P
c07d9e8691 Fix drone crash at startup on Linux
The crash happens if there is a default route without a gateway in
the main routing table
2022-12-23 13:14:19 +05:30