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

Class PerformanceChart

PerformanceMonitor/PerformanceChart.cs:12–128  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10namespace PerformanceMonitor
11{
12 public partial class PerformanceChart : UserControl
13 {
14 /// <summary>
15 /// 性能参数
16 /// </summary>
17 public enum PerformanceArg
18 {
19 CPU = 0,
20 Memory,
21 FPS,
22 Objects,
23 FrameTime,
24 RenderTime
25 }
26
27 private const int LogMaxCount = 100;
28 private const float DefaultPenSize = 3;
29 private float[,] _PerformanceData = new float[6, LogMaxCount];
30 private int[] _PerformanceDataCount = new int[6];
31 private float[] _PerformaceUnit = new float[6]; // 性能最小显示单位
32 private float[] _PerformaceMax = new float[6]; // 性能显示的上限值
33 private Pen[] _PerformancePen = new Pen[6]; // 绘制画笔
34
35 public PerformanceChart()
36 {
37 InitializeComponent();
38
39 _PerformancePen[0] = new Pen(Color.LightSkyBlue, DefaultPenSize);
40 _PerformancePen[1] = new Pen(Color.BlueViolet, DefaultPenSize);
41 _PerformancePen[2] = new Pen(Color.ForestGreen, DefaultPenSize);
42 _PerformancePen[3] = new Pen(Color.Maroon, DefaultPenSize);
43 _PerformancePen[4] = new Pen(Color.LightSalmon, DefaultPenSize);
44 _PerformancePen[5] = new Pen(Color.Peru, DefaultPenSize);
45
46 Reset();
47 }
48
49 /// <summary>
50 /// 清空性能分析器
51 /// </summary>
52 public void Reset()
53 {
54 // 初始化参数
55 _PerformaceUnit[0] = 100; // CPU显示单位
56 _PerformaceUnit[1] = 1000 * 1024 * 1024; // 内存显示单位
57 _PerformaceUnit[2] = 80; // FPS显示单位
58 _PerformaceUnit[3] = 1000; // 对象显示单位
59 _PerformaceUnit[4] = 0.05f; // 帧逻辑时间
60 _PerformaceUnit[5] = 0.05f; // 帧渲染时间
61
62 for (int i = 0; i < _PerformaceMax.Count(); ++i)
63 _PerformaceMax[i] = _PerformaceUnit[i];
64
65 // 通知控件刷新
66 Invalidate();
67 }
68
69 /// <summary>

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected