Skip to content

Commit 458ed3c

Browse files
committed
changed bandwidth unit from bits to bytes, added documentation of the fields -- continuation of issue EricssonResearch#117
1 parent 32ccf98 commit 458ed3c

28 files changed

+9038
-9026
lines changed

Format.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,9 @@ The other fields depend on the type of an event and connection. These fields can
5151
* The field "Value" specifies the value of the spin bit.
5252
* The field "Transition" specifies the spin bit transition, which is either "0-1" or "1-0".
5353
* The field "Who" specifies from which direction did the information come from, "initiator" or "responder".
54-
* The field "Packets" specifies the number of packets (both directions) that have been seen on this connection.
55-
* The field "Bytes" specifies the number of packets (both directions) that have been seen on this connection.
54+
* The fields "Packets1" and "Packets2" specify the number of packets (in initiator and responder direction) that have been seen on this connection.
55+
* The fields "Bytes1" and "Bytes2" specify the number of packets (in initiator and responder direction) that have been seen on this connection.
56+
* The field "Bandwidth1" and "Bandwidth2" specify the bandwidth of a connection (in initiator and responder direction) as calculated periodically for each second. The number represents number of bytes per second.
5657
* The fields "Ect0", "ect1" and "ce" specify ECN event counters for ECN(0), ECN(1), and CE events.
5758

5859
## Binary format

News.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Spindump News
22

3+
## Bandwidth measurements (May 2019)
4+
5+
Spindump can now report bandwidth data (bytes/sec) for connections and aggregated connections. The bandwith data is visible in the textual and JSON output, not currently on screen (due to lack of screen real estate).
6+
37
## Spaces not tabs (April 2019)
48

59
Spindump code now uses spaces, not tabs for indents. Please configure your editor appropriately! For instance, on emacs I added the following line to my .emacs file:

src/spindump_event_parser_json.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -502,9 +502,9 @@ spindump_event_parser_json_print(const struct spindump_event* event,
502502
if (event->bandwidthFromSide1 > 0 ||
503503
event->bandwidthFromSide2 > 0) {
504504
addtobuffer2(", \"Bandwidth1\": %u",
505-
event->bandwidthFromSide1 * 8);
505+
event->bandwidthFromSide1);
506506
addtobuffer2(", \"Bandwidth2\": %u",
507-
event->bandwidthFromSide2 * 8);
507+
event->bandwidthFromSide2);
508508
}
509509

510510
//

src/spindump_event_parser_text.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -171,8 +171,8 @@ spindump_event_parser_text_print(const struct spindump_event* event,
171171
if (event->bandwidthFromSide1 > 0 ||
172172
event->bandwidthFromSide2 > 0) {
173173
addtobuffer3(" bandwidth %u %u",
174-
event->bandwidthFromSide1 * 8,
175-
event->bandwidthFromSide2 * 8);
174+
event->bandwidthFromSide1,
175+
event->bandwidthFromSide2);
176176
}
177177

178178
//

src/spindump_test.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,7 @@ unittests_eventtextparser(void) {
451451
ret = spindump_event_parser_text_print(&event,buf,sizeof(buf),&consumed);
452452
spindump_assert(ret == 1);
453453
spindump_deepdebugf("event text = %s (consumed %u bytes)", buf, consumed);
454-
const char* expected = "TCP 1.2.3.4 <-> 5.6.7.8 123:456 at 1892188800001234 new up packets 1 0 bytes 2 3 bandwidth 8000 8000\n";
454+
const char* expected = "TCP 1.2.3.4 <-> 5.6.7.8 123:456 at 1892188800001234 new up packets 1 0 bytes 2 3 bandwidth 1000 1000\n";
455455
spindump_assert(strcmp(buf,expected) == 0);
456456
}
457457

@@ -518,7 +518,7 @@ unittests_eventjsonparser(void) {
518518
const char* expected =
519519
"{ \"Event\": \"new\", \"Type\": \"TCP\", \"Addrs\": [\"1.2.3.4\",\"5.6.7.8\"], "
520520
"\"Session\": \"123:456\", \"Ts\": 1892188800001234, \"State\": \"Starting\", "
521-
"\"Packets1\": 1, \"Packets2\": 0, \"Bytes1\": 2, \"Bytes2\": 3, \"Bandwidth1\": 8000, \"Bandwidth2\": 8000 }";
521+
"\"Packets1\": 1, \"Packets2\": 0, \"Bytes1\": 2, \"Bytes2\": 3, \"Bandwidth1\": 1000, \"Bandwidth2\": 1000 }";
522522
spindump_assert(strcmp(buf,expected) == 0);
523523

524524
//

src/spindump_testtraces.sh

+17-10
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ traces="trace_icmpv4_short
5555
# Loop through test cases
5656
#
5757

58+
RESULT=0
5859
unset CPUPROFILE
5960

6061
for trace in $traces
@@ -88,8 +89,8 @@ do
8889
then
8990
echo " run ok..."
9091
else
91-
echo "**run failed -- exit"
92-
exit 1
92+
echo "**run failed"
93+
RESULT=1
9394
fi
9495

9596
#
@@ -110,24 +111,24 @@ do
110111
then
111112
nop=nop
112113
else
113-
echo "**expected results file $corr does not exist -- exit"
114-
exit 1
114+
echo "**expected results file $corr does not exist"
115+
RESULT=1
115116
fi
116117

117118
if diff $out $corr > /dev/null
118119
then
119120
echo " results correct"
120121
else
121-
echo "**results incorrect -- exit"
122-
exit 1
122+
echo "**results incorrect"
123+
RESULT=1
123124
fi
124125

125126
if [ -f $descr ]
126127
then
127128
nop=nop
128129
else
129-
echo "**test description file $descr does not exist -- exit"
130-
exit 1
130+
echo "**test description file $descr does not exist"
131+
RESULT=1
131132
fi
132133

133134
#
@@ -143,9 +144,15 @@ do
143144
then
144145
echo " run ok..."
145146
else
146-
echo "**run failed -- exit"
147-
exit 1
147+
echo "**run failed"
148+
RESULT=1
148149
fi
149150
unset CPUPROFILE
150151
fi
151152
done
153+
154+
#
155+
# Done. Exit with 1 if there was an error
156+
#
157+
158+
exit $RESULT

test/trace_dns.expected

+13-13
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
11
DNS 2001:67c:1232:144:9498:6df6:f450:110b <-> 2001:67c:370:229::7 54423:53 at 1553422217239860 new starting packets 0 0 bytes 0 0
22
DNS 2001:67c:1232:144:9498:6df6:f450:110b <-> 2001:67c:370:229::7 61426:53 at 1553422217239918 new starting packets 0 0 bytes 0 0
3-
DNS 2001:67c:1232:144:9498:6df6:f450:110b <-> 2001:67c:370:229::7 54423:53 at 1553422217281911 measurement starting right 42051 packets 1 0 bytes 121 0 bandwidth 968 0
4-
DNS 2001:67c:1232:144:9498:6df6:f450:110b <-> 2001:67c:370:229::7 61426:53 at 1553422217281913 measurement starting right 41995 packets 1 0 bytes 121 0 bandwidth 968 0
3+
DNS 2001:67c:1232:144:9498:6df6:f450:110b <-> 2001:67c:370:229::7 54423:53 at 1553422217281911 measurement starting right 42051 packets 1 0 bytes 121 0 bandwidth 121 0
4+
DNS 2001:67c:1232:144:9498:6df6:f450:110b <-> 2001:67c:370:229::7 61426:53 at 1553422217281913 measurement starting right 41995 packets 1 0 bytes 121 0 bandwidth 121 0
55
DNS 2001:67c:1232:144:9498:6df6:f450:110b <-> 2001:67c:370:229::7 51287:53 at 1553422217284471 new starting packets 0 0 bytes 0 0
66
DNS 2001:67c:1232:144:9498:6df6:f450:110b <-> 2001:67c:370:229::7 63443:53 at 1553422217284579 new starting packets 0 0 bytes 0 0
77
DNS 2001:67c:1232:144:9498:6df6:f450:110b <-> 2001:67c:370:229::7 58598:53 at 1553422217505499 new starting packets 0 0 bytes 0 0
88
DNS 2001:67c:1232:144:9498:6df6:f450:110b <-> 2001:67c:370:229::7 50480:53 at 1553422217506105 new starting packets 0 0 bytes 0 0
9-
DNS 2001:67c:1232:144:9498:6df6:f450:110b <-> 2001:67c:370:229::7 51287:53 at 1553422217519037 measurement starting right 234566 packets 1 0 bytes 97 0 bandwidth 776 0
10-
DNS 2001:67c:1232:144:9498:6df6:f450:110b <-> 2001:67c:370:229::7 63443:53 at 1553422217519040 measurement starting right 234461 packets 1 0 bytes 97 0 bandwidth 776 0
9+
DNS 2001:67c:1232:144:9498:6df6:f450:110b <-> 2001:67c:370:229::7 51287:53 at 1553422217519037 measurement starting right 234566 packets 1 0 bytes 97 0 bandwidth 97 0
10+
DNS 2001:67c:1232:144:9498:6df6:f450:110b <-> 2001:67c:370:229::7 63443:53 at 1553422217519040 measurement starting right 234461 packets 1 0 bytes 97 0 bandwidth 97 0
1111
DNS 2001:67c:1232:144:9498:6df6:f450:110b <-> 2001:67c:370:229::7 49875:53 at 1553422217520323 new starting packets 0 0 bytes 0 0
12-
DNS 2001:67c:1232:144:9498:6df6:f450:110b <-> 2001:67c:370:229::7 49875:53 at 1553422217557933 measurement starting right 37610 packets 1 0 bytes 91 0 bandwidth 728 0
13-
DNS 2001:67c:1232:144:9498:6df6:f450:110b <-> 2001:67c:370:229::7 50480:53 at 1553422217660062 measurement starting right 153957 packets 1 0 bytes 76 0 bandwidth 608 0
14-
DNS 2001:67c:1232:144:9498:6df6:f450:110b <-> 2001:67c:370:229::7 58598:53 at 1553422217660499 measurement starting right 155000 packets 1 0 bytes 76 0 bandwidth 608 0
12+
DNS 2001:67c:1232:144:9498:6df6:f450:110b <-> 2001:67c:370:229::7 49875:53 at 1553422217557933 measurement starting right 37610 packets 1 0 bytes 91 0 bandwidth 91 0
13+
DNS 2001:67c:1232:144:9498:6df6:f450:110b <-> 2001:67c:370:229::7 50480:53 at 1553422217660062 measurement starting right 153957 packets 1 0 bytes 76 0 bandwidth 76 0
14+
DNS 2001:67c:1232:144:9498:6df6:f450:110b <-> 2001:67c:370:229::7 58598:53 at 1553422217660499 measurement starting right 155000 packets 1 0 bytes 76 0 bandwidth 76 0
1515
DNS 2001:67c:1232:144:9498:6df6:f450:110b <-> 2001:67c:370:229::7 61906:53 at 1553422221634920 new starting packets 0 0 bytes 0 0
16-
DNS 2001:67c:1232:144:9498:6df6:f450:110b <-> 2001:67c:370:229::7 61906:53 at 1553422222213709 measurement starting right 578789 packets 1 0 bytes 74 0 bandwidth 592 0
16+
DNS 2001:67c:1232:144:9498:6df6:f450:110b <-> 2001:67c:370:229::7 61906:53 at 1553422222213709 measurement starting right 578789 packets 1 0 bytes 74 0 bandwidth 74 0
1717
DNS 2001:67c:1232:144:9498:6df6:f450:110b <-> 2001:67c:370:229::7 49638:53 at 1553422228700147 new starting packets 0 0 bytes 0 0
18-
DNS 2001:67c:1232:144:9498:6df6:f450:110b <-> 2001:67c:370:229::7 49638:53 at 1553422228784732 measurement starting right 84585 packets 1 0 bytes 85 0 bandwidth 680 0
18+
DNS 2001:67c:1232:144:9498:6df6:f450:110b <-> 2001:67c:370:229::7 49638:53 at 1553422228784732 measurement starting right 84585 packets 1 0 bytes 85 0 bandwidth 85 0
1919
DNS 2001:67c:1232:144:9498:6df6:f450:110b <-> 2001:67c:370:229::7 55623:53 at 1553422235977925 new starting packets 0 0 bytes 0 0
20-
DNS 2001:67c:1232:144:9498:6df6:f450:110b <-> 2001:67c:370:229::7 55623:53 at 1553422236002004 measurement starting right 24079 packets 1 0 bytes 76 0 bandwidth 608 0
20+
DNS 2001:67c:1232:144:9498:6df6:f450:110b <-> 2001:67c:370:229::7 55623:53 at 1553422236002004 measurement starting right 24079 packets 1 0 bytes 76 0 bandwidth 76 0
2121
DNS 2001:67c:1232:144:9498:6df6:f450:110b <-> 2001:67c:370:229::7 63318:53 at 1553422236539115 new starting packets 0 0 bytes 0 0
22-
DNS 2001:67c:1232:144:9498:6df6:f450:110b <-> 2001:67c:370:229::7 63318:53 at 1553422236541953 measurement starting right 2838 packets 1 0 bytes 88 0 bandwidth 704 0
22+
DNS 2001:67c:1232:144:9498:6df6:f450:110b <-> 2001:67c:370:229::7 63318:53 at 1553422236541953 measurement starting right 2838 packets 1 0 bytes 88 0 bandwidth 88 0
2323
DNS 2001:67c:1232:144:9498:6df6:f450:110b <-> 2001:67c:370:229::7 52131:53 at 1553422242569000 new starting packets 0 0 bytes 0 0
24-
DNS 2001:67c:1232:144:9498:6df6:f450:110b <-> 2001:67c:370:229::7 52131:53 at 1553422242575988 measurement starting right 6988 packets 1 0 bytes 73 0 bandwidth 584 0
24+
DNS 2001:67c:1232:144:9498:6df6:f450:110b <-> 2001:67c:370:229::7 52131:53 at 1553422242575988 measurement starting right 6988 packets 1 0 bytes 73 0 bandwidth 73 0
2525
DNS 2001:67c:1232:144:9498:6df6:f450:110b <-> 2001:67c:370:229::7 60967:53 at 1553422249154129 new starting packets 0 0 bytes 0 0
26-
DNS 2001:67c:1232:144:9498:6df6:f450:110b <-> 2001:67c:370:229::7 60967:53 at 1553422249605960 measurement starting right 451831 packets 1 0 bytes 75 0 bandwidth 600 0
26+
DNS 2001:67c:1232:144:9498:6df6:f450:110b <-> 2001:67c:370:229::7 60967:53 at 1553422249605960 measurement starting right 451831 packets 1 0 bytes 75 0 bandwidth 75 0

test/trace_icmpv4_short.expected

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
ICMP 31.133.149.35 <-> 212.16.98.51 48895 at 1553417873690045 new starting packets 0 0 bytes 0 0
2-
ICMP 31.133.149.35 <-> 212.16.98.51 48895 at 1553417873728020 measurement up right 37975 packets 1 0 bytes 84 0 bandwidth 672 0
3-
ICMP 31.133.149.35 <-> 212.16.98.51 48895 at 1553417874732523 measurement up right 37859 packets 2 1 bytes 168 84 bandwidth 672 672
2+
ICMP 31.133.149.35 <-> 212.16.98.51 48895 at 1553417873728020 measurement up right 37975 packets 1 0 bytes 84 0 bandwidth 84 0
3+
ICMP 31.133.149.35 <-> 212.16.98.51 48895 at 1553417874732523 measurement up right 37859 packets 2 1 bytes 168 84 bandwidth 84 84

test/trace_icmpv6_short.expected

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
ICMP 2001:67c:1232:144:9498:6df6:f450:110b <-> 2001:67c:2b0:1c1::198 959 at 1553417897245943 new starting packets 0 0 bytes 0 0
2-
ICMP 2001:67c:1232:144:9498:6df6:f450:110b <-> 2001:67c:2b0:1c1::198 959 at 1553417897279742 measurement up right 33799 packets 1 0 bytes 56 0 bandwidth 448 0
3-
ICMP 2001:67c:1232:144:9498:6df6:f450:110b <-> 2001:67c:2b0:1c1::198 959 at 1553417898282108 measurement up right 35588 packets 2 1 bytes 112 56 bandwidth 448 448
2+
ICMP 2001:67c:1232:144:9498:6df6:f450:110b <-> 2001:67c:2b0:1c1::198 959 at 1553417897279742 measurement up right 33799 packets 1 0 bytes 56 0 bandwidth 56 0
3+
ICMP 2001:67c:1232:144:9498:6df6:f450:110b <-> 2001:67c:2b0:1c1::198 959 at 1553417898282108 measurement up right 35588 packets 2 1 bytes 112 56 bandwidth 56 56

0 commit comments

Comments
 (0)