(pureData: any)
| 366 | } |
| 367 | |
| 368 | renderBandwidth(pureData: any) { |
| 369 | const table = new Table({ |
| 370 | head: ["Path", "Total", "Count", "Average"], |
| 371 | style: { |
| 372 | head: this.options.isFile ? [] : ["yellow"], |
| 373 | border: this.options.isFile ? [] : ["grey"], |
| 374 | }, |
| 375 | }); |
| 376 | const data = this.collapsePaths(pureData, (b1: any, b2: any) => { |
| 377 | return { |
| 378 | bytes: b1.bytes + b2.bytes, |
| 379 | times: b1.times + b2.times, |
| 380 | }; |
| 381 | }); |
| 382 | const paths = Object.keys(data).sort((a: string, b: string) => { |
| 383 | return data[b].bytes - data[a].bytes; |
| 384 | }); |
| 385 | for (const path of paths) { |
| 386 | const bandwidth = data[path]; |
| 387 | const row = [ |
| 388 | path, |
| 389 | formatBytes(bandwidth.bytes), |
| 390 | formatNumber(bandwidth.times), |
| 391 | formatBytes(bandwidth.bytes / bandwidth.times), |
| 392 | ]; |
| 393 | table.push(row); |
| 394 | } |
| 395 | return table; |
| 396 | } |
| 397 | |
| 398 | renderOutgoingBandwidth() { |
| 399 | return this.renderBandwidth(this.state.outband); |
no test coverage detected