54069f40 by David LaPalomento

Add throughput column

Calculate parser throughput and add a column to the result table to show it for each run.
1 parent 0eec9a25
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
31 </form> 31 </form>
32 <table> 32 <table>
33 <thead> 33 <thead>
34 <th>Iterations</th><th>Time</th> 34 <th>Iterations</th><th>Time</th><th>kB / second</th>
35 </thead> 35 </thead>
36 <tbody class="results"></tbody> 36 <tbody class="results"></tbody>
37 </table> 37 </table>
...@@ -41,16 +41,19 @@ var ...@@ -41,16 +41,19 @@ var
41 input = document.querySelector('input'), 41 input = document.querySelector('input'),
42 results = document.querySelector('.results'), 42 results = document.querySelector('.results'),
43 43
44 reportResults = function(label, elapsed) { 44 reportResults = function(count, elapsed) {
45 var 45 var
46 row = document.createElement('tr'), 46 row = document.createElement('tr'),
47 labelCell = document.createElement('td'), 47 countCell = document.createElement('td'),
48 elapsedCell = document.createElement('td'); 48 elapsedCell = document.createElement('td'),
49 throughputCell = document.createElement('td');
49 50
50 labelCell.innerText = label; 51 countCell.innerText = count;
51 elapsedCell.innerText = elapsed 52 elapsedCell.innerText = elapsed;
52 row.appendChild(labelCell); 53 throughputCell.innerText = ((bcSegment.byteLength * count) / elapsed) / 1024;
54 row.appendChild(countCell);
53 row.appendChild(elapsedCell); 55 row.appendChild(elapsedCell);
56 row.appendChild(throughputCell);
54 57
55 results.insertBefore(row, results.firstChild); 58 results.insertBefore(row, results.firstChild);
56 }; 59 };
...@@ -60,7 +63,6 @@ button.addEventListener('click', function(event) { ...@@ -60,7 +63,6 @@ button.addEventListener('click', function(event) {
60 iterations = input.value, 63 iterations = input.value,
61 parser = new window.videojs.hls.SegmentParser(), 64 parser = new window.videojs.hls.SegmentParser(),
62 start; 65 start;
63 console.log(iterations);
64 66
65 // setup 67 // setup
66 start = +new Date(); 68 start = +new Date();
......