diff --git a/frontend/src/business/components/performance/report/components/PerformancePressureConfig.vue b/frontend/src/business/components/performance/report/components/PerformancePressureConfig.vue index 9ff0c1afcb..8df48e0813 100644 --- a/frontend/src/business/components/performance/report/components/PerformancePressureConfig.vue +++ b/frontend/src/business/components/performance/report/components/PerformancePressureConfig.vue @@ -348,25 +348,45 @@ export default { let threadInc2 = Math.ceil(tg.threadNumber / tg.step); let inc2count = tg.threadNumber - tg.step * threadInc1; for (let j = 0; j <= tg.duration; j++) { - - if (j > timePeriod) { - timePeriod += timeInc; - if (inc2count > 0) { - threadPeriod = threadPeriod + threadInc2; - inc2count--; - } else { - threadPeriod = threadPeriod + threadInc1; - } - if (threadPeriod > tg.threadNumber) { - threadPeriod = tg.threadNumber; - } - } // x 轴 let xAxis = handler.options.xAxis.data; if (xAxis.indexOf(j) < 0) { xAxis.push(j); } - seriesData.data.push(threadPeriod); + + if (tg.tgType === 'ThreadGroup') { + seriesData.step = undefined; + + if (j === 0) { + seriesData.data.push([0, 0]); + } + if (j > tg.rampUpTime) { + xAxis.push(tg.duration); + + seriesData.data.push([j, tg.threadNumber]); + seriesData.data.push([tg.duration, tg.threadNumber]); + break; + } + } else { + seriesData.step = 'start'; + if (j > timePeriod) { + timePeriod += timeInc; + if (inc2count > 0) { + threadPeriod = threadPeriod + threadInc2; + inc2count--; + } else { + threadPeriod = threadPeriod + threadInc1; + } + if (threadPeriod > tg.threadNumber) { + threadPeriod = tg.threadNumber; + // 预热结束 + xAxis.push(tg.duration); + seriesData.data.push([tg.duration, threadPeriod]); + break; + } + } + seriesData.data.push([j, threadPeriod]); + } } handler.options.series.push(seriesData); } @@ -445,20 +465,39 @@ export default { for (let i = 0; i <= handler.duration; i++) { // x 轴 handler.options.xAxis.data.push(i); - if (i > timePeriod) { - timePeriod += timeInc; - if (inc2count > 0) { - threadPeriod = threadPeriod + threadInc2; - inc2count--; - } else { - threadPeriod = threadPeriod + threadInc1; + if (handler.tgType === 'ThreadGroup') { + handler.options.series[0].step = undefined; + + if (i === 0) { + handler.options.series[0].data.push([0, 0]); } - if (threadPeriod > handler.threadNumber) { - threadPeriod = handler.threadNumber; + if (i > handler.rampUpTime) { + handler.options.xAxis.data.push(handler.duration); + + handler.options.series[0].data.push([i, handler.threadNumber]); + handler.options.series[0].data.push([handler.duration, handler.threadNumber]); + break; } - handler.options.series[0].data.push(threadPeriod); } else { - handler.options.series[0].data.push(threadPeriod); + handler.options.series[0].step = 'start'; + if (i > timePeriod) { + timePeriod += timeInc; + if (inc2count > 0) { + threadPeriod = threadPeriod + threadInc2; + inc2count--; + } else { + threadPeriod = threadPeriod + threadInc1; + } + if (threadPeriod > handler.threadNumber) { + threadPeriod = handler.threadNumber; + handler.options.xAxis.data.push(handler.duration); + handler.options.series[0].data.push([handler.duration, handler.threadNumber]); + break; + } + handler.options.series[0].data.push([i, threadPeriod]); + } else { + handler.options.series[0].data.push([i, threadPeriod]); + } } } this.calculateTotalChart(); diff --git a/frontend/src/business/components/performance/test/EditPerformanceTest.vue b/frontend/src/business/components/performance/test/EditPerformanceTest.vue index ae69a14a05..97596ac98e 100644 --- a/frontend/src/business/components/performance/test/EditPerformanceTest.vue +++ b/frontend/src/business/components/performance/test/EditPerformanceTest.vue @@ -28,6 +28,7 @@ @@ -129,12 +130,12 @@ export default { let file = new File([blob], apiTest.jmx.name); this.$refs.basicConfig.beforeUploadJmx(file); this.$refs.basicConfig.handleUpload({file: file}); - if(JSON.stringify(apiTest.jmx.attachFiles) != "{}"){ + if (JSON.stringify(apiTest.jmx.attachFiles) != "{}") { let attachFiles = []; - for(let fileID in apiTest.jmx.attachFiles){ - attachFiles.push(fileID); - } - if(attachFiles.length > 0){ + for (let fileID in apiTest.jmx.attachFiles) { + attachFiles.push(fileID); + } + if (attachFiles.length > 0) { this.$refs.basicConfig.selectAttachFileById(attachFiles); } } @@ -229,18 +230,18 @@ export default { var bytes = new Array(); var len, c; len = str.length; - for(var i = 0; i < len; i++) { + for (var i = 0; i < len; i++) { c = str.charCodeAt(i); - if(c >= 0x010000 && c <= 0x10FFFF) { + if (c >= 0x010000 && c <= 0x10FFFF) { bytes.push(((c >> 18) & 0x07) | 0xF0); bytes.push(((c >> 12) & 0x3F) | 0x80); bytes.push(((c >> 6) & 0x3F) | 0x80); bytes.push((c & 0x3F) | 0x80); - } else if(c >= 0x000800 && c <= 0x00FFFF) { + } else if (c >= 0x000800 && c <= 0x00FFFF) { bytes.push(((c >> 12) & 0x0F) | 0xE0); bytes.push(((c >> 6) & 0x3F) | 0x80); bytes.push((c & 0x3F) | 0x80); - } else if(c >= 0x000080 && c <= 0x0007FF) { + } else if (c >= 0x000080 && c <= 0x0007FF) { bytes.push(((c >> 6) & 0x1F) | 0xC0); bytes.push((c & 0x3F) | 0x80); } else { @@ -347,6 +348,10 @@ export default { threadGroups.forEach(tg => { handler.calculateChart(tg); }) + }, + tgTypeChange(threadGroup) { + let handler = this.$refs.pressureConfig; + handler.calculateChart(threadGroup); } } } diff --git a/frontend/src/business/components/performance/test/components/PerformanceBasicConfig.vue b/frontend/src/business/components/performance/test/components/PerformanceBasicConfig.vue index 08062c8ea5..44bcc186a9 100644 --- a/frontend/src/business/components/performance/test/components/PerformanceBasicConfig.vue +++ b/frontend/src/business/components/performance/test/components/PerformanceBasicConfig.vue @@ -46,7 +46,7 @@