MCPcopy Create free account
hub / github.com/9chu/LuaSTGPlus / AddPerformance

Method AddPerformance

PerformanceMonitor/PerformanceChart.cs:74–101  ·  view source on GitHub ↗

将数据添加到性能分析器中 参数 值

(PerformanceArg arg, float value)

Source from the content-addressed store, hash-verified

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 {

Callers 1

timer_main_TickMethod · 0.80

Calls 1

MaxMethod · 0.80

Tested by

no test coverage detected