private static string getBoundString(EMaliBound bound) { Array values = Enum.GetValues(typeof(EMaliBound)); StringBuilder sb = new StringBuilder(); for (int i = 0; i < values.Length; i++) { EMaliBound value = (EMaliBound)values.GetValue(i); if (value == EMaliBound.None) { continue; } if ((value & bound) == value) { if (sb.Length > 0) { sb.Append(", "); } sb.Append(value.ToString()); } } return(sb.ToString()); }
private static void getInstructionNormFormLine(string line, string title, out float a, out float l, out float v, out float t, out EMaliBound bound) { line = line.Trim(); string[] datas = line.Replace(title, string.Empty).Split(new string[] { " " }, StringSplitOptions.RemoveEmptyEntries); string boundString = string.Empty; if (datas.Length == 4) { a = float.Parse(datas[0]); l = float.Parse(datas[1]); v = -1.0f; t = float.Parse(datas[2]); boundString = datas[3]; } else { a = float.Parse(datas[0]); l = float.Parse(datas[1]); v = float.Parse(datas[2]); t = float.Parse(datas[3]); boundString = datas[4]; } bound = EMaliBound.None; string[] bounds = boundString.Split(new string[] { ", " }, StringSplitOptions.RemoveEmptyEntries); for (int i = 0; i < bounds.Length; i++) { string b = bounds[i].Trim(); switch (b) { case "A": bound |= EMaliBound.Arithmetic; break; case "LS": bound |= EMaliBound.Load_Store; break; case "V": bound |= EMaliBound.Varying; break; case "T": bound |= EMaliBound.Texture; break; } } }
private static void drawCycles(string title, float a, float l, float v, float t, EMaliBound bound) { EditorGUILayout.LabelField(title); EditorGUILayout.BeginHorizontal(); GUILayout.Space(50f); EditorGUILayout.BeginVertical(); EditorGUILayout.LabelField("算数周期 : ", a.ToString()); EditorGUILayout.LabelField("加载存储周期 : ", l.ToString()); if (v >= 0) { EditorGUILayout.LabelField("Varying周期 : ", v.ToString()); } EditorGUILayout.LabelField("纹理周期 : ", t.ToString()); EditorGUILayout.LabelField("性能瓶颈 : ", getBoundString(bound)); EditorGUILayout.EndVertical(); EditorGUILayout.EndHorizontal(); }