public bool Load(string filename) { m_hanoiData = null; GraphItLuaPro.Clear(); try { string text = System.IO.File.ReadAllText(filename); HanoiNode.s_count = 0; m_hanoiData = new HanoiRoot(); m_hanoiData.callStats = new HanoiNode(null); //invaild json doc ,convert correct; string templateJsonText = "[$$]"; var resovleSessionJsonResult = handleSessionJsonObj(new JSONObject(templateJsonText.Replace("$$", text))); if (resovleSessionJsonResult != null) { m_hanoiData.callStats.Children.AddRange(resovleSessionJsonResult.DetailResult); var dataInfoMap = resovleSessionJsonResult.NavigateResult; GraphItLuaPro.Log(HanoiData.GRAPH_TIMECONSUMING, HanoiData.SUBGRAPH_LUA_TIMECONSUMING_INCLUSIVE, dataInfoMap[HanoiData.SUBGRAPH_LUA_TIMECONSUMING_INCLUSIVE]); GraphItLuaPro.Log(HanoiData.GRAPH_TIMECONSUMING, HanoiData.SUBGRAPH_LUA_TIMECONSUMING_EXCLUSIVE, dataInfoMap[HanoiData.SUBGRAPH_LUA_TIMECONSUMING_EXCLUSIVE]); GraphItLuaPro.Log(HanoiData.GRAPH_TIME_PERCENT, HanoiData.SUBGRAPH_LUA_PERCENT_INCLUSIVE, dataInfoMap[HanoiData.SUBGRAPH_LUA_PERCENT_INCLUSIVE]); GraphItLuaPro.Log(HanoiData.GRAPH_TIME_PERCENT, HanoiData.SUBGRAPH_LUA_PERCENT_EXCLUSIVE, dataInfoMap[HanoiData.SUBGRAPH_LUA_PERCENT_EXCLUSIVE]); } Debug.LogFormat("reading {0} objects.", HanoiNode.s_count); } catch (Exception e) { Debug.LogException(e); return(false); } return(true); }
private void DrawHanoiData(HanoiRoot r) { if (r.callStats == null) { return; } HanoiVars.LabelBackgroundWidth = GetDrawingLengthByPanelPixels(200); HanoiVars.DrawnStackCount = m_data.MaxStackLevel; // draw 3 passes HanoiUtil.DrawRecursively(r.callStats); HanoiUtil.DrawLabelsRecursively(r.callStats); }
public bool Load(string filename) { m_hanoiData = null; try { string templateJsonText = System.IO.File.ReadAllText("Assets/Resources/luaprofiler_jsonObjTemplates.json"); string text = System.IO.File.ReadAllText(filename); m_json = new JSONObject(templateJsonText.Replace("$$", text)); if (m_json.type != JSONObject.Type.OBJECT) { return(false); } if (m_json.list.Count != 1) { return(false); } HanoiNode.s_count = 0; m_hanoiData = new HanoiRoot(); if (m_json.GetField("content") && m_json.GetField("content").IsArray) { JSONObject jsonContent = m_json.GetField("content"); HanoiNode contentNode = new HanoiNode(null); for (int i = 0; i < jsonContent.list.Count; i++) { JSONObject j = (JSONObject)jsonContent.list[i]; HanoiNode newNode = null; bool isFrameInfo = j.GetField("frameID"); //是帧信息 if (isFrameInfo) { newNode = new HanoiFrameInfo(contentNode); } else { //函数信息 newNode = new HanoiNode(contentNode); } if (readObject(j, newNode)) { contentNode.Children.Add(newNode); } } Root.callStats = contentNode; } Debug.LogFormat("reading {0} objects.", HanoiNode.s_count); } catch (Exception e) { Debug.LogException(e); return(false); } return(true); }