将数据添加到性能分析器中 参数 值
(PerformanceArg arg, float value)
| 72 | /// <param name="arg">参数</param> |
| 73 | /// <param name="value">值</param> |
| 74 | public void AddPerformance(PerformanceArg arg, float value) |
| 75 | { |
| 76 | int tIndex = (int)arg; |
| 77 | |
| 78 | if (_PerformanceDataCount[tIndex] == LogMaxCount) |
| 79 | { |
| 80 | for (int i = 1; i < LogMaxCount; ++i) |
| 81 | { |
| 82 | // 前移一个数据,腾出最后一个位置 |
| 83 | _PerformanceData[tIndex, i - 1] = _PerformanceData[tIndex, i]; |
| 84 | } |
| 85 | _PerformanceData[tIndex, LogMaxCount - 1] = value; |
| 86 | } |
| 87 | else |
| 88 | _PerformanceData[tIndex, _PerformanceDataCount[tIndex]++] = value; |
| 89 | |
| 90 | // 检查数据最大值 |
| 91 | float tMaxValue = 0; |
| 92 | for (int i = 0; i < _PerformanceDataCount[tIndex]; ++i) |
| 93 | tMaxValue = Math.Max(tMaxValue, _PerformanceData[tIndex, i]); |
| 94 | if (tMaxValue != 0) |
| 95 | _PerformaceMax[tIndex] = _PerformaceUnit[tIndex] * (float)Math.Ceiling(tMaxValue / _PerformaceUnit[tIndex]); |
| 96 | else |
| 97 | _PerformaceMax[tIndex] = _PerformaceUnit[tIndex]; |
| 98 | |
| 99 | // 通知控件刷新 |
| 100 | Invalidate(); |
| 101 | } |
| 102 | |
| 103 | private void PerformanceChart_Load(object sender, EventArgs e) |
| 104 | { |