Skip to content

Commit 132ac88

Browse files
authored
Merge pull request #1406 from stevenengler/update-example
Updated example in 'parsing_statistics' doc
2 parents 8e4b858 + fd6125d commit 132ac88

2 files changed

Lines changed: 35 additions & 17 deletions

File tree

docs/parsing_statistics.md

Lines changed: 30 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,26 @@ TGen is capable of modeling generic behaviors with an action-dependency graph in
1212

1313
```yaml
1414
general:
15-
# stop after 1 simulated hour
16-
stop_time: 3600
15+
stop_time: 10 mins
1716

1817
network:
1918
graph:
20-
# use a built-in network graph containing
21-
# a single vertex with a bandwidth of 1 Gbit
22-
type: 1_gbit_switch
19+
# a custom single-node topology
20+
type: gml
21+
inline: |
22+
graph [
23+
node [
24+
id 0
25+
bandwidth_down "140 Mbit"
26+
bandwidth_up "18 Mbit"
27+
]
28+
edge [
29+
source 0
30+
target 0
31+
latency 50
32+
packet_loss 0.01
33+
]
34+
]
2335
2436
hosts:
2537
# a host with the hostname 'server'
@@ -30,7 +42,7 @@ hosts:
3042
start_time: 1
3143
# a host with the hostname 'client'
3244
client:
33-
count: 10
45+
quantity: 10
3446
processes:
3547
- path: ~/.local/bin/tgen
3648
args: ../../../tgen.client.graphml.xml
@@ -133,7 +145,7 @@ $ xzcat results/stats.shadow.json.xz
133145
"1": 0,
134146
"2": 0,
135147
...
136-
"3599": 0
148+
"599": 0
137149
},
138150
"bytes_control_header_retrans": { ... },
139151
"bytes_data_header": { ... },
@@ -153,7 +165,7 @@ $ xzcat results/stats.shadow.json.xz
153165
},
154166
"3": { ... },
155167
...
156-
"3599": { ... }
168+
"599": { ... }
157169
}
158170
}
159171
```
@@ -164,26 +176,28 @@ You can also parse and plot the TGen output using the `tgentools` program from t
164176

165177
### Combining Simulation Data
166178

167-
Consider a set of experiments where we would like to analyze the effect of changing our nodes' traffic queueing disciplines. We run the following 2 experiments:
179+
Consider a set of experiments where we would like to analyze the effect of changing our nodes' socket receive buffer sizes. We run the following 2 experiments:
168180

169181
```bash
170182
# delete any existing simulation data and post-processing
171-
rm -rf shadow.data shadow.log qdisc-fifo.data qdisc-fifo.log qdisc-rr.data qdisc-rr.log
172-
shadow --interface-qdisc fifo --data-directory qdisc-fifo.data shadow.yaml > qdisc-fifo.log
173-
shadow --interface-qdisc roundrobin --data-directory qdisc-rr.data shadow.yaml > qdisc-rr.log
183+
rm -rf shadow.{data,log} 10KiB.{data,results,log} 100KiB.{data,results,log} *.results.pdf
184+
shadow --socket-recv-buffer 10KiB --socket-recv-autotune false \
185+
--data-directory 10KiB.data shadow.yaml > 10KiB.log
186+
shadow --socket-recv-buffer 100KiB --socket-recv-autotune false \
187+
--data-directory 100KiB.data shadow.yaml > 100KiB.log
174188
```
175189

176190
To parse these log files, we use the following scripts:
177191

178192
```bash
179-
src/tools/parse-shadow.py --prefix=qdisc-fifo.results qdisc-fifo.log
180-
src/tools/parse-shadow.py --prefix=qdisc-rr.results qdisc-rr.log
193+
src/tools/parse-shadow.py --prefix=10KiB.results 10KiB.log
194+
src/tools/parse-shadow.py --prefix=100KiB.results 100KiB.log
181195
```
182196

183-
Each of the directories `qdisc-fifo.results/` and `qdisc-rr.results/` now contain data statistics files extracted from the log files. We can now combine and visualize these results with the `plot-shadow.py` script:
197+
Each of the directories `10KiB.results/` and `100KiB.results/` now contain data statistics files extracted from the log files. We can now combine and visualize these results with the `plot-shadow.py` script:
184198

185199
```bash
186-
src/tools/plot-shadow.py --prefix "qdisc" --data qdisc-fifo.results/ "fifo" --data qdisc-rr.results/ "round-robin"
200+
src/tools/plot-shadow.py --prefix "recv-buffer" --data 10KiB.results/ "10 KiB" --data 100KiB.results/ "100 KiB"
187201
```
188202

189203
Open the PDF file that was created to compare results from the experiments.

src/tools/plot-shadow.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1213,7 +1213,11 @@ def get_relay_capacities(shadow_config_path, bwup=False, bwdown=False):
12131213
def movingaverage(interval, window_size):
12141214
if len(interval) > 0:
12151215
window = numpy.ones(int(window_size))/float(window_size)
1216-
return numpy.convolve(interval, window, 'same')
1216+
result = numpy.convolve(interval, window, 'same')
1217+
# hide the boundary effects
1218+
result[:int(window_size/2)] = numpy.nan
1219+
result[-int(window_size/2):] = numpy.nan
1220+
return result
12171221
else:
12181222
return []
12191223

0 commit comments

Comments
 (0)