Skip to content

Commit

Permalink
Added single include info to timeline tooltips
Browse files Browse the repository at this point in the history
  • Loading branch information
Viladoman committed Dec 19, 2023
1 parent 2ef052e commit d41be43
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions CompileScore/Shared/Timeline/TimelineNodeTooltip.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,33 @@ public TimelineNodeTooltip()
InitializeComponent();
}

private string GetThisIncludeDetailsText(TimelineNode node)
{
if ( node.Category == CompilerData.CompileCategory.Include && node.Value is CompileValue && node.Parent != null &&
node.Parent.Category == CompilerData.CompileCategory.Include && node.Parent.Value is CompileValue)
{
CompileValue includeeValue = (node.Value as CompileValue);
CompileValue includerValue = (node.Parent.Value as CompileValue);

int includeeIndex = CompilerData.Instance.GetIndexOf(CompilerData.CompileCategory.Include, includeeValue);
int includerIndex = CompilerData.Instance.GetIndexOf(CompilerData.CompileCategory.Include, includerValue);

IncludersInclValue inclValue = CompilerIncluders.Instance.GetIncludeInclValue(includerIndex,includeeIndex);

if (inclValue != null)
{
return includerValue.Name + " => " + includeeValue.Name + ":\n-"
+ " Max: " + Common.UIConverters.GetTimeStr(inclValue.Max)
+ " Avg: " + Common.UIConverters.GetTimeStr(inclValue.Average)
+ " Acc: " + Common.UIConverters.GetTimeStr(inclValue.Accumulated)
+ " Units: " + inclValue.Count;
}

}

return null;
}

private void OnNode()
{
if (node != null)
Expand Down Expand Up @@ -52,7 +79,15 @@ private void OnNode()
+" (Self: " + Common.UIConverters.GetTimeStr(val.SelfMax) + ")"
+" Min: " + Common.UIConverters.GetTimeStr(val.Min)
+" Avg: " + Common.UIConverters.GetTimeStr(val.Average)
+" Acc: " + Common.UIConverters.GetTimeStr(val.Accumulated)
+" (Self: " + Common.UIConverters.GetTimeStr(val.SelfAccumulated) + ")"
+" Units: " + val.Count;

string thisDetailsTxt = GetThisIncludeDetailsText(node);
if (thisDetailsTxt != null)
{
detailsText.Text = thisDetailsTxt + "\nGlobal:\n- " + detailsText.Text;
}
}
else if (node.Value is UnitValue)
{
Expand Down

0 comments on commit d41be43

Please sign in to comment.