Skip to content

Commit

Permalink
Fix throughput analysis II (#108)
Browse files Browse the repository at this point in the history
  • Loading branch information
ludeknovy authored Mar 9, 2021
1 parent 68d5539 commit 3fb4eb2
Showing 1 changed file with 22 additions and 20 deletions.
42 changes: 22 additions & 20 deletions src/app/item-detail/item-detail.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -294,33 +294,35 @@ export class ItemDetailComponent implements OnInit {
}

private calculateThroughputVariability() {
const { overallThroughput, threads } = this.itemData.plot;
const { maxVu, throughput } = this.itemData.overview;
const rampUpIndex = threads.map(_ => _[1]).indexOf(maxVu);
try {
const { overallThroughput, threads } = this.itemData.plot;
const { maxVu, throughput } = this.itemData.overview;
const rampUpIndex = threads.map(_ => _[1]).indexOf(maxVu);

const throughputValues = overallThroughput.data.slice(rampUpIndex, -2).map(_ => _[1]);
const minThroughput = Math.min(...throughputValues);
const minThroughputIndex = throughputValues.indexOf(minThroughput);
const maxBandIndex = throughputValues.length;
const bandTo = minThroughputIndex + 5 <= maxBandIndex ? minThroughputIndex + 3 : maxBandIndex;
const throughputBandValues = [
overallThroughput.data.slice(rampUpIndex)[minThroughputIndex - 3][0],
overallThroughput.data.slice(rampUpIndex)[bandTo][0]
];
const throughputVariability = this.roundNumberTwoDecimals(100 - (minThroughput / throughput) * 100);

const throughputValues = overallThroughput.data.slice(rampUpIndex, -2).map(_ => _[1]);
if (throughputValues.length === 0) {
return {
value: throughputVariability,
failed: throughputVariability > 20,
bandValues: throughputBandValues
};
} catch (error) {
return {
value: null,
failed: false,
bandValues: []
};
}
const minThroughput = Math.min(...throughputValues);
const minThroughputIndex = throughputValues.indexOf(minThroughput);
const maxBandIndex = throughputValues.length;
const bandTo = minThroughputIndex + 5 <= maxBandIndex ? minThroughputIndex + 3 : maxBandIndex;
const throughputBandValues = [
overallThroughput.data.slice(rampUpIndex)[minThroughputIndex - 3][0],
overallThroughput.data.slice(rampUpIndex)[bandTo][0]
];
const throughputVariability = this.roundNumberTwoDecimals(100 - (minThroughput / throughput) * 100);

return {
value: throughputVariability,
failed: throughputVariability > 20,
bandValues: throughputBandValues
};

}

bytesToMbps(bytes) {
Expand Down

0 comments on commit 3fb4eb2

Please sign in to comment.