-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
139 changed files
with
219,696 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
.vscode | ||
._* | ||
*.DS_STORE | ||
*.csv | ||
*.pptx | ||
*.png | ||
*.txt | ||
*.pkl | ||
*.log | ||
*.pyc | ||
*.o | ||
*.code-workspace | ||
*.tar.bz2 | ||
|
||
# ns-3-src | ||
*.orig | ||
*.rej | ||
*.o | ||
*.pyc | ||
*.pyo | ||
*.cwnd | ||
*.dat | ||
*.log | ||
*.mob | ||
*.pcap | ||
*.plt | ||
*.routes | ||
*.tr | ||
[D|U]l[A-Z][a-z]*Stats.txt | ||
|
||
\#*# | ||
~* | ||
|
||
ms_print.* | ||
massif.* | ||
coverity | ||
TAGS | ||
|
||
.lock-waf_*_build | ||
.waf* | ||
|
||
ns-3.34/build/ | ||
|
||
version.cache | ||
|
||
*.pitree-trace |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,52 @@ | ||
# Zhuge | ||
Achieving Consistent Low Latency for Wireless Real-Time Communications with the Shortest Control Loop (SIGCOMM 2022) | ||
|
||
Codes are expected to release in October 2022. Stay tuned!!! | ||
Sorry for the late release of the codes. | ||
This repo contains considerable amount of the codes from [Hairpin](https://github.com/hkust-spark/hairpin), and some later bug fixes are only put into effect in the other Hairpin project. | ||
We apologize for the inconvenience that brings to you. | ||
|
||
## How to understand the codes | ||
|
||
The main function of the codes is in the `ns-3.34/scratch/fec-emulate.cc`, and the main module for Zhuge is in `ns-3.34/src/zhuge/`. | ||
One important thing about this code is that we provide a ns-3 simulator for real-time communications! | ||
The simulator is in the `ns-3.34/src/bitrate-ctrl`, which can provide an end-to-end simulation for low-latency video streaming. | ||
We used this simulator in this Zhuge project and also the Hairpin project mentioned above. | ||
We're currently trying to separate the simulator itself from the contributions of others, but that is expected to take some time. | ||
|
||
## Install dependency | ||
``` | ||
sudo apt install build-essential libboost-all-dev | ||
wget https://www.nsnam.org/releases/ns-allinone-3.34.tar.bz2 | ||
tar xjf ns-allinone-3.34.tar.bz2 | ||
mv ns-allinone-3.34/ns-3.34 . | ||
mv ns-3.34-diff/* ns-3.34/ | ||
patch -s -p0 < ./ns-diff.patch | ||
``` | ||
|
||
## Configure before building! | ||
For ns-3.33 and below, to use c++14 and above features, should configure like this: (More information: C++ standard configuration in build system (#352) · Issues · nsnam / ns-3-dev · GitLab) | ||
|
||
``` | ||
cd ns-3.34/ | ||
LDFLAGS="-lboost_filesystem -lboost_system" ./waf configure --cxx-standard=-std=c++17 | ||
``` | ||
|
||
## Figure 4 | ||
This branch contains the codes to reproduce the motivating results in Figure 4. | ||
- Step 1: Generate the configuration file for Figure 4: `zsh generate_conf_fig4.sh`. | ||
- Step 2: Run the codes with given configurations: | ||
`python run_ns3.py --conf motiv-static.conf`. The results will appear in `static-exp/results/` | ||
- Step 3: Process results to stats: | ||
``` | ||
cd static-exp/results | ||
ls | xargs -i awk -f ../../../../../output-stat.awk {} {} > ../motivation-results-summary.log | ||
awk -f ../../../../../summary-stat.awk ../motivation-results-summary.log > ../motivation-results-plot.log | ||
``` | ||
|
||
|
||
## Figure 14 / 15 | ||
- Step 3: Process results to stats: | ||
``` | ||
cd static-exp/ | ||
zsh summarize.sh | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# frame delay | ||
/send frame/ { | ||
snd[$5] = $10 | ||
} | ||
|
||
/decode: frame/ { | ||
rcv[$3] = $5 | ||
} | ||
|
||
/discard frame/ { | ||
rcv[$3] = $5 | ||
} | ||
|
||
END { | ||
for (var in rcv) { | ||
print var, rcv[var] - snd[var] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/decode: frame/ { | ||
if (!mints) { | ||
mints = int($5/1000) | ||
} | ||
count[int($5/1000)] += 1 | ||
maxts = int($5/1000) | ||
} | ||
|
||
END { | ||
for (ts = mints + 1; ts <= maxts - 1; ts++) { | ||
if (ts in count) { | ||
print (count[ts]) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
import numpy as np | ||
from math import log2 | ||
import os | ||
import argparse | ||
|
||
|
||
maxDiff = 512 | ||
maxExp = 9 | ||
|
||
|
||
def processEst (fname): | ||
estDelay = {} | ||
with open (fname, 'r') as f: | ||
lastEstId = 0 | ||
for line in f.readlines (): | ||
line = line.split () | ||
estId = int (line[1]) | ||
if (estId < lastEstId - 32768): | ||
break | ||
if int (line[0]) >= 27 and int (line[0]) <= 30: | ||
# The estimation has minor bugs that will concentrate on 27-30 | ||
# We do not have time to debug it, just ignore here. | ||
continue | ||
estDelay[estId] = int (line[0]) | ||
lastEstId = estId | ||
return estDelay | ||
|
||
|
||
def processReal (fname, estDelay): | ||
diff = np.zeros (maxDiff + 1, dtype=int) | ||
mapRes = np.zeros ((maxExp + 1, maxExp + 1), dtype=int) | ||
with open (fname, 'r') as f: | ||
lastRealId = 0 | ||
for line in f.readlines (): | ||
line = line.split () | ||
realId = int (line[1]) | ||
realDelay = int (line[2]) | ||
if (realId < lastRealId): | ||
break | ||
if (realId not in estDelay.keys ()): | ||
continue | ||
diff[min (abs (max (1, estDelay[realId]) - max (1, realDelay)), maxDiff)] += 1 | ||
mapX = min (int (log2 (max (1, realDelay))), maxExp) | ||
mapY = min (int (log2 (max (1, estDelay[realId]))), maxExp) | ||
mapRes[mapX, mapY] += 1 | ||
lastRealId = realId | ||
return diff, mapRes | ||
|
||
|
||
if __name__ == "__main__": | ||
parser = argparse.ArgumentParser () | ||
parser.add_argument ('--tracePrefix') | ||
parser.add_argument ('--traceClass') | ||
args = parser.parse_args () | ||
|
||
totalDiff = np.zeros (maxDiff + 1, dtype=int) | ||
totalMapRes = np.zeros ((maxExp + 1, maxExp + 1), dtype=float) | ||
for trace in os.listdir (args.tracePrefix): | ||
if not os.path.isdir (os.path.join (args.tracePrefix, trace)): | ||
continue | ||
if args.traceClass not in trace: | ||
continue | ||
print (trace) | ||
if not os.path.exists (os.path.join (args.tracePrefix, trace, "real.tr")): | ||
os.system ("cd " + os.path.join (args.tracePrefix, trace) + | ||
" && awk -f ../../../../pcap2delay.awk pcap.tr > real.tr") | ||
if not os.path.exists (os.path.join (args.tracePrefix, trace, "est.tr")): | ||
os.system ("cd " + os.path.join (args.tracePrefix, trace) + | ||
" && awk -f ../../../../output2delay.awk output.log > est.tr") | ||
estDelay = processEst (os.path.join (args.tracePrefix, trace, "est.tr")) | ||
diff, mapRes = processReal (os.path.join (args.tracePrefix, trace, "real.tr"), estDelay) | ||
totalDiff += diff | ||
totalMapRes += mapRes | ||
|
||
np.savetxt (os.path.join (args.tracePrefix, args.traceClass + "-totalDiff.log"), | ||
(np.cumsum (totalDiff) / np.sum (totalDiff)).T, fmt="%.4f") | ||
for y in range (totalMapRes.shape[1]): | ||
totalMapRes[:, y] = totalMapRes[:, y] / np.sum (totalMapRes[:, y]) | ||
np.savetxt (os.path.join (args.tracePrefix, args.traceClass + "-totalMapRes.log"), totalMapRes, fmt="%.4f") |
Oops, something went wrong.