fix(性能测试): 修复压力图表的bug --bug=1005191 --user=刘瑞斌 【性能测试-新建性能测... https://www.tapd.cn/55049933/s/1025683
This commit is contained in:
parent
fa03fada52
commit
4826d98152
|
@ -419,13 +419,15 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
calculateTotalChart() {
|
calculateTotalChart() {
|
||||||
|
this.rampUpTimeVisible = false;
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.rampUpTimeVisible = true;
|
||||||
|
this._calculateTotalChart();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
_calculateTotalChart() {
|
||||||
let handler = this;
|
let handler = this;
|
||||||
if (handler.duration < handler.rampUpTime) {
|
|
||||||
handler.rampUpTime = handler.duration;
|
|
||||||
}
|
|
||||||
if (handler.rampUpTime < handler.step) {
|
|
||||||
handler.step = handler.rampUpTime;
|
|
||||||
}
|
|
||||||
let color = ['#60acfc', '#32d3eb', '#5bc49f', '#feb64d', '#ff7c7c', '#9287e7', '#ca8622', '#bda29a', '#6e7074', '#546570', '#c4ccd3'];
|
let color = ['#60acfc', '#32d3eb', '#5bc49f', '#feb64d', '#ff7c7c', '#9287e7', '#ca8622', '#bda29a', '#6e7074', '#546570', '#c4ccd3'];
|
||||||
handler.options = {
|
handler.options = {
|
||||||
color: color,
|
color: color,
|
||||||
|
@ -444,23 +446,26 @@ export default {
|
||||||
};
|
};
|
||||||
|
|
||||||
for (let i = 0; i < handler.threadGroups.length; i++) {
|
for (let i = 0; i < handler.threadGroups.length; i++) {
|
||||||
if (handler.threadGroups[i].enabled === 'false' ||
|
let tg = handler.threadGroups[i];
|
||||||
handler.threadGroups[i].deleted === 'true' ||
|
|
||||||
handler.threadGroups[i].threadType === 'ITERATION') {
|
if (tg.enabled === 'false' ||
|
||||||
|
tg.deleted === 'true' ||
|
||||||
|
tg.threadType === 'ITERATION') {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if (tg.duration < tg.rampUpTime) {
|
||||||
|
tg.rampUpTime = tg.duration;
|
||||||
|
}
|
||||||
|
if (tg.rampUpTime < tg.step) {
|
||||||
|
tg.step = tg.rampUpTime;
|
||||||
|
}
|
||||||
let seriesData = {
|
let seriesData = {
|
||||||
name: handler.threadGroups[i].attributes.testname,
|
name: tg.attributes.testname,
|
||||||
data: [],
|
data: [],
|
||||||
type: 'line',
|
type: 'line',
|
||||||
smooth: false,
|
smooth: false,
|
||||||
symbolSize: 5,
|
symbolSize: 5,
|
||||||
showSymbol: false,
|
showSymbol: false,
|
||||||
lineStyle: {
|
|
||||||
normal: {
|
|
||||||
width: 1
|
|
||||||
}
|
|
||||||
},
|
|
||||||
areaStyle: {
|
areaStyle: {
|
||||||
normal: {
|
normal: {
|
||||||
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
|
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
|
||||||
|
@ -483,7 +488,6 @@ export default {
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
let tg = handler.threadGroups[i];
|
|
||||||
|
|
||||||
let timePeriod = Math.floor(tg.rampUpTime / tg.step);
|
let timePeriod = Math.floor(tg.rampUpTime / tg.step);
|
||||||
let timeInc = timePeriod;
|
let timeInc = timePeriod;
|
||||||
|
@ -515,13 +519,15 @@ export default {
|
||||||
seriesData.step = undefined;
|
seriesData.step = undefined;
|
||||||
|
|
||||||
if (j === 0) {
|
if (j === 0) {
|
||||||
seriesData.data.push([0, 0]);
|
seriesData.data.push(['0', 0]);
|
||||||
}
|
}
|
||||||
if (j >= tg.rampUpTime) {
|
if (j >= tg.rampUpTime) {
|
||||||
xAxis.push(duration);
|
if (xAxis.indexOf(duration) < 0) {
|
||||||
|
xAxis.push(duration);
|
||||||
|
}
|
||||||
|
|
||||||
seriesData.data.push([j, tg.threadNumber]);
|
seriesData.data.push([j + '', tg.threadNumber]);
|
||||||
seriesData.data.push([duration, tg.threadNumber]);
|
seriesData.data.push([duration + '', tg.threadNumber]);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -537,16 +543,23 @@ export default {
|
||||||
if (threadPeriod > tg.threadNumber) {
|
if (threadPeriod > tg.threadNumber) {
|
||||||
threadPeriod = tg.threadNumber;
|
threadPeriod = tg.threadNumber;
|
||||||
// 预热结束
|
// 预热结束
|
||||||
xAxis.push(duration);
|
if (xAxis.indexOf(duration) < 0) {
|
||||||
seriesData.data.push([duration, threadPeriod]);
|
xAxis.push(duration);
|
||||||
|
}
|
||||||
|
|
||||||
|
seriesData.data.push([j + '', threadPeriod]);
|
||||||
|
seriesData.data.push([duration + '', threadPeriod]);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
seriesData.data.push([j, threadPeriod]);
|
seriesData.data.push([j + '', threadPeriod]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// x 轴排序
|
||||||
|
handler.options.xAxis.data = handler.options.xAxis.data.sort((a, b) => a - b);
|
||||||
handler.options.series.push(seriesData);
|
handler.options.series.push(seriesData);
|
||||||
}
|
}
|
||||||
|
// console.log(JSON.stringify(handler.options));
|
||||||
},
|
},
|
||||||
validConfig() {
|
validConfig() {
|
||||||
if (!this.resourcePool) {
|
if (!this.resourcePool) {
|
||||||
|
|
Loading…
Reference in New Issue