projects
/
utp-swift.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
history
|
raw
|
HEAD
add parse scripts
[utp-swift.git]
/
parse
/
parse_udp_in
1
#!/bin/bash
2
3
awk '
4
BEGIN {
5
count = 0
6
init = 1
7
printf "pkts\tbytes\n"
8
}
9
10
/^Chain udp_in/ {
11
count = 0
12
init = 0
13
}
14
15
{
16
count++
17
18
pkts = $1 + 0
19
bytes = $2 + 0
20
21
if (index($1, "K"))
22
pkts = pkts * 1024
23
else
24
if (index($1, "M"))
25
pkts = pkts * 1024 * 1024;
26
else
27
if (index($1, "G"))
28
pkts = pkts * 1024 * 1024 * 1204
29
30
if (index($2, "K"))
31
bytes = bytes * 1024
32
else
33
if (index($2, "M"))
34
bytes = bytes * 1024 * 1024;
35
else
36
if (index($2, "G"))
37
bytes = bytes * 1024 * 1024 * 1204
38
39
if (count == 3 && !init)
40
printf "%s\t%s\n", pkts, bytes
41
}
42
'