Record measured bandwidth during simulation
Plot the bandwidth measured by the HLS plugin during the simulation run. Assuming the math to calculate it is working correctly, this line helps make clear the difference between the maximum throughput of the link and the percieved throughput. Becuase we're not pipelining segment requests, this difference can be quite substantial. Remove the buffered line because it was distracting.
Showing
2 changed files
with
20 additions
and
18 deletions
... | @@ -423,9 +423,8 @@ form label { | ... | @@ -423,9 +423,8 @@ form label { |
423 | .line.bandwidth { | 423 | .line.bandwidth { |
424 | stroke: steelblue; | 424 | stroke: steelblue; |
425 | } | 425 | } |
426 | .line.buffered { | 426 | .line.effective-bandwidth { |
427 | stroke: #2ca02c; | 427 | stroke: #FF7F0E; |
428 | opacity: 0.25; | ||
429 | } | 428 | } |
430 | .line.bitrate { | 429 | .line.bitrate { |
431 | stroke: #999; | 430 | stroke: #999; | ... | ... |
... | @@ -3,7 +3,7 @@ | ... | @@ -3,7 +3,7 @@ |
3 | var segmentDuration = 9, // seconds | 3 | var segmentDuration = 9, // seconds |
4 | segmentCount = 100, | 4 | segmentCount = 100, |
5 | duration = segmentDuration * segmentCount, | 5 | duration = segmentDuration * segmentCount, |
6 | propagationDelay = 1, | 6 | propagationDelay = 0.5, |
7 | 7 | ||
8 | runSimulation, | 8 | runSimulation, |
9 | playlistResponse, | 9 | playlistResponse, |
... | @@ -86,6 +86,7 @@ | ... | @@ -86,6 +86,7 @@ |
86 | runSimulation = function(options, done) { | 86 | runSimulation = function(options, done) { |
87 | var results = { | 87 | var results = { |
88 | bandwidth: [], | 88 | bandwidth: [], |
89 | effectiveBandwidth: [], | ||
89 | playlists: [], | 90 | playlists: [], |
90 | buffered: [], | 91 | buffered: [], |
91 | options: options | 92 | options: options |
... | @@ -207,6 +208,10 @@ | ... | @@ -207,6 +208,10 @@ |
207 | request.status = 200; | 208 | request.status = 200; |
208 | request.response = new Uint8Array(segmentSize * 0.125); | 209 | request.response = new Uint8Array(segmentSize * 0.125); |
209 | request.setResponseBody(''); | 210 | request.setResponseBody(''); |
211 | results.effectiveBandwidth.push({ | ||
212 | time: Math.ceil(+new Date() * 0.001), | ||
213 | bandwidth: player.hls.bandwidth | ||
214 | }); | ||
210 | }, ((remaining / value.bandwidth) + i) * 1000); | 215 | }, ((remaining / value.bandwidth) + i) * 1000); |
211 | return false; | 216 | return false; |
212 | } | 217 | } |
... | @@ -266,7 +271,6 @@ | ... | @@ -266,7 +271,6 @@ |
266 | displayTimeline = function(error, data) { | 271 | displayTimeline = function(error, data) { |
267 | var x = d3.scale.linear().range([0, width]), | 272 | var x = d3.scale.linear().range([0, width]), |
268 | y = d3.scale.linear().range([height, 0]), | 273 | y = d3.scale.linear().range([height, 0]), |
269 | y0 = d3.scale.linear().range([height, 0]), | ||
270 | 274 | ||
271 | timeAxis = d3.svg.axis().scale(x).orient('bottom'), | 275 | timeAxis = d3.svg.axis().scale(x).orient('bottom'), |
272 | tickFormatter = d3.format(',.0f'), | 276 | tickFormatter = d3.format(',.0f'), |
... | @@ -285,13 +289,13 @@ | ... | @@ -285,13 +289,13 @@ |
285 | .y(function(data) { | 289 | .y(function(data) { |
286 | return y(data.bandwidth); | 290 | return y(data.bandwidth); |
287 | }), | 291 | }), |
288 | bufferedLine = d3.svg.line() | 292 | effectiveBandwidthLine = d3.svg.line() |
289 | .interpolate('basis') | 293 | .interpolate('basis') |
290 | .x(function(data) { | 294 | .x(function(data) { |
291 | return x(data.time); | 295 | return x(data.time); |
292 | }) | 296 | }) |
293 | .y(function(data) { | 297 | .y(function(data) { |
294 | return y0(data.buffered); | 298 | return y(data.bandwidth); |
295 | }); | 299 | }); |
296 | 300 | ||
297 | x.domain(d3.extent(data.bandwidth, function(data) { | 301 | x.domain(d3.extent(data.bandwidth, function(data) { |
... | @@ -300,9 +304,6 @@ | ... | @@ -300,9 +304,6 @@ |
300 | y.domain([0, Math.max(d3.max(data.bandwidth, function(data) { | 304 | y.domain([0, Math.max(d3.max(data.bandwidth, function(data) { |
301 | return data.bandwidth; | 305 | return data.bandwidth; |
302 | }), d3.max(data.options.playlists))]); | 306 | }), d3.max(data.options.playlists))]); |
303 | y0.domain([0, d3.max(data.buffered, function(data) { | ||
304 | return data.buffered; | ||
305 | })]); | ||
306 | 307 | ||
307 | // time axis | 308 | // time axis |
308 | svg.selectAll('.axis').remove(); | 309 | svg.selectAll('.axis').remove(); |
... | @@ -337,20 +338,22 @@ | ... | @@ -337,20 +338,22 @@ |
337 | .datum(data.bandwidth) | 338 | .datum(data.bandwidth) |
338 | .attr('class', 'line bandwidth') | 339 | .attr('class', 'line bandwidth') |
339 | .attr('d', bandwidthLine); | 340 | .attr('d', bandwidthLine); |
341 | svg.selectAll('.effective-bandwidth').remove(); | ||
342 | svg.append('path') | ||
343 | .datum(data.effectiveBandwidth) | ||
344 | .attr('class', 'line effective-bandwidth') | ||
345 | .attr('d', effectiveBandwidthLine); | ||
340 | 346 | ||
341 | svg.append('text') | 347 | svg.append('text') |
342 | .attr('class', 'bandwidth label') | 348 | .attr('class', 'bandwidth label') |
343 | .attr('transform', 'translate(' + x(x.range()[1]) + ', ' + y(data.bandwidth.slice(-1)[0].bandwidth) + ')') | 349 | .attr('transform', 'translate(' + x(x.range()[1]) + ', ' + y(data.bandwidth.slice(-1)[0].bandwidth) + ')') |
344 | .attr('dy', '1.35em') | 350 | .attr('dy', '1.35em') |
345 | .text('bandwidth'); | 351 | .text('bandwidth'); |
346 | 352 | svg.append('text') | |
347 | // buffered line | 353 | .attr('class', 'bandwidth label') |
348 | svg.selectAll('.buffered').remove(); | 354 | .attr('transform', 'translate(' + x(x.range()[1]) + ', ' + y(data.effectiveBandwidth.slice(-1)[0].bandwidth) + ')') |
349 | svg.append('path') | 355 | .attr('dy', '1.35em') |
350 | .datum(data.buffered) | 356 | .text('measured'); |
351 | .attr('class', 'line buffered') | ||
352 | .attr('y', 6) | ||
353 | .attr('d', bufferedLine); | ||
354 | 357 | ||
355 | // segment bitrate dots | 358 | // segment bitrate dots |
356 | svg.selectAll('.segment-bitrate').remove(); | 359 | svg.selectAll('.segment-bitrate').remove(); | ... | ... |
-
Please register or sign in to post a comment