private void CbFind_TextChanged(object sender, EventArgs e) { TProfInstance Inst = null; FindInst(tv.SelectedNode.Text, cache.Root, ref Inst); RefreshListMerged(Inst); }
private void Tv_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e) { tv.Focus(); tv.Select(); TreeNode node = e.Node; if (node.Parent == null) { tv.SelectedNode = node.FirstNode; node.SelectedImageIndex = node.ImageIndex; node = node.FirstNode; //the parent is a placeholder and has no Inst so will error } node.SelectedImageIndex = node.ImageIndex; TProfInstance Inst = null; FindInst(node.Text, cache.Root, ref Inst); if (Inst != null) { lInfoName.Text = Inst.Name; lInfoFileName.Text = "File: " + Inst.FileName; lInfo.Text = "Self time: " + Inst.SelfTime.ToString() + " (" + FormatPercent(Inst.SelfPercent) + ")" + " Cumulative time: " + Inst.CumTime.ToString() + " (" + FormatPercent(Inst.CumPercent) + ")"; RefreshLists(Inst); } }
private void AddToTree(TreeNode Parent, TProfInstance Inst, bool Cascade) { bool UseShortName = !config.ShowFullPath; string S = string.Empty; if (UseShortName) { S = Inst.ShortName; } else { S = Inst.Name; } TreeNode node = new TreeNode(S); node.ImageIndex = (int)Inst.Kind; Parent.Nodes.Add(node); if (Cascade) { foreach (TProfInstance child in Inst.Calls) { AddToTree(node, child, true); } } }
public void aTreeGoToRoot_Click(object sender, EventArgs e) { TProfInstance CurrentInst = null; tv.SelectedNode = tv.Nodes[0]; FindInst(tv.SelectedNode.Text, cache.Root, ref CurrentInst); RefreshLists(CurrentInst); }
public void aViewHideLibFuncs_Click(object sender, EventArgs e) { aViewHideLibFuncs.ImageIndex = config.HideLibFuncs ? (int)tActionBarImageIndex.imgHideLibOn : (int)tActionBarImageIndex.imgHideLibOff; config.HideLibFuncs = !config.HideLibFuncs; TProfInstance Inst = null; FindInst(tv.SelectedNode.Text, cache.Root, ref Inst); if (Inst != null) { RefreshLists(Inst); } }
public void aViewGoToUpOneLevel_Click(object sender, EventArgs e) { TProfInstance LastInst = null; TProfInstance CurrentInst = null; if ((tv.SelectedNode != null) && (tv.SelectedNode.Parent != null)) { FindInst(tv.SelectedNode.Text, cache.Root, ref LastInst); tv.SelectedNode = tv.SelectedNode.Parent; FindInst(tv.SelectedNode.Text, cache.Root, ref CurrentInst); RefreshLists(CurrentInst); //SelectLBLInstance(LastInst); } }
private void FindInst(string name, TProfInstance Inst, ref TProfInstance returnInst) { if (Inst.Name == name) { returnInst = Inst; } else { foreach (TProfInstance child in Inst.Calls) { FindInst(name, child, ref returnInst); } } }
private void RefreshListMergedInstances(TProfInstance Parent) { TProfFunc Func = Parent.Func; FMergedInstances.Clear();// ClearListMergedInstances; if (lvMergedInstances.SelectedItems.Count > 0) { Func = (TProfFunc)FMergedInstances[lvMergedInstances.SelectedItems[0].Index].Func; } for (int i = 0; i < Func.InstanceCount; i++) { FMergedInstances.Add(Func.Instances[i]); } lvMergedInstancesInvalidate(); }
private void SyncTreeNode(TreeNode ANode) { bool UseShortName = !config.ShowFullPath; TProfInstance Inst = null; FindInst(ANode.Text, cache.Root, ref Inst); if (UseShortName) { ANode.Text = Inst.ShortName; } else { ANode.Text = Inst.Name; } for (int i = 0; i < ANode.Nodes.Count; i++) { SyncTreeNode(ANode.Nodes[i]); } }
private void RefreshListLBL(TProfInstance Parent) { TProfInstance Inst; string LastInst; bool Pass = true; LastInst = string.Empty; if (lvLBL.SelectedItems.Count > 0) { LastInst = lvLBL.SelectedItems[0].Name; } FListLBL.Clear(); for (int i = 0; i < Parent.CallCount - 1; i++) { Inst = Parent.Calls[i]; Pass = true; if (config.HideLibFuncs && (Inst.Kind == TFuncKind.fkLibFunc)) { Pass = false; } else if ((config.HideFastFuncs) && (Inst.CumTime < config.FastThreshold)) { Pass = false; } if (Pass) { FListLBL.Add(Inst);//FlistLBL needs to be a datasource } } //TODO: sort functions /* * if (ListLBLSort <> lsLine) * { * FListLBL.Sort(LBLSort); * } */ //lvLBL.Items.Count = FListLBL.Count; //SelectListItem(lvLBL, 0); SelectLBLInstance(LastInst); lvLBLInvalidate(); //rebind }
private void RefreshListMerged(TProfInstance Parent) { TProfFunc Func; string LastInst; string Q; bool Delete; System.Text.RegularExpressions.Regex RE = null; double SumSelf; double SumSelfPercent; int SumCalls; //lFind.Caption := ''; //TODO: set the text/caoption LastInst = string.Empty; if (lvMerged.SelectedItems.Count > 0) { LastInst = lvMerged.SelectedItems[0].Name; } FListMerged.Clear(); SumSelf = 0; SumSelfPercent = 0; SumCalls = 0; Parent.GetMerged(ref FListMerged); // filter if (cbRE.Checked) { Q = cbFind.Text; if (!String.IsNullOrEmpty(Q)) { try { RE = new System.Text.RegularExpressions.Regex(Q, RegexOptions.IgnoreCase); } catch (Exception) { Q = string.Empty; //TODO: show proper error in lFind //lFind.Caption := 'Pattern invalid'; //lFind.Visible := True; } } } else { Q = cbFind.Text.Trim().ToLower(); } for (int i = FListMerged.Count - 1; i > -1; i--) { Func = FListMerged[i]; // filtering Delete = false; // filter for hide funcs if (config.HideLibFuncs && (Func.Kind == TFuncKind.fkLibFunc)) { Delete = true; } // hide fast funcs else if (config.HideFastFuncs && (Func.TotCumTime < config.FastThreshold)) { Delete = true; } // find else if (Q != "") { if (cbRE.Checked) { Match m = RE.Match(Func.Name); if (!m.Success) { Delete = true; } } else { if (Func.Name.ToLower().IndexOf(Q) <= 0) { Delete = true; } } } if (Delete) { FListMerged.RemoveAt(i); } else { // calculate sum SumSelf = SumSelf + Func.TotSelfTime; SumSelfPercent = SumSelfPercent + Func.TotSelfPercent; SumCalls = SumCalls + Func.InstanceCount; } } // ok, continue //FListMerged.Sort(MergedSort); //TODO: sort //lvMerged.Items.Count := FListMerged.Count; // select last function if available //SelectListItem(lvMerged, 0); SelectMergedFunc(LastInst); lvMergedInvalidate(); lMerged.Text = " Sum of total self time: " + FormatMs(SumSelf) + " (" + FormatPercent(SumSelfPercent) + ")" + " Sum of calls: " + string.Format("{0:0}", (SumCalls * 1.0)); }
private void RefreshLists(TProfInstance Inst) { RefreshListLBL(Inst); RefreshListMerged(Inst); RefreshListMergedInstances(Inst); }